use of com.zimbra.cs.account.accesscontrol.RightCommand.EffectiveAttr in project zm-mailbox by Zimbra.
the class TestACLEffectiveRights method bug70206.
@Bug(bug = 70206)
@Test
public void bug70206() throws Exception {
Account acct = provUtil.createDelegatedAdmin(genAcctNameLocalPart(), domain);
Group group = provUtil.createGroup(genGroupNameLocalPart(), domain, false);
Account grantingAccount = globalAdmin;
String presetRightUnderTest = Right.RT_deleteDistributionList;
String attrUnderTest = Provisioning.A_zimbraHideInGal;
String attrRightUnderTest = InlineAttrRight.composeSetRight(TargetType.dl, attrUnderTest);
// grant a combo right on global level
RightCommand.grantRight(prov, grantingAccount, TargetType.global.getCode(), null, null, GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, Right.RT_adminConsoleDLRights, null);
// deny a preset right (in the combo right) on global level
RightCommand.grantRight(prov, grantingAccount, TargetType.global.getCode(), null, null, GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, presetRightUnderTest, RightModifier.RM_DENY);
// grant the preset right on the target
RightCommand.grantRight(prov, grantingAccount, TargetType.dl.getCode(), TargetBy.name, group.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, attrRightUnderTest, null);
// deny an attr right (in the combo right) on global level
RightCommand.grantRight(prov, grantingAccount, TargetType.global.getCode(), null, null, GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, attrRightUnderTest, RightModifier.RM_DENY);
// grant the attr right on the target
RightCommand.grantRight(prov, grantingAccount, TargetType.dl.getCode(), TargetBy.name, group.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, presetRightUnderTest, null);
EffectiveRights effRights = RightCommand.getEffectiveRights(prov, TargetType.dl.getCode(), TargetBy.name, group.getName(), GranteeBy.name, acct.getName(), false, false);
List<String> presetRights = effRights.presetRights();
SortedMap<String, EffectiveAttr> setAttrRights = effRights.canSetAttrs();
/*
for (String right : presetRights) {
System.out.println(right);
}
*/
assertTrue(presetRights.contains(Right.RT_deleteDistributionList));
assertTrue(setAttrRights.containsKey(attrUnderTest));
}
Aggregations