use of com.zimbra.cs.account.Provisioning.RightsDoc 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();
}
}
}
use of com.zimbra.cs.account.Provisioning.RightsDoc in project zm-mailbox by Zimbra.
the class TestJaxbProvisioning method testGetRightsDoc.
@Test
public void testGetRightsDoc() throws Exception {
ZimbraLog.test.debug("Starting testGetRightsDoc");
Map<String, List<RightsDoc>> map = prov.getRightsDoc(null);
assertTrue("Map size=" + map.size() + " should be >= 1", map.size() >= 1);
String[] pkgs = { "com.zimbra.cs.service.admin" };
map = prov.getRightsDoc(pkgs);
assertEquals("Map for specified set of pkgs", 1, map.size());
boolean seenTstRight = false;
for (String key : map.keySet()) {
assertEquals("key to map", pkgs[0], key);
for (RightsDoc rightsDoc : map.get(key)) {
assertNotNull("rightsDoc cmd name", rightsDoc.getCmd());
if (rightsDoc.getCmd().equals("AddAccountAliasRequest")) {
seenTstRight = true;
assertEquals("Notes number", 3, rightsDoc.getNotes().size());
assertEquals("Rights number", 3, rightsDoc.getRights().size());
}
}
}
assertTrue("AddAccountAliasRequest right in report", seenTstRight);
}
Aggregations