use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class ReviewMgrImplTest method userPermissions.
/**
* @param msg
* @param uArray
* @param pObjArray
* @param pOpArray
*/
public static void userPermissions(String msg, String[][] uArray, String[][] pObjArray, String[][] pOpArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
for (String[] usr : uArray) {
User user = UserTestData.getUser(usr);
List<Permission> perms = reviewMgr.userPermissions(user);
assertNotNull(perms);
assertTrue(CLS_NM + "userPermissions list size check", pOpArray.length * pObjArray.length == perms.size());
for (String[] obj : pObjArray) {
for (String[] op : pOpArray) {
int indx = perms.indexOf(new Permission(PermTestData.getName(obj), PermTestData.getName(op), PermTestData.getObjId(op)));
if (indx != -1) {
Permission pOp = perms.get(indx);
assertNotNull(pOp);
PermTestData.assertEquals(PermTestData.getName(obj), pOp, op);
LOG.debug("userPermissions userId [" + user.getUserId() + "] perm objName [" + PermTestData.getName(obj) + "] operationName [" + PermTestData.getName(op) + "] successful");
} else {
msg = "userPermissions userId [" + user.getUserId() + "] perm objName [" + PermTestData.getName(obj) + "] operationName [" + PermTestData.getName(op) + "] failed list search";
LogUtil.logIt(msg);
fail(msg);
}
}
}
}
} catch (SecurityException ex) {
LOG.error("userPermissions 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 ReviewMgrImplTest method searchRolesNms.
/**
* @param msg
* @param srchValue
* @param rArray
*/
public static void searchRolesNms(String msg, String srchValue, String[][] rArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
List<String> roles = reviewMgr.findRoles(srchValue, rArray.length);
assertNotNull(roles);
assertTrue(CLS_NM + "searchRolesNms list size check", rArray.length == roles.size());
for (String[] rle : rArray) {
int indx = roles.indexOf(RoleTestData.getName(rle));
if (indx != -1) {
String roleNm = roles.get(indx);
assertNotNull(roleNm);
assertEquals(CLS_NM + ".searchRolesNms failed compare role name", RoleTestData.getName(rle), roleNm);
} else {
msg = "searchRolesNms srchValue [" + srchValue + "] failed list search";
LogUtil.logIt(msg);
fail(msg);
}
}
} catch (SecurityException ex) {
LOG.error("searchRolesNms srchValue [" + srchValue + "] 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 ReviewMgrImplTest method assignedUserIds.
/**
* @param msg
* @param rArray
* @param uArray
*/
public static void assignedUserIds(String msg, String[][] rArray, String[][] uArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
for (String[] rle : rArray) {
List<String> users = reviewMgr.assignedUsers(new Role(RoleTestData.getName(rle)), uArray.length);
assertNotNull(users);
assertTrue(CLS_NM + ".assignedUserIds list size check", uArray.length == users.size());
for (String[] usr : uArray) {
users.indexOf(UserTestData.getUserId(usr));
// todo - figure out how to compare userid dns with userids:
}
}
} catch (SecurityException ex) {
LOG.error("assignedUserIds 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 ReviewMgrImplTest method readRoles.
/**
* @param msg
* @param rArray
*/
public static void readRoles(String msg, String[][] rArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
for (String[] rle : rArray) {
Role entity = reviewMgr.readRole(new Role(RoleTestData.getName(rle)));
RoleTestData.assertEquals(entity, rle);
LOG.debug("readRoles [" + entity.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("readRoles caught SecurityException=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.ReviewMgr in project directory-fortress-core by apache.
the class ReviewMgrImplTest method searchRoles.
/**
* @param msg
* @param srchValue
* @param rArray
*/
public static void searchRoles(String msg, String srchValue, String[][] rArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
List<Role> roles = reviewMgr.findRoles(srchValue);
assertNotNull(roles);
assertTrue(CLS_NM + "searchRoles list size check", rArray.length == roles.size());
for (String[] rle : rArray) {
int indx = roles.indexOf(new Role(RoleTestData.getName(rle)));
if (indx != -1) {
Role entity = roles.get(indx);
assertNotNull(entity);
RoleTestData.assertEquals(entity, rle);
LOG.debug("searchRoles [" + entity.getName() + "] successful");
} else {
msg = "searchRoles srchValue [" + srchValue + "] failed list search";
LogUtil.logIt(msg);
fail(msg);
}
}
} catch (SecurityException ex) {
LOG.error("searchRoles srchValue [" + srchValue + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations