Search in sources :

Example 1 with GranteeSelector

use of com.zimbra.soap.admin.type.GranteeSelector in project zm-mailbox by Zimbra.

the class SoapProvisioning method getEffectiveRights.

@Override
public RightCommand.EffectiveRights getEffectiveRights(String targetType, TargetBy targetBy, String target, GranteeBy granteeBy, String grantee, boolean expandSetAttrs, boolean expandGetAttrs) throws ServiceException {
    GranteeSelector granteeSel = null;
    if (granteeBy != null && grantee != null) {
        granteeSel = new GranteeSelector(granteeBy, grantee);
    }
    EffectiveRightsTargetSelector targetSel = new EffectiveRightsTargetSelector(com.zimbra.soap.type.TargetType.fromString(targetType), targetBy, target);
    GetEffectiveRightsResponse resp = invokeJaxb(new GetEffectiveRightsRequest(targetSel, granteeSel, expandSetAttrs, expandGetAttrs));
    return RightCommand.EffectiveRights.fromJaxb_EffectiveRights(resp);
}
Also used : GranteeSelector(com.zimbra.soap.admin.type.GranteeSelector) EffectiveRightsTargetSelector(com.zimbra.soap.admin.type.EffectiveRightsTargetSelector)

Example 2 with GranteeSelector

use of com.zimbra.soap.admin.type.GranteeSelector in project zm-mailbox by Zimbra.

the class SoapProvisioning method getAllEffectiveRights.

@Override
public RightCommand.AllEffectiveRights getAllEffectiveRights(String granteeType, GranteeBy granteeBy, String grantee, boolean expandSetAttrs, boolean expandGetAttrs) throws ServiceException {
    GranteeSelector granteeSel = null;
    if (granteeType != null && granteeBy != null && grantee != null) {
        granteeSel = new GranteeSelector(GranteeType.fromString(granteeType), granteeBy, grantee);
    }
    GetAllEffectiveRightsResponse resp = invokeJaxb(new GetAllEffectiveRightsRequest(granteeSel, expandSetAttrs, expandGetAttrs));
    return RightCommand.AllEffectiveRights.fromJaxb(resp);
}
Also used : GranteeSelector(com.zimbra.soap.admin.type.GranteeSelector)

Example 3 with GranteeSelector

use of com.zimbra.soap.admin.type.GranteeSelector in project zm-mailbox by Zimbra.

the class TestServerEnumeration method grantRightToAdmin.

private static void grantRightToAdmin(SoapProvisioning adminSoapProv, TargetType targetType, String targetName, String granteeName, String rightName) throws ServiceException {
    GranteeSelector grantee = new GranteeSelector(GranteeType.usr, GranteeBy.name, granteeName);
    EffectiveRightsTargetSelector target = null;
    if (targetName == null) {
        target = new EffectiveRightsTargetSelector(targetType, null, null);
    } else {
        target = new EffectiveRightsTargetSelector(targetType, TargetBy.name, targetName);
    }
    RightModifierInfo right = new RightModifierInfo(rightName);
    GrantRightResponse grResp = adminSoapProv.invokeJaxb(new GrantRightRequest(target, grantee, right));
    assertNotNull("GrantRightResponse for " + right.getValue(), grResp);
}
Also used : RightModifierInfo(com.zimbra.soap.admin.type.RightModifierInfo) GrantRightRequest(com.zimbra.soap.admin.message.GrantRightRequest) GranteeSelector(com.zimbra.soap.admin.type.GranteeSelector) GrantRightResponse(com.zimbra.soap.admin.message.GrantRightResponse) EffectiveRightsTargetSelector(com.zimbra.soap.admin.type.EffectiveRightsTargetSelector)

Example 4 with GranteeSelector

use of com.zimbra.soap.admin.type.GranteeSelector in project zm-mailbox by Zimbra.

the class TestDomainAdmin method grantRight.

private void grantRight(SoapProvisioning soapProv, TargetType targetType, String targetName, GranteeType granteeType, String granteeName, String rightName) throws ServiceException {
    GranteeSelector grantee;
    EffectiveRightsTargetSelector target;
    RightModifierInfo right;
    GrantRightResponse grResp;
    grantee = new GranteeSelector(granteeType, GranteeBy.name, granteeName);
    target = new EffectiveRightsTargetSelector(targetType, TargetBy.name, targetName);
    right = new RightModifierInfo(rightName);
    grResp = soapProv.invokeJaxb(new GrantRightRequest(target, grantee, right));
    assertNotNull("GrantRightResponse for " + right.getValue(), grResp);
}
Also used : RightModifierInfo(com.zimbra.soap.admin.type.RightModifierInfo) GrantRightRequest(com.zimbra.soap.admin.message.GrantRightRequest) GranteeSelector(com.zimbra.soap.admin.type.GranteeSelector) GrantRightResponse(com.zimbra.soap.admin.message.GrantRightResponse) EffectiveRightsTargetSelector(com.zimbra.soap.admin.type.EffectiveRightsTargetSelector)

Example 5 with GranteeSelector

use of com.zimbra.soap.admin.type.GranteeSelector in project zm-mailbox by Zimbra.

the class TestDomainAdmin method failToGrantRight.

private void failToGrantRight(SoapProvisioning soapProv, TargetType targetType, String targetName, String granteeName, String rightName, String expectedFailureReason) throws ServiceException {
    GranteeSelector grantee;
    EffectiveRightsTargetSelector target;
    RightModifierInfo right;
    grantee = new GranteeSelector(GranteeType.usr, GranteeBy.name, granteeName);
    target = new EffectiveRightsTargetSelector(targetType, TargetBy.name, targetName);
    right = new RightModifierInfo(rightName);
    try {
        soapProv.invokeJaxb(new GrantRightRequest(target, grantee, right));
        fail(String.format("granting %s right succeeded when it shouldn't have", rightName));
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, expectedFailureReason);
    }
}
Also used : RightModifierInfo(com.zimbra.soap.admin.type.RightModifierInfo) GrantRightRequest(com.zimbra.soap.admin.message.GrantRightRequest) GranteeSelector(com.zimbra.soap.admin.type.GranteeSelector) EffectiveRightsTargetSelector(com.zimbra.soap.admin.type.EffectiveRightsTargetSelector) SoapFaultException(com.zimbra.common.soap.SoapFaultException)

Aggregations

GranteeSelector (com.zimbra.soap.admin.type.GranteeSelector)7 EffectiveRightsTargetSelector (com.zimbra.soap.admin.type.EffectiveRightsTargetSelector)6 GrantRightRequest (com.zimbra.soap.admin.message.GrantRightRequest)5 RightModifierInfo (com.zimbra.soap.admin.type.RightModifierInfo)5 GrantRightResponse (com.zimbra.soap.admin.message.GrantRightResponse)4 SoapFaultException (com.zimbra.common.soap.SoapFaultException)1