use of org.apache.directory.fortress.core.AdminMgr 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());
}
}
use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.
the class AdminMgrImplTest method addRoleGrantsH.
/**
* @param msg
* @param rArray
* @param objArray
* @param opArray
*/
public static void addRoleGrantsH(String msg, String[][] rArray, String[][] objArray, String[][] opArray) {
LogUtil.logIt(msg);
Permission pOp = new Permission();
Role role = new Role();
try {
AdminMgr adminMgr = getManagedAdminMgr();
int i = 0;
for (String[] obj : objArray) {
role = new Role(RoleTestData.getName(rArray[i++]));
for (String[] op : opArray) {
pOp = PermTestData.getOp(PermTestData.getName(obj), op);
adminMgr.grantPermission(pOp, role);
LOG.debug("addRoleGrantsH role name [" + role.getName() + "] objName [" + pOp.getObjName() + "] objectId [" + pOp.getObjId() + "] operation name [" + pOp.getOpName() + "] successful");
}
}
} catch (SecurityException ex) {
LOG.error("addRoleGrantsH role name [" + role.getName() + "] objName [" + pOp.getObjName() + "] objectId [" + pOp.getObjId() + "] operation name [" + pOp.getOpName() + "] 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 addUserGrants.
/**
* @param uArray
* @param objArray
* @param opArray
*/
public static void addUserGrants(String msg, String[][] uArray, String[][] objArray, String[][] opArray) {
LogUtil.logIt(msg);
Permission pOp = new Permission();
User user = new User();
try {
AdminMgr adminMgr = getManagedAdminMgr();
for (String[] usr : uArray) {
for (String[] obj : objArray) {
for (String[] op : opArray) {
user = new User(UserTestData.getUserId(usr));
pOp = PermTestData.getOp(PermTestData.getName(obj), op);
adminMgr.grantPermission(pOp, user);
LOG.debug("addUserGrants userId [" + user.getUserId() + "] objName [" + pOp.getObjName() + "] objectId [" + pOp.getObjId() + "] operation name [" + pOp.getOpName() + "] successful");
}
}
}
} catch (SecurityException ex) {
LOG.error("addUserGrants userId [" + user.getUserId() + "] objName [" + pOp.getObjName() + "] objectId [" + pOp.getObjId() + "] operation name [" + pOp.getOpName() + "] 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 addPermObjs.
/**
* @param objArray
*/
public static void addPermObjs(String msg, String[][] objArray, boolean isAdmin, boolean canFail) {
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);
// Todo - add props
adminMgr.addPermObj(pObj);
LOG.debug("addPermObjs objName [" + pObj.getObjName() + "] successful");
}
} catch (SecurityException ex) {
if (!canFail) {
LOG.error("addPermObjs 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 addRoles.
/**
* @param rArray
*/
public static void addRoles(String msg, String[][] rArray) {
LogUtil.logIt(msg);
try {
AdminMgr adminMgr = getManagedAdminMgr();
for (String[] rle : rArray) {
Role role = RoleTestData.getRole(rle);
Role entity = adminMgr.addRole(role);
LOG.debug("addRoles role [" + entity.getName() + "] successful");
}
} catch (SecurityException ex) {
LOG.error("addRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
fail(ex.getMessage());
}
}
Aggregations