Search in sources :

Example 66 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.

the class SoapProvisioning method getGrants.

@Override
public RightCommand.Grants getGrants(String targetType, TargetBy targetBy, String target, String granteeType, GranteeBy granteeBy, String grantee, boolean granteeIncludeGroupsGranteeBelongs) throws ServiceException {
    XMLElement req = new XMLElement(AdminConstants.GET_GRANTS_REQUEST);
    if (targetType != null)
        toXML(req, targetType, targetBy, target);
    if (granteeType != null) {
        Element eGrantee = toXML(req, granteeType, granteeBy, grantee);
        eGrantee.addAttribute(AdminConstants.A_ALL, granteeIncludeGroupsGranteeBelongs);
    }
    Element resp = invoke(req);
    return new RightCommand.Grants(resp);
}
Also used : Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 67 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.

the class SoapProvisioning method modifySignature.

@Override
public void modifySignature(Account account, String signatureId, Map<String, Object> attrs) throws ServiceException {
    if (attrs.get(Provisioning.A_zimbraSignatureId) != null)
        throw ZClientException.CLIENT_ERROR("invalid attr: " + Provisioning.A_zimbraSignatureId, null);
    XMLElement req = new XMLElement(AccountConstants.MODIFY_SIGNATURE_REQUEST);
    Element signature = req.addElement(AccountConstants.E_SIGNATURE);
    signature.addAttribute(AccountConstants.A_ID, signatureId);
    SoapSignature.toXML(signature, attrs);
    invokeOnTargetAccount(req, account.getId());
}
Also used : Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 68 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement 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)

Example 69 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.

the class SoapProvisioning method modifyConfigSMIMEConfig.

@Override
public void modifyConfigSMIMEConfig(String configName, Map<String, Object> attrs) throws ServiceException {
    XMLElement req = new XMLElement(AdminConstants.MODIFY_SMIME_CONFIG_REQUEST);
    Element eConfig = req.addElement(AdminConstants.E_CONFIG);
    eConfig.addAttribute(AdminConstants.A_NAME, configName);
    eConfig.addAttribute(AdminConstants.A_OP, AdminConstants.OP_MODIFY);
    addAttrElements(eConfig, attrs);
    invoke(req);
}
Also used : Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 70 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.

the class SoapUCService method modifyAttrs.

public void modifyAttrs(SoapProvisioning prov, Map<String, ? extends Object> attrs, boolean checkImmutable) throws ServiceException {
    XMLElement req = new XMLElement(AdminConstants.MODIFY_UC_SERVICE_REQUEST);
    req.addElement(AdminConstants.E_ID).setText(getId());
    SoapProvisioning.addAttrElements(req, attrs);
    setAttrs(SoapProvisioning.getAttrs(prov.invoke(req).getElement(AdminConstants.E_UC_SERVICE)));
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement)

Aggregations

XMLElement (com.zimbra.common.soap.Element.XMLElement)140 Element (com.zimbra.common.soap.Element)111 Test (org.junit.Test)30 JSONElement (com.zimbra.common.soap.Element.JSONElement)29 XmlAnyElement (javax.xml.bind.annotation.XmlAnyElement)25 XmlElement (javax.xml.bind.annotation.XmlElement)25 FilterTest (com.zimbra.soap.mail.type.FilterTest)24 SoapHttpTransport (com.zimbra.common.soap.SoapHttpTransport)9 HashMap (java.util.HashMap)8 Account (com.zimbra.cs.account.Account)6 ArrayList (java.util.ArrayList)6 ZAuthToken (com.zimbra.common.auth.ZAuthToken)5 KeyValuePair (com.zimbra.soap.type.KeyValuePair)5 ByteBuilder (com.zimbra.common.mime.HeaderUtils.ByteBuilder)4 ServiceException (com.zimbra.common.service.ServiceException)4 DataSource (com.zimbra.cs.account.DataSource)4 Auth (com.zimbra.cs.service.account.Auth)4 URL (java.net.URL)4 Cookie (javax.servlet.http.Cookie)4 Signature (com.zimbra.cs.account.Signature)3