use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class AdminMgrImplTest method changePasswords.
/**
* @param msg
* @param uOldArray
* @param uNewArray
*/
void changePasswords(String msg, String[][] uOldArray, String[][] uNewArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
int i = 0;
for (String[] usr : uOldArray) {
User user = UserTestData.getUser(usr);
adminMgr.changePassword(user, UserTestData.getPassword(uNewArray[i++]));
LOG.debug("changePasswords user [" + user.getUserId() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("changePasswords: caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class AdminMgrImplTest method deleteDsdRoleMember.
/**
* @param sArray
*/
private void deleteDsdRoleMember(String msg, String[][] sArray, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (String[] dsdle : sArray) {
SDSet dsd = RoleTestData.getSDSet(dsdle);
// first add all of the roles as members of SSD entity:
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
dsd.addMember(role.getName());
}
// now iterate over roles and remove from DSD set one at a time.
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
adminMgr.deleteDsdRoleMember(dsd, role);
List<SDSet> dsdSets = reviewMgr.dsdRoleSets(role);
assertTrue(CLS_NM + "deleteDsdRoleMember list size check", dsdSets.size() == 0);
}
adminMgr.deleteDsdSet(dsd);
LOG.debug("deletedsdRoleMember DSD [" + dsd.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("deleteDsdRoleMember caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class AdminMgrImplTest method addDsdRoleMember.
/**
* @param sArray
*/
public static void addDsdRoleMember(String msg, String[][] sArray, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
for (String[] dsdle : sArray) {
SDSet dsd = RoleTestData.getSDSet(dsdle);
SDSet entity = adminMgr.createDsdSet(dsd);
LOG.debug("addDsdRoleMember DSD [" + entity.getName() + "] successful");
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
adminMgr.addDsdRoleMember(dsd, role);
List<SDSet> dsdSets = reviewMgr.dsdRoleSets(role);
assertNotNull(dsdSets);
assertTrue(CLS_NM + "addDsdRoleMember list size check", dsdSets.size() == 1);
SDSet dsd2 = dsdSets.get(0);
assertTrue(CLS_NM + "addDsdRoleMember DSD name check", dsd.getName().equals(dsd2.getName()));
assertTrue(CLS_NM + "addDsdRoleMember DSD role check", dsd2.getMembers().contains(role.getName()));
// assertTrue(CLS_NM + "addDsdRoleMember DSD role check", dsd2.getMembers().containsKey(role.getName()));
}
}
} catch (SecurityException ex) {
LOG.error("addDsdRoleMember caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class AdminMgrImplTest method addRoleAscendant.
/**
* @param msg
* @param rArray
*/
public static void addRoleAscendant(String msg, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
if (RoleTestData.isCreate(rle)) {
adminMgr.addRole(role);
LOG.debug("addAscendant add role [" + role.getName() + "] successful");
}
Set<String> ascs = RoleTestData.getRelationships(rle);
if (ascs != null) {
for (String asc : ascs) {
adminMgr.addAscendant(role, new Role(asc));
LOG.debug("addAscendant desc role [" + role.getName() + "] asc role [" + asc + "] successful");
}
}
Set<String> inheritances = RoleTestData.getInheritances(rle);
if (inheritances != null) {
for (String asc : inheritances) {
adminMgr.addInheritance(new Role(asc), role);
LOG.debug("addAscendant desc role [" + role.getName() + "] asc role [" + asc + "] successful");
}
}
}
} catch (SecurityException ex) {
LOG.error("addDescendant caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class AdminMgrImplTest method deleteDsdSet.
/**
* @param sArray
*/
private void deleteDsdSet(String msg, String[][] sArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
for (String[] dsdle : sArray) {
SDSet dsd = RoleTestData.getSDSet(dsdle);
adminMgr.deleteDsdSet(dsd);
LOG.debug("deleteDsdSet role [" + dsd.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("deleteDsdSet caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations