use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class AdminMgrImplTest method delRoleDescendant.
/**
* @param msg
*/
private void delRoleDescendant(String msg, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
// use list because order is important for test structure:
List<String> descs = RoleTestData.getRelationshipList(rle);
if (descs != null) {
if (RoleTestData.isTree(rle)) {
Role parent = role;
for (String desc : descs) {
Role child = new Role(desc);
adminMgr.deleteInheritance(parent, new Role(desc));
LOG.debug("delRoleDescendant asc role [" + role.getName() + "] desc role [" + desc + "] successful");
parent = child;
}
} else {
for (String desc : descs) {
adminMgr.deleteInheritance(role, new Role(desc));
LOG.debug("delRoleDescendant asc role [" + role.getName() + "] desc role [" + desc + "] successful");
}
}
}
Set<String> inheritances = RoleTestData.getInheritances(rle);
if (inheritances != null) {
for (String desc : inheritances) {
adminMgr.deleteInheritance(role, new Role(desc));
LOG.debug("delRoleDescendant asc role [" + role.getName() + "] desc role [" + desc + "] successful");
}
}
adminMgr.deleteRole(role);
LOG.debug("delRoleDescendant remove asc role [" + role.getName() + "] successful");
}
// cleanup the last row of descendants from roles data set.
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
String roleSrchVal = TestUtils.getSrchValue(RoleTestData.getName(rArray[0]));
List<Role> cleanup = reviewMgr.findRoles(roleSrchVal);
for (Role re : cleanup) {
adminMgr.deleteRole(re);
LOG.debug("delRoleDescendant cleanup role [" + re.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("delRoleDescendant caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class DelegatedMgrImplTest method loadAdminPolicy.
/**
* @return
*/
public static boolean loadAdminPolicy() {
boolean result = true;
try {
ReviewMgr rMgr = ReviewMgrFactory.createInstance(TestUtils.getContext());
User admin = UserTestData.getUser(UserTestData.USERS_TU0[0]);
rMgr.readUser(admin);
result = false;
} catch (SecurityException se) {
String info = " loadAdminPolicy detected admin policy not loaded";
LOG.debug(info);
}
return result;
}
use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class FortressAntLoadTest method readUsers.
private static void readUsers(String msg, List<UserAnt> users) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (User user : users) {
User entity = reviewMgr.readUser(user);
assertNotNull(entity);
UserTestData.assertEquals(entity, user);
}
} catch (SecurityException ex) {
LOG.error("readUsers caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class FortressAntLoadTest method assignedRoles.
private static void assignedRoles(String msg, List<UserRole> userroles) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (UserRole userrole : userroles) {
List<UserRole> assignedRoles = reviewMgr.assignedRoles(new User(userrole.getUserId()));
assertNotNull(assignedRoles);
int indx = assignedRoles.indexOf(userrole);
assertTrue("Failed userrole name", indx != -1);
UserRole assignedRole = assignedRoles.get(indx);
TestUtils.assertTemporal(CLS_NM + ".assertEquals", userrole, assignedRole);
}
} catch (SecurityException ex) {
LOG.error("assignedRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class FortressAntLoadTest method readPermissionOps.
/**
* @param msg
* @param permissions
*/
private static void readPermissionOps(String msg, List<PermAnt> permissions) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (PermAnt permAnt : permissions) {
Permission entity = reviewMgr.readPermission(permAnt);
assertNotNull(entity);
assertTrue("Failed objName value compare", entity.getObjName().equals(permAnt.getObjName()));
assertTrue("Failed opName value compare", entity.getOpName().equals(permAnt.getOpName()));
}
} catch (SecurityException ex) {
LOG.error("readPermissionOps caught SecurityException rc=" + ex.getErrorId() + ", " + "msg=" + ex.getMessage() + ex);
fail(ex.getMessage());
}
}
Aggregations