Search in sources :

Example 1 with RemotePrincipal

use of org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal in project jackrabbit by apache.

the class ServerAccessControlList method addAccessControlEntry.

public boolean addAccessControlEntry(RemotePrincipal principal, RemotePrivilege[] privileges) throws RepositoryException {
    Principal p = null;
    if (principal instanceof ServerPrincipal) {
        p = ((ServerPrincipal) principal).getPrincipal();
    }
    Privilege[] privs = new Privilege[privileges.length];
    for (int i = 0; privs != null && i < privs.length; i++) {
        if (privileges[i] instanceof ServerPrivilege) {
            privs[i] = ((ServerPrivilege) privileges[i]).getPrivilege();
        } else {
            // not a compatible remote privilege, abort
            privs = null;
        }
    }
    if (p != null && privs != null) {
        return ((AccessControlList) getAccessControlPolicy()).addAccessControlEntry(p, privs);
    }
    throw new RepositoryException("Unsupported Remote types");
}
Also used : AccessControlList(javax.jcr.security.AccessControlList) RemoteAccessControlList(org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlList) ServerPrincipal(org.apache.jackrabbit.rmi.server.principal.ServerPrincipal) RepositoryException(javax.jcr.RepositoryException) Privilege(javax.jcr.security.Privilege) RemotePrivilege(org.apache.jackrabbit.rmi.remote.security.RemotePrivilege) Principal(java.security.Principal) ServerPrincipal(org.apache.jackrabbit.rmi.server.principal.ServerPrincipal) RemotePrincipal(org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal)

Aggregations

Principal (java.security.Principal)1 RepositoryException (javax.jcr.RepositoryException)1 AccessControlList (javax.jcr.security.AccessControlList)1 Privilege (javax.jcr.security.Privilege)1 RemotePrincipal (org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal)1 RemoteAccessControlList (org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlList)1 RemotePrivilege (org.apache.jackrabbit.rmi.remote.security.RemotePrivilege)1 ServerPrincipal (org.apache.jackrabbit.rmi.server.principal.ServerPrincipal)1