use of org.bedework.calfacade.svc.BwAdminGroup in project bw-calendar-engine by Bedework.
the class ProcessCreate method createAdminGroup.
private boolean createAdminGroup(final String account) throws Throwable {
if (debug) {
debug("About to create admin group " + account);
}
if (account == null) {
addError("Must supply account");
return false;
}
try {
open();
final BwAdminGroup grp = new BwAdminGroup();
grp.setAccount(account);
final DirectoryInfo di = getDirectoryInfo();
String href = di.getBwadmingroupPrincipalRoot();
if (!href.endsWith("/")) {
href += "/";
}
grp.setPrincipalRef(href + account);
grp.setDescription(quotedVal());
if (grp.getDescription() == null) {
addError("Must supply admin group description");
return false;
}
final String adgGroupOwner = word();
if (adgGroupOwner == null) {
addError("Must supply admin group owner");
return false;
}
final BwPrincipal adgPr = getUserAlways(adgGroupOwner);
if (adgPr == null) {
return false;
}
grp.setGroupOwnerHref(adgPr.getPrincipalRef());
String adgEventOwner = word();
if (adgEventOwner == null) {
adgEventOwner = "agrp_" + account;
}
final BwPrincipal adePr = getUserAlways(adgEventOwner);
if (adePr == null) {
return false;
}
grp.setOwnerHref(adePr.getPrincipalRef());
getSvci().getAdminDirectories().addGroup(grp);
return true;
} finally {
close();
}
}
Aggregations