Search in sources :

Example 46 with Config

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

the class BUG_46297 method doGlobalConfig.

private void doGlobalConfig(ZLdapContext zlc) throws ServiceException {
    Config config = prov.getConfig();
    doEntry(zlc, config, "global config");
}
Also used : Config(com.zimbra.cs.account.Config)

Example 47 with Config

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

the class BUG_46961 method doUpgrade.

@Override
void doUpgrade() throws ServiceException {
    Config config = prov.getConfig();
    String oldValue = "displayName,cn=fullName";
    String newValue = "displayName,cn=fullName,fullName2,fullName3,fullName4,fullName5,fullName6,fullName7,fullName8,fullName9,fullName10";
    String[] curValues = config.getMultiAttr(Provisioning.A_zimbraGalLdapAttrMap);
    for (String value : curValues) {
        if (value.equalsIgnoreCase(oldValue)) {
            Map<String, Object> attr = new HashMap<String, Object>();
            attr.put("-" + Provisioning.A_zimbraGalLdapAttrMap, oldValue);
            attr.put("+" + Provisioning.A_zimbraGalLdapAttrMap, newValue);
            printer.println("Modifying " + Provisioning.A_zimbraGalLdapAttrMap + " on global config:");
            printer.println("    removing value: " + oldValue);
            printer.println("    adding value: " + newValue);
            prov.modifyAttrs(config, attr);
        }
    }
}
Also used : HashMap(java.util.HashMap) Config(com.zimbra.cs.account.Config)

Example 48 with Config

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

the class BUG_41000 method doUpgrade.

@Override
void doUpgrade() throws ServiceException {
    Config config = prov.getConfig();
    String[] value = { "zimbraAutoComplete:(&(|(displayName=%s*)(cn=%s*)(sn=%s*)(gn=%s*)(mail=%s*)(zimbraMailDeliveryAddress=%s*)(zimbraMailAlias=%s*))(|(objectclass=zimbraAccount)(objectclass=zimbraDistributionList)))", "zimbraSearch:(&(|(displayName=*%s*)(cn=*%s*)(sn=*%s*)(gn=*%s*)(mail=*%s*)(zimbraMailDeliveryAddress=*%s*)(zimbraMailAlias=*%s*))(|(objectclass=zimbraAccount)(objectclass=zimbraDistributionList)))" };
    Map<String, Object> attr = new HashMap<String, Object>();
    attr.put("+" + Provisioning.A_zimbraGalLdapFilterDef, value);
    printer.println("Adding zimbraAutoComplete and zimbraSearch filters to global config " + Provisioning.A_zimbraGalLdapFilterDef);
    prov.modifyAttrs(config, attr);
}
Also used : HashMap(java.util.HashMap) Config(com.zimbra.cs.account.Config)

Example 49 with Config

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

the class BUG_42877 method doUpgrade.

@Override
void doUpgrade() throws ServiceException {
    Config config = prov.getConfig();
    String[] values = { "facsimileTelephoneNumber,fax=workFax", "homeTelephoneNumber,homePhone=homePhone", "mobileTelephoneNumber,mobile=mobilePhone", "pagerTelephoneNumber,pager=pager" };
    Map<String, Object> attr = new HashMap<String, Object>();
    attr.put("+" + Provisioning.A_zimbraGalLdapAttrMap, values);
    printer.println("Adding workFax, homePhone, mobilePhone, pager attr maps to global config " + Provisioning.A_zimbraGalLdapAttrMap);
    prov.modifyAttrs(config, attr);
}
Also used : HashMap(java.util.HashMap) Config(com.zimbra.cs.account.Config)

Example 50 with Config

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

the class GetInfo method doAttrs.

static void doAttrs(Account acct, String locale, Element response, Map<String, Object> attrsMap) throws ServiceException {
    AttributeManager attrMgr = AttributeManager.getInstance();
    Set<String> attrList = attrMgr.getAttrsWithFlag(AttributeFlag.accountInfo);
    Set<String> acctAttrs = attrMgr.getAllAttrsInClass(AttributeClass.account);
    Set<String> domainAttrs = attrMgr.getAllAttrsInClass(AttributeClass.domain);
    Set<String> serverAttrs = attrMgr.getAllAttrsInClass(AttributeClass.server);
    Set<String> configAttrs = attrMgr.getAllAttrsInClass(AttributeClass.globalConfig);
    Provisioning prov = Provisioning.getInstance();
    Domain domain = prov.getDomain(acct);
    Server server = acct.getServer();
    Config config = prov.getConfig();
    for (String key : attrList) {
        Object value = null;
        if (Provisioning.A_zimbraLocale.equals(key)) {
            value = locale;
        } else if (Provisioning.A_zimbraAttachmentsBlocked.equals(key)) {
            // leave this a special case for now, until we have enough incidences to make it a pattern
            value = config.isAttachmentsBlocked() || acct.isAttachmentsBlocked() ? ProvisioningConstants.TRUE : ProvisioningConstants.FALSE;
        } else {
            value = attrsMap.get(key);
            if (value == null) {
                // no value on account/cos
                if (!acctAttrs.contains(key)) {
                    // see if it is on domain, server, or globalconfig
                    if (domainAttrs.contains(key)) {
                        if (domain != null) {
                            // value on domain/global config (domainInherited)
                            value = domain.getMultiAttr(key);
                        }
                    } else if (serverAttrs.contains(key)) {
                        // value on server/global config (serverInherited)
                        value = server.getMultiAttr(key);
                    } else if (configAttrs.contains(key)) {
                        // value on global config
                        value = config.getMultiAttr(key);
                    }
                }
            }
        }
        ToXML.encodeAttr(response, key, value);
    }
}
Also used : AttributeManager(com.zimbra.cs.account.AttributeManager) Server(com.zimbra.cs.account.Server) Config(com.zimbra.cs.account.Config) Domain(com.zimbra.cs.account.Domain) Provisioning(com.zimbra.cs.account.Provisioning)

Aggregations

Config (com.zimbra.cs.account.Config)73 HashMap (java.util.HashMap)24 Provisioning (com.zimbra.cs.account.Provisioning)10 Test (org.junit.Test)8 ServiceException (com.zimbra.common.service.ServiceException)7 Account (com.zimbra.cs.account.Account)7 RetentionPolicy (com.zimbra.soap.mail.type.RetentionPolicy)7 Element (com.zimbra.common.soap.Element)6 Policy (com.zimbra.soap.mail.type.Policy)6 Cos (com.zimbra.cs.account.Cos)5 Server (com.zimbra.cs.account.Server)5 Domain (com.zimbra.cs.account.Domain)4 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)4 Pair (com.zimbra.common.util.Pair)3 HashSet (java.util.HashSet)3 SMTPMessage (com.sun.mail.smtp.SMTPMessage)2 ZFilterAction (com.zimbra.client.ZFilterAction)2 ZFileIntoAction (com.zimbra.client.ZFilterAction.ZFileIntoAction)2 ZFilterCondition (com.zimbra.client.ZFilterCondition)2 ZHeaderCondition (com.zimbra.client.ZFilterCondition.ZHeaderCondition)2