use of org.apache.directory.fortress.core.DelAdminMgr in project directory-fortress-core by apache.
the class DelegatedMgrImplTest method addOrgUnit.
public static void addOrgUnit(String msg, String[] org) {
LogUtil.logIt(msg);
try {
DelAdminMgr dAdminMgr = DelAdminMgrFactory.createInstance(TestUtils.getContext());
OrgUnit ou = OrgUnitTestData.getOrgUnit(org);
OrgUnit entity = dAdminMgr.add(ou);
LOG.debug("addOrgUnit ou [{}] successful", entity.getName());
} catch (SecurityException ex) {
LOG.error("addOrgUnit caught SecurityException rc={}, msg={}", ex.getErrorId(), ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.DelAdminMgr in project directory-fortress-core by apache.
the class DelegatedMgrImplTest method delOrgUnitDescendant.
/**
* @param msg
*/
private void delOrgUnitDescendant(String msg, String[][] oArray, OrgUnit.Type type) {
LogUtil.logIt(msg);
try {
DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
for (String[] ole : oArray) {
OrgUnit orgUnit = OrgUnitTestData.getOrgUnit(ole);
// use list because order is important for test structure:
List<String> descs = new ArrayList<String>();
OrgUnitTestData.getRelationship(descs, ole);
if (OrgUnitTestData.isTree(ole)) {
OrgUnit parent = orgUnit;
for (String desc : descs) {
OrgUnit child = new OrgUnit(desc);
dAdminMgr.deleteInheritance(parent, new OrgUnit(desc, type));
LOG.debug("delOrgUnitDescendant asc orgUnit [" + orgUnit.getName() + "] desc orgUnit [" + desc + "] successful");
parent = child;
}
} else {
for (String desc : descs) {
dAdminMgr.deleteInheritance(orgUnit, new OrgUnit(desc, type));
LOG.debug("delOrgUnitDescendant asc orgUnit [" + orgUnit.getName() + "] desc orgUnit [" + desc + "] successful");
}
}
Set<String> inheritances = OrgUnitTestData.getInheritances(ole);
if (inheritances != null) {
for (String desc : inheritances) {
dAdminMgr.deleteInheritance(orgUnit, new OrgUnit(desc, type));
LOG.debug("delOrgUnitDescendant asc orgUnit [" + orgUnit.getName() + "] desc orgUnit [" + desc + "] successful");
}
}
dAdminMgr.delete(orgUnit);
LOG.debug("delOrgUnitDescendant remove asc orgUnit [" + orgUnit.getName() + "] successful");
}
// cleanup the last row of descendants from orgUnit data set.
DelReviewMgr dReviewMgr = getManagedDelegatedReviewMgr();
String orgUnitSrchVal = TestUtils.getSrchValue(OrgUnitTestData.getName(oArray[0]));
List<OrgUnit> cleanup = dReviewMgr.search(type, orgUnitSrchVal);
for (OrgUnit oe : cleanup) {
dAdminMgr.delete(oe);
LOG.debug("delOrgUnitDescendant cleanup orgUnit [" + oe.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("delOrgUnitDescendant caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.DelAdminMgr in project directory-fortress-core by apache.
the class DelegatedMgrImplTest method addInheritedAdminRoles.
/**
* @param msg
* @param rArray
*/
public static void addInheritedAdminRoles(String msg, String[][] rArray) {
LogUtil.logIt(msg);
try {
DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
for (String[] rle : rArray) {
AdminRole role = AdminRoleTestData.getRole(rle);
Set<String> parents = RoleTestData.getRelationships(rle);
if (parents != null) {
for (String pRole : parents) {
dAdminMgr.addInheritance(new AdminRole(pRole), role);
LOG.debug("addInheritedAdminRoles child role [" + role.getName() + "] parent role [" + pRole + "] successful");
}
}
}
} catch (SecurityException ex) {
LOG.error("addInheritedAdminRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.DelAdminMgr in project directory-fortress-core by apache.
the class DelegatedMgrImplTest method addAdminRoleAscendant.
/**
* @param msg
* @param rArray
*/
public static void addAdminRoleAscendant(String msg, String[][] rArray) {
LogUtil.logIt(msg);
try {
DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
for (String[] rle : rArray) {
AdminRole adminRole = AdminRoleTestData.getRole(rle);
if (RoleTestData.isCreate(rle)) {
dAdminMgr.addRole(adminRole);
LOG.debug("addAdminRoleAscendant add adminRole [" + adminRole.getName() + "] successful");
}
Set<String> ascs = RoleTestData.getRelationships(rle);
if (ascs != null) {
for (String asc : ascs) {
dAdminMgr.addAscendant(adminRole, new AdminRole(asc));
LOG.debug("addAdminRoleAscendant desc role [" + adminRole.getName() + "] asc role [" + asc + "] successful");
}
}
Set<String> inheritances = RoleTestData.getInheritances(rle);
if (inheritances != null) {
for (String asc : inheritances) {
dAdminMgr.addInheritance(new AdminRole(asc), adminRole);
LOG.debug("addAdminRoleAscendant desc role [" + adminRole.getName() + "] asc role [" + asc + "] successful");
}
}
}
} catch (SecurityException ex) {
LOG.error("addAdminRoleAscendant caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.DelAdminMgr in project directory-fortress-core by apache.
the class DelegatedMgrImplTest method deleteInheritedAdminRoles.
/**
* @param msg
* @param rArray
*/
private static void deleteInheritedAdminRoles(String msg, String[][] rArray) {
LogUtil.logIt(msg);
try {
DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
for (String[] rle : rArray) {
AdminRole role = AdminRoleTestData.getRole(rle);
Set<String> parents = RoleTestData.getRelationships(rle);
if (parents != null) {
for (String pRole : parents) {
dAdminMgr.deleteInheritance(new AdminRole(pRole), role);
LOG.debug("deleteInheritedAdminRoles child role [" + role.getName() + "] parent role [" + pRole + "] successful");
}
}
}
} catch (SecurityException ex) {
LOG.error("deleteInheritedAdminRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations