Search in sources :

Example 1 with RightMap

use of org.xwiki.security.authorization.RightMap in project xwiki-platform by xwiki.

the class PrioritizingAuthorizationSettler method settle.

@Override
protected XWikiSecurityAccess settle(UserSecurityReference user, Collection<GroupSecurityReference> groups, SecurityRuleEntry entry, Policies policies) {
    XWikiSecurityAccess access = new XWikiSecurityAccess();
    Map<Right, Integer> priorities = new RightMap<Integer>();
    SecurityReference reference = entry.getReference();
    Set<Right> enabledRights = Right.getEnabledRights(reference.getSecurityType());
    // Evaluate rules from current level
    for (Right right : enabledRights) {
        for (SecurityRule obj : entry.getRules()) {
            if (obj.match(right)) {
                resolveLevel(right, user, groups, obj, access, policies, priorities);
                if (access.get(right) == ALLOW) {
                    implyRights(right, access, reference, policies, priorities);
                }
            }
        }
    }
    return access;
}
Also used : RightMap(org.xwiki.security.authorization.RightMap) Right(org.xwiki.security.authorization.Right) GroupSecurityReference(org.xwiki.security.GroupSecurityReference) SecurityReference(org.xwiki.security.SecurityReference) UserSecurityReference(org.xwiki.security.UserSecurityReference) SecurityRule(org.xwiki.security.authorization.SecurityRule)

Aggregations

GroupSecurityReference (org.xwiki.security.GroupSecurityReference)1 SecurityReference (org.xwiki.security.SecurityReference)1 UserSecurityReference (org.xwiki.security.UserSecurityReference)1 Right (org.xwiki.security.authorization.Right)1 RightMap (org.xwiki.security.authorization.RightMap)1 SecurityRule (org.xwiki.security.authorization.SecurityRule)1