Search in sources :

Example 11 with SoapProvisioning

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

the class ProvUtil method doGetRightsDoc.

private void doGetRightsDoc(String[] args) throws ServiceException {
    if (!(prov instanceof SoapProvisioning)) {
        throwSoapOnly();
    }
    String[] packages;
    StringBuilder argsDump = new StringBuilder();
    if (args.length > 1) {
        // args[0] is "grd", starting from args[1]
        packages = new String[args.length - 1];
        for (int i = 1; i < args.length; i++) {
            packages[i - 1] = args[i];
            argsDump.append(" " + args[i]);
        }
    } else {
        packages = new String[] { "com.zimbra.cs.service.admin", "com.zimbra.bp", "com.zimbra.cert", "com.zimbra.cs.network", "com.zimbra.cs.network.license.service", "com.zimbra.cs.service.backup", "com.zimbra.cs.service.hsm", "com.zimbra.xmbxsearch" };
    }
    console.println("#");
    console.println("#  Generated by: zmprov grd" + argsDump);
    console.println("#");
    console.println("#  Date: " + DateFormat.getDateInstance(DateFormat.LONG).format(new Date()));
    console.println("# ");
    console.println("#  Packages:");
    for (String pkg : packages) {
        console.println("#       " + pkg);
    }
    console.println("# ");
    console.println("\n");
    Map<String, List<RightsDoc>> allDocs = prov.getRightsDoc(packages);
    for (Map.Entry<String, List<RightsDoc>> docs : allDocs.entrySet()) {
        console.println("========================================");
        console.println("Package: " + docs.getKey());
        console.println("========================================");
        console.println();
        for (RightsDoc doc : docs.getValue()) {
            console.println("------------------------------");
            console.println(doc.getCmd() + "\n");
            console.println("    Related rights:");
            for (String r : doc.getRights()) {
                console.println("        " + r);
            }
            console.println();
            console.println("    Notes:");
            for (String n : doc.getNotes()) {
                console.println(FileGenUtil.wrapComments(StringUtil.escapeHtml(n), 70, "        ") + "\n");
            }
            console.println();
        }
    }
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) RightsDoc(com.zimbra.cs.account.Provisioning.RightsDoc) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) TreeMap(java.util.TreeMap) SortedMap(java.util.SortedMap) HashMap(java.util.HashMap) Date(java.util.Date)

Example 12 with SoapProvisioning

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

the class ProvUtil method lookupDomain.

private Domain lookupDomain(String key, Provisioning prov, boolean applyDefault) throws ServiceException {
    Domain domain;
    if (prov instanceof SoapProvisioning) {
        SoapProvisioning soapProv = (SoapProvisioning) prov;
        domain = soapProv.get(guessDomainBy(key), key, applyDefault);
    } else {
        domain = prov.get(guessDomainBy(key), key);
    }
    if (domain == null) {
        throw AccountServiceException.NO_SUCH_DOMAIN(key);
    } else {
        return domain;
    }
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 13 with SoapProvisioning

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

the class ProvUtil method doVerifyIndex.

private void doVerifyIndex(String[] args) throws ServiceException {
    if (!(prov instanceof SoapProvisioning)) {
        throwSoapOnly();
    }
    console.println("Verifying, on a large index it can take quite a long time...");
    SoapProvisioning soap = (SoapProvisioning) prov;
    SoapProvisioning.VerifyIndexResult result = soap.verifyIndex(lookupAccount(args[1]));
    console.println();
    console.print(result.message);
    if (!result.status) {
        throw ServiceException.FAILURE("The index may be corrupted. Run reIndexMailbox(rim) to repair.", null);
    }
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 14 with SoapProvisioning

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

the class ProvUtil method doCompactIndexMailbox.

private void doCompactIndexMailbox(String[] args) throws ServiceException {
    if (!(prov instanceof SoapProvisioning)) {
        throwSoapOnly();
    }
    SoapProvisioning sp = (SoapProvisioning) prov;
    Account acct = lookupAccount(args[1]);
    String status = sp.compactIndex(acct, args[2]);
    console.printf("status: %s\n", status);
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 15 with SoapProvisioning

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

the class SoapProvTestUtil method getSoapProvisioning.

static SoapProvisioning getSoapProvisioning(String userName, String password) throws ServiceException {
    SoapProvisioning sp = new SoapProvisioning();
    sp.soapSetHttpTransportDebugListener(new SoapDebugListener());
    sp.soapSetURI("https://localhost:7071" + AdminConstants.ADMIN_SERVICE_URI);
    sp.soapAdminAuthenticate(userName, password);
    return sp;
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Aggregations

SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)78 Test (org.junit.Test)18 SoapFaultException (com.zimbra.common.soap.SoapFaultException)14 Account (com.zimbra.cs.account.Account)13 Attr (com.zimbra.soap.admin.type.Attr)10 ServiceException (com.zimbra.common.service.ServiceException)9 CreateDistributionListRequest (com.zimbra.soap.admin.message.CreateDistributionListRequest)6 CreateDistributionListResponse (com.zimbra.soap.admin.message.CreateDistributionListResponse)6 AccountLogger (com.zimbra.common.util.AccountLogger)5 Server (com.zimbra.cs.account.Server)5 CreateCalendarResourceRequest (com.zimbra.soap.admin.message.CreateCalendarResourceRequest)4 CreateCalendarResourceResponse (com.zimbra.soap.admin.message.CreateCalendarResourceResponse)4 DeleteCalendarResourceRequest (com.zimbra.soap.admin.message.DeleteCalendarResourceRequest)4 List (java.util.List)4 SoapHttpTransport (com.zimbra.common.soap.SoapHttpTransport)3 AccountServiceException (com.zimbra.cs.account.AccountServiceException)3 Provisioning (com.zimbra.cs.account.Provisioning)3 CacheEntry (com.zimbra.cs.account.Provisioning.CacheEntry)3 DeleteAccountRequest (com.zimbra.soap.admin.message.DeleteAccountRequest)3 DeleteAccountResponse (com.zimbra.soap.admin.message.DeleteAccountResponse)3