Search in sources :

Example 1 with ViaGrantImpl

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

the class SoapProvisioning method checkRight.

@Override
public boolean checkRight(String targetType, TargetBy targetBy, String target, GranteeBy granteeBy, String grantee, String right, Map<String, Object> attrs, AccessManager.ViaGrant via) throws ServiceException {
    XMLElement req = new XMLElement(AdminConstants.CHECK_RIGHT_REQUEST);
    toXML(req, targetType, targetBy, target);
    toXML(req, null, granteeBy, grantee);
    toXML(req, right, null);
    SoapProvisioning.addAttrElements(req, attrs);
    Element resp = invoke(req);
    boolean result = resp.getAttributeBool(AdminConstants.A_ALLOW);
    if (via != null) {
        Element eVia = resp.getOptionalElement(AdminConstants.E_VIA);
        if (eVia != null) {
            Element eTarget = eVia.getElement(AdminConstants.E_TARGET);
            Element eGrantee = eVia.getElement(AdminConstants.E_GRANTEE);
            Element eRight = eVia.getElement(AdminConstants.E_RIGHT);
            via.setImpl(new ViaGrantImpl(eTarget.getAttribute(AdminConstants.A_TYPE), eTarget.getText(), eGrantee.getAttribute(AdminConstants.A_TYPE), eGrantee.getText(), eRight.getText(), eRight.getAttributeBool(AdminConstants.A_DENY, false)));
        }
    }
    return result;
}
Also used : Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) ViaGrantImpl(com.zimbra.cs.account.accesscontrol.ViaGrantImpl) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Aggregations

Element (com.zimbra.common.soap.Element)1 XMLElement (com.zimbra.common.soap.Element.XMLElement)1 ViaGrantImpl (com.zimbra.cs.account.accesscontrol.ViaGrantImpl)1