protected boolean checkAuthorizablePath()

in src/main/java/org/apache/sling/jackrabbit/usermanager/impl/AuthorizablePrivilegesInfoImpl.java [195:222]


    protected boolean checkAuthorizablePath(Session jcrSession, String principalId,
            AuthorizableChecker authorizableChecker, AccessChecker accessChecker) throws RepositoryException {
        boolean hasRights = false;
        UserManager userManager = AccessControlUtil.getUserManager(jcrSession);
        Authorizable currentUser = userManager.getAuthorizable(jcrSession.getUserID());

        Authorizable authorizable = userManager.getAuthorizable(principalId);

        if (authorizable == null) {
            log.debug("Failed to find authorizable: {}", principalId);
        } else {
            // delegate to the checker to determine if valid
            if (authorizableChecker != null && !authorizableChecker.isValid(authorizable)) {
                // no rights, so skip the rest
            } else {
                if (currentUser instanceof User && ((User)currentUser).isAdmin()){
                    hasRights = true; //admin user has full control
                } else {
                    String path = authorizable.getPath();
                    if (accessChecker != null) {
                        hasRights = accessChecker.hasRights(path);
                    }
                }
            }
        }

        return hasRights;
    }