I've changed AbstractStore.grantPermission() to check whether a 
permission exists before creating it. I'm not sure whether that's the 
appropriate place for the check, though.

(I can't currently connect to the jakarta cvs-pserver for some reason, 
so I'm including the actual code here instead of a diff, sorry.)

src/share/org/apache/slide/store/AbstractStore.java, line 576ff
================================================================
public void grantPermission(Uri uri, NodePermission permission)
    throws ServiceAccessException {
    NodePermission tempPermission = permission.cloneObject();
    tempPermission.validate(uri.toString());
    
    // Checking if the permission is already present
    Enumeration permissions = enumeratePermissions(uri);
    while (permissions.hasMoreElements()) {
        if (tempPermission.equals(permissions.nextElement())) {
            return;
        }
    }
    
    // Not present yet, so create it
    enlist(securityStore);
    try {
        securityStore.grantPermission(uri, tempPermission);
    } catch (ServiceAccessException e) {
        delist(securityStore, false);
        throw e;
    }
    delist(securityStore);
}
================================================================

-chris
________________________________________________________________
[EMAIL PROTECTED]


Reply via email to