Thanks, I will be updating the DB2 adapter and adding a Derby adapter
shortly so I will include this patch and test it along with my other
changes.

Michael Oliver
CTO
Alarius Systems LLC
6800 E. Lake Mead Blvd, #1096
Las Vegas, NV 89156
Phone:(702)953-8949
Fax:(702)974-0341
 

-----Original Message-----
From: Maximo Gurmendez [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 28, 2005 11:32 AM
To: Slide Users Mailing List
Subject: SQLServer revokePermissions problem

I noticed that the following function from the StandardRDBMSAdapter would
not work in SQLServer

public void revokePermission(Connection connection, Uri uri, NodePermission
permission)

The SQLServerRDBMSAdapter does not implement this function and therefore it
uses the StandardRDBMSAdapter, which executes a non-SQLSERVER compliant SQL
statement. 
However I did the correction, I extended the function in the
SQLServerRDBMSAdapter. You may be take this into account for future
releases. I paste the solution below.
Regards,
   Máximo


   public void revokePermission(Connection connection, Uri uri,
NodePermission permission)
    throws ServiceAccessException {
    if (permission == null) return;
    StringBuffer sql = new StringBuffer("delete PERMISSIONS from PERMISSIONS
p, URI ou, URI su, URI au WHERE ou.URI_STRING = ? and su.URI_STRING = ? and
au.URI_STRING = ? " +
        "   and p.SUBJECT_ID=su.URI_ID and p.OBJECT_ID=ou.URI_ID and
p.ACTION_ID=au.URI_ID");
    PreparedStatement statement = null;
    try {
        final NodeRevisionNumber revisionNumber;
        revisionNumber = permission.getRevisionNumber();
        // generate proper sql based on content of revision number
        if (revisionNumber != null) {
            sql.append(" and VERSION_NO = ?");
        } else {
            sql.append(" and VERSION_NO IS NULL");
        }
        statement = connection.prepareStatement(sql.toString());
        statement.setString(1, uri.toString());
        statement.setString(2, permission.getSubjectUri());
        statement.setString(3, permission.getActionUri());
        if (revisionNumber != null) {
            statement.setString(4, revisionNumber.toString());
        }
        statement.executeUpdate();
    } catch (SQLException e) {
        throw createException(e, uri.toString());
    } finally {
        close(statement);
    }
}







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to