use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.
the class AdminMgrImplTest method delPermObjs.
/**
* @param objArray
*/
public static void delPermObjs(String msg, String[][] objArray, boolean isAdmin) {
LogUtil.logIt(msg);
PermObj pObj = new PermObj();
try {
AdminMgr adminMgr;
if (isAdmin) {
adminMgr = getManagedAdminMgr();
} else {
adminMgr = AdminMgrFactory.createInstance(TestUtils.getContext());
}
for (String[] obj : objArray) {
pObj = PermTestData.getObj(obj);
adminMgr.deletePermObj(pObj);
LOG.debug("delPermObjs objName [" + pObj.getObjName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("delPermObjs objName [" + pObj.getObjName() + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.
the class AdminMgrImplTest method assignUsersH.
/**
* @param msg
* @param uArray
* @param rArray
* @param setTemporal
*/
public static void assignUsersH(String msg, String[][] uArray, String[][] rArray, boolean setTemporal) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
int i = 0;
for (String[] usr : uArray) {
Role role = RoleTestData.getRole(rArray[i]);
UserRole uRole = new UserRole();
uRole.setUserId(UserTestData.getUserId(usr));
ConstraintUtil.copy(role, uRole);
adminMgr.assignUser(uRole);
i++;
}
} catch (SecurityException ex) {
LOG.error("assignUsersH user caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.
the class AdminMgrImplTest method addSsdRoleMember.
/**
* @param sArray
*/
public static void addSsdRoleMember(String msg, String[][] sArray, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (String[] ssdle : sArray) {
SDSet ssd = RoleTestData.getSDSet(ssdle);
SDSet entity = adminMgr.createSsdSet(ssd);
LOG.debug("addSsdRoleMember SSD [" + entity.getName() + "] successful");
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
adminMgr.addSsdRoleMember(ssd, role);
List<SDSet> ssdSets = reviewMgr.ssdRoleSets(role);
assertNotNull(ssdSets);
assertTrue(CLS_NM + "addSsdRoleMember list size check", ssdSets.size() == 1);
SDSet ssd2 = ssdSets.get(0);
assertTrue(CLS_NM + "addSsdRoleMember SSD name check", ssd.getName().equals(ssd2.getName()));
assertTrue(CLS_NM + "addSsdRoleMember SSD role check", ssd2.getMembers().contains(role.getName()));
}
}
} catch (SecurityException ex) {
LOG.error("addSsdRoleMember caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.
the class AdminMgrImplTest method deleteRoles.
/**
* @param rArray
*/
public static void deleteRoles(String msg, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
for (String[] rle : rArray) {
Role role = new Role();
role.setName(RoleTestData.getName(rle));
adminMgr.deleteRole(role);
LOG.debug("deleteRoles role [" + role.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("deleteRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.
the class AdminMgrImplTest method deleteSsdRoleMember.
/**
* @param sArray
*/
private void deleteSsdRoleMember(String msg, String[][] sArray, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (String[] ssdle : sArray) {
SDSet ssd = RoleTestData.getSDSet(ssdle);
// first add all of the roles as members of SSD entity:
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
ssd.addMember(role.getName());
}
// now iterate over roles and remove from SSD set one at a time.
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
adminMgr.deleteSsdRoleMember(ssd, role);
List<SDSet> ssdSets = reviewMgr.ssdRoleSets(role);
assertTrue(CLS_NM + "deleteSsdRoleMember list size check ssdSets size [" + ssdSets.size() + "]", ssdSets.size() == 0);
}
adminMgr.deleteSsdSet(ssd);
LOG.debug("deleteSsdRoleMember SSD [" + ssd.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("deleteSsdRoleMember caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations