Search in sources :

Example 1 with DomainedRightsByTargetType

use of com.zimbra.cs.account.accesscontrol.RightCommand.DomainedRightsByTargetType in project zm-mailbox by Zimbra.

the class TestACLAll method isRightInGetAllEffectiveRights.

private boolean isRightInGetAllEffectiveRights(AllEffectiveRights allEffRights, Account grantee, Entry target, Right right, RightType rightType, boolean allAttrs, Set<String> attrs) throws ServiceException {
    TargetType targetType = TargetType.getTargetType(target);
    Map<TargetType, RightsByTargetType> rbttMap = allEffRights.rightsByTargetType();
    RightsByTargetType rbtt = rbttMap.get(targetType);
    if (rbtt != null) {
        boolean found = false;
        // all entries
        EffectiveRights effRights = rbtt.all();
        if (effRights != null) {
            found = isRightInEffectiveRights(effRights, right, rightType, allAttrs, attrs);
            if (found) {
                return true;
            }
        }
        // check domained entries
        if (rbtt instanceof DomainedRightsByTargetType) {
            DomainedRightsByTargetType domainedRights = (DomainedRightsByTargetType) rbtt;
            for (RightAggregation rightsByDomains : domainedRights.domains()) {
                found = isRightInRightAggregation(rightsByDomains, true, target, right, rightType, allAttrs, attrs);
                if (found) {
                    return true;
                }
            }
        }
        // check individual entry
        for (RightCommand.RightAggregation rightsByEntries : rbtt.entries()) {
            found = isRightInRightAggregation(rightsByEntries, false, target, right, rightType, allAttrs, attrs);
            if (found) {
                return true;
            }
        }
    }
    return false;
}
Also used : AllEffectiveRights(com.zimbra.cs.account.accesscontrol.RightCommand.AllEffectiveRights) EffectiveRights(com.zimbra.cs.account.accesscontrol.RightCommand.EffectiveRights) RightsByTargetType(com.zimbra.cs.account.accesscontrol.RightCommand.RightsByTargetType) DomainedRightsByTargetType(com.zimbra.cs.account.accesscontrol.RightCommand.DomainedRightsByTargetType) DomainedRightsByTargetType(com.zimbra.cs.account.accesscontrol.RightCommand.DomainedRightsByTargetType) RightAggregation(com.zimbra.cs.account.accesscontrol.RightCommand.RightAggregation) TargetType(com.zimbra.cs.account.accesscontrol.TargetType) RightsByTargetType(com.zimbra.cs.account.accesscontrol.RightCommand.RightsByTargetType) DomainedRightsByTargetType(com.zimbra.cs.account.accesscontrol.RightCommand.DomainedRightsByTargetType) RightAggregation(com.zimbra.cs.account.accesscontrol.RightCommand.RightAggregation) RightCommand(com.zimbra.cs.account.accesscontrol.RightCommand)

Aggregations

RightCommand (com.zimbra.cs.account.accesscontrol.RightCommand)1 AllEffectiveRights (com.zimbra.cs.account.accesscontrol.RightCommand.AllEffectiveRights)1 DomainedRightsByTargetType (com.zimbra.cs.account.accesscontrol.RightCommand.DomainedRightsByTargetType)1 EffectiveRights (com.zimbra.cs.account.accesscontrol.RightCommand.EffectiveRights)1 RightAggregation (com.zimbra.cs.account.accesscontrol.RightCommand.RightAggregation)1 RightsByTargetType (com.zimbra.cs.account.accesscontrol.RightCommand.RightsByTargetType)1 TargetType (com.zimbra.cs.account.accesscontrol.TargetType)1