use of org.apache.directory.fortress.core.model.Role 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.model.Role 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.model.Role 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());
}
}
use of org.apache.directory.fortress.core.model.Role in project directory-fortress-core by apache.
the class ReviewMgrImplTest method rolePermissions.
/**
* @param msg
* @param rArray
* @param pObjArray
* @param pOpArray
*/
public static void rolePermissions(String msg, String[][] rArray, String[][] pObjArray, String[][] pOpArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
List<Permission> perms = reviewMgr.rolePermissions(role);
assertNotNull(perms);
assertTrue(CLS_NM + "rolePermissions 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("rolePermissions role name [" + role.getName() + "] perm objName [" + PermTestData.getName(obj) + "] operationName [" + PermTestData.getName(op) + "] successful");
} else {
msg = "rolePermissions role name [" + role.getName() + "] perm objName [" + PermTestData.getName(obj) + "] operationName [" + PermTestData.getName(op) + "] failed list search";
LogUtil.logIt(msg);
fail(msg);
}
}
}
}
} catch (SecurityException ex) {
LOG.error("rolePermissions caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.model.Role in project directory-fortress-core by apache.
the class ReviewMgrImplTest method authorizedUsers.
/**
* @param msg
* @param rArray
* @param uArray
*/
public static void authorizedUsers(String msg, String[][] rArray, String[][] uArray) {
LogUtil.logIt(msg);
try {
ReviewMgr reviewMgr = getManagedReviewMgr();
for (String[] rle : rArray) {
List<User> users = reviewMgr.authorizedUsers(new Role(RoleTestData.getName(rle)));
assertNotNull(users);
// LOG.debug("authorizedUsers list source size=" + uArray.length + " ldap size=" + users.size());
assertTrue(CLS_NM + "authorizedUsers list size check", uArray.length == users.size());
for (String[] usr : uArray) {
int indx = users.indexOf(UserTestData.getUser(usr));
if (indx != -1) {
User user = users.get(indx);
assertNotNull(user);
UserTestData.assertEquals(user, usr);
LOG.debug("authorizedUsers role name [" + RoleTestData.getName(rle) + "] userId [" + user.getUserId() + "] successful");
} else {
msg = "authorizedUsers role [" + RoleTestData.getName(rle) + "] user [" + UserTestData.getUserId(usr) + "] failed list search";
LogUtil.logIt(msg);
fail(msg);
}
}
}
} catch (SecurityException ex) {
LOG.error("authorizedUsers caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations