use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class DelegatedMgrImplTest method updateOrgUnits.
/**
* @param msg
* @param oArray
*/
public static void updateOrgUnits(String msg, String[][] oArray) {
LogUtil.logIt(msg);
try {
DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
for (String[] ole : oArray) {
OrgUnit ou = OrgUnitTestData.getOrgUnit(ole);
dAdminMgr.update(ou);
LOG.debug("updateOrgUnits ou [" + ou.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("updateOrgUnits caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class DelegatedAdminMgrConsole method removeInheritance.
/**
*/
private void removeInheritance(OrgUnit.Type type) {
try {
OrgUnit cou = new OrgUnit();
OrgUnit pou = new OrgUnit();
cou.setType(type);
pou.setType(type);
ReaderUtil.clearScreen();
System.out.println("Enter child orgunit name:");
cou.setName(ReaderUtil.readLn());
System.out.println("Enter parent orgunit name:");
pou.setName(ReaderUtil.readLn());
dAmgr.deleteInheritance(pou, cou);
System.out.println("child orgunit [" + cou.getName() + "]");
System.out.println("parent orgunit [" + pou.getName() + "]");
System.out.println("inheritance relationship has been removed");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("removeInheritance caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class DelegatedAdminMgrConsole method addInheritance.
/**
*/
private void addInheritance(OrgUnit.Type type) {
try {
OrgUnit cou = new OrgUnit();
OrgUnit pou = new OrgUnit();
cou.setType(type);
pou.setType(type);
ReaderUtil.clearScreen();
System.out.println("Enter child orgunit name:");
cou.setName(ReaderUtil.readLn());
System.out.println("Enter parent orgunit name:");
pou.setName(ReaderUtil.readLn());
dAmgr.addInheritance(pou, cou);
System.out.println("child orgunit [" + cou.getName() + "]");
System.out.println("parent orgunit [" + pou.getName() + "]");
System.out.println("inheritance relationship has been added");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("addInheritance caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class DelegatedAdminMgrConsole method add.
private void add(OrgUnit.Type type) {
OrgUnit ou = new OrgUnit();
try {
ReaderUtil.clearScreen();
System.out.println("Enter orgunit name:");
ou.setName(ReaderUtil.readLn());
System.out.println("Enter description field");
ou.setDescription(ReaderUtil.readLn());
ou.setType(type);
OrgUnit ou2 = dAmgr.add(ou);
System.out.println("name [" + ou2.getName() + "]");
System.out.println("internalId [" + ou2.getId() + "]");
System.out.println("name description [" + ou2.getDescription() + "]");
System.out.println("has been added");
System.out.println("ENTER to continue");
} catch (SecurityException e) {
LOG.error("add caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
}
ReaderUtil.readChar();
}
use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.
the class CreateUserOrgHierarchySample method testCreateAscendantUserOrgs.
/**
* Demonstrate a child to parent OrgUnit structure of one-to-many. To use this API, the child OrgUnit must be created before
* the call to addAscendant which will Add a new OrgUnit node and set a OrgUnit relationship with child node.
* <p>
* <img src="./doc-files/HierUserOrgAscendants.png" alt="">
*/
public static void testCreateAscendantUserOrgs() {
String szLocation = ".testCreateAscendantUserOrgs";
try {
// Instantiate the DelAdminMgr implementation which is used to provision ARBAC policies.
DelAdminMgr delAdminMgr = DelAdminMgrFactory.createInstance(TestUtils.getContext());
// Instantiate the child OrgUnit. This needs a name and type.
OrgUnit childOrgUnit = new OrgUnit(TEST_HIER_ASC_USERORG_PREFIX + 1, OrgUnit.Type.USER);
// This child will have many parents:
delAdminMgr.add(childOrgUnit);
// Create OrgUnits, 'sampleHierUserOrgA2' - 'sampleHierUserOrgA6'.
for (int i = 1; i < TEST_NUMBER; i++) {
// Instantiate the parent OrgUnit. This needs a name and type before it can be added to ldap.
OrgUnit parentOrgUnit = new OrgUnit(TEST_HIER_ASC_USERORG_PREFIX + (i + 1), OrgUnit.Type.USER);
// Now add parent OrgUnit entity to directory and add relationship with existing child OrgUnit.
delAdminMgr.addAscendant(childOrgUnit, parentOrgUnit);
}
} catch (SecurityException ex) {
LOG.error(szLocation + " caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations