use of com.zimbra.cs.zimlet.ZimletUserProperties in project zm-mailbox by Zimbra.
the class GetInfo method doProperties.
private static void doProperties(Element response, Account acct) {
ZimletUserProperties zp = ZimletUserProperties.getProperties(acct);
Set<? extends Prop> props = zp.getAllProperties();
for (Prop prop : props) {
Element elem = response.addElement(AccountConstants.E_PROPERTY);
elem.addAttribute(AccountConstants.A_ZIMLET, prop.getZimlet());
elem.addAttribute(AccountConstants.A_NAME, prop.getName());
elem.setText(prop.getValue());
}
}
use of com.zimbra.cs.zimlet.ZimletUserProperties in project zm-mailbox by Zimbra.
the class ModifyProperties method handle.
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
ZimbraSoapContext zsc = getZimbraSoapContext(context);
Account account = getRequestedAccount(zsc);
if (!canModifyOptions(zsc, account)) {
throw ServiceException.PERM_DENIED("can not modify options");
}
ZimletUserProperties props = ZimletUserProperties.getProperties(account);
int numUserproperties = request.listElements(AccountConstants.E_PROPERTY).size();
if (numUserproperties > account.getLongAttr(Provisioning.A_zimbraZimletUserPropertiesMaxNumEntries, 150)) {
throw AccountServiceException.TOO_MANY_ZIMLETUSERPROPERTIES();
}
for (Element e : request.listElements(AccountConstants.E_PROPERTY)) {
props.setProperty(e.getAttribute(AccountConstants.A_ZIMLET), e.getAttribute(AccountConstants.A_NAME), e.getText());
}
props.saveProperties(account);
Element response = zsc.createElement(AccountConstants.MODIFY_PROPERTIES_RESPONSE);
return response;
}
Aggregations