Source:
private final boolean hasPermission( String workspaceName, Path path, String... actions ) { assert path == null ? true : path.isAbsolute() : "The path (if provided) must be absolute"; SecurityContext sec = context.getSecurityContext(); final String repositoryName = this.repository.repositoryName(); if (sec instanceof AuthorizationProvider) { AuthorizationProvider authorizer = (AuthorizationProvider)sec; return authorizer.hasPermission(context, repositoryName, repositoryName, workspaceName, path, actions); } boolean hasPermission = true; if (sec instanceof AdvancedAuthorizationProvider) { AdvancedAuthorizationProvider authorizer = (AdvancedAuthorizationProvider)sec; hasPermission = authorizer.hasPermission(authorizerContext, path, actions); if (hasPermission) { hasPermission = acm.hasPermission(path, actions); } return hasPermission; } for (String action : actions) { if (ModeShapePermissions.READ.equals(action)) { hasPermission &= hasRole(sec, ModeShapeRoles.READONLY, repositoryName, workspaceName) || hasRole(sec, ModeShapeRoles.READWRITE, repositoryName, workspaceName) || hasRole(sec, ModeShapeRoles.ADMIN, repositoryName, workspaceName); } else if (ModeShapePermissions.REGISTER_NAMESPACE.equals(action) || ModeShapePermissions.REGISTER_TYPE.equals(action) || ModeShapePermissions.UNLOCK_ANY.equals(action) || ModeShapePermissions.CREATE_WORKSPACE.equals(action) || ModeShapePermissions.DELETE_WORKSPACE.equals(action) || ModeShapePermissions.MONITOR.equals(action) || ModeShapePermissions.DELETE_WORKSPACE.equals(action) || ModeShapePermissions.INDEX_WORKSPACE.equals(action)) { hasPermission &= hasRole(sec, ModeShapeRoles.ADMIN, repositoryName, workspaceName); } else { hasPermission &= hasRole(sec, ModeShapeRoles.ADMIN, repositoryName, workspaceName) || hasRole(sec, ModeShapeRoles.READWRITE, repositoryName, workspaceName); } } if (hasPermission) { hasPermission = acm.hasPermission(path, actions); } return hasPermission; }

Target:
private final boolean hasPermission( String workspaceName, Path path, String... actions ) { assert path == null ? true : path.isAbsolute() : "The path (if provided) must be absolute"; SecurityContext sec = context.getSecurityContext(); boolean hasPermission = true; final String repositoryName = this.repository.repositoryName(); if (sec instanceof AuthorizationProvider) { AuthorizationProvider authorizer = (AuthorizationProvider)sec; hasPermission = authorizer.hasPermission(context, repositoryName, repositoryName, workspaceName, path, actions); if (hasPermission) { hasPermission = acm.hasPermission(path, actions); } return hasPermission; } if (sec instanceof AdvancedAuthorizationProvider) { AdvancedAuthorizationProvider authorizer = (AdvancedAuthorizationProvider)sec; hasPermission = authorizer.hasPermission(authorizerContext, path, actions); if (hasPermission) { hasPermission = acm.hasPermission(path, actions); } return hasPermission; } for (String action : actions) { if (ModeShapePermissions.READ.equals(action)) { hasPermission &= hasRole(sec, ModeShapeRoles.READONLY, repositoryName, workspaceName) || hasRole(sec, ModeShapeRoles.READWRITE, repositoryName, workspaceName) || hasRole(sec, ModeShapeRoles.ADMIN, repositoryName, workspaceName); } else if (ModeShapePermissions.REGISTER_NAMESPACE.equals(action) || ModeShapePermissions.REGISTER_TYPE.equals(action) || ModeShapePermissions.UNLOCK_ANY.equals(action) || ModeShapePermissions.CREATE_WORKSPACE.equals(action) || ModeShapePermissions.DELETE_WORKSPACE.equals(action) || ModeShapePermissions.MONITOR.equals(action) || ModeShapePermissions.DELETE_WORKSPACE.equals(action) || ModeShapePermissions.INDEX_WORKSPACE.equals(action)) { hasPermission &= hasRole(sec, ModeShapeRoles.ADMIN, repositoryName, workspaceName); } else { hasPermission &= hasRole(sec, ModeShapeRoles.ADMIN, repositoryName, workspaceName) || hasRole(sec, ModeShapeRoles.READWRITE, repositoryName, workspaceName); } } if (hasPermission) { hasPermission = acm.hasPermission(path, actions); } return hasPermission; }