use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class ReviewMgrImpl method dsdRoleSetRoles.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public Set<String> dsdRoleSetRoles(SDSet dsd) throws SecurityException {
String methodName = "dsdRoleSetRoles";
assertContext(CLS_NM, methodName, dsd, GlobalErrIds.DSD_NULL);
checkAccess(CLS_NM, methodName);
dsd.setType(SDSet.SDType.DYNAMIC);
SDSet se = ssdP.read(dsd);
return se.getMembers();
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class AdminPermissionUtil method getOperations.
private static List<String> getOperations(Class clazz) {
List<String> operations = new ArrayList<String>();
final Method[] declaredMethods = clazz.getDeclaredMethods();
for (final Method method : declaredMethods) {
if (method.isAnnotationPresent(AdminPermissionOperation.class)) {
AdminPermissionOperation annotation = method.getAnnotation(AdminPermissionOperation.class);
if (annotation.operationName() != null && !annotation.operationName().isEmpty()) {
operations.add(annotation.operationName());
} else {
operations.add(method.getName());
}
}
}
return operations;
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class AdminMgrImpl method addDescendant.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public void addDescendant(Role parentRole, Role childRole) throws SecurityException {
String methodName = "addDescendant";
assertContext(CLS_NM, methodName, parentRole, GlobalErrIds.PARENT_ROLE_NULL);
assertContext(CLS_NM, methodName, childRole, GlobalErrIds.CHILD_ROLE_NULL);
setEntitySession(CLS_NM, methodName, childRole);
// make sure the parent role is already there:
Role role = new Role(parentRole.getName());
role.setContextId(this.contextId);
roleP.read(role);
RoleUtil.getInstance().validateRelationship(childRole, parentRole, false);
childRole.setParent(parentRole.getName());
roleP.add(childRole);
RoleUtil.getInstance().updateHier(this.contextId, new Relationship(childRole.getName().toUpperCase(), parentRole.getName().toUpperCase()), Hier.Op.ADD);
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class AdminMgrImpl method addRoleConstraint.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public RoleConstraint addRoleConstraint(UserRole uRole, RoleConstraint roleConstraint) throws SecurityException {
String methodName = "assignUser";
assertContext(CLS_NM, methodName, uRole, GlobalErrIds.URLE_NULL);
AdminUtil.canAssign(uRole.getAdminSession(), new User(uRole.getUserId()), new Role(uRole.getName()), contextId);
// todo assert roleconstraint here
userP.assign(uRole, roleConstraint);
return roleConstraint;
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class AdminMgrImpl method deleteSsdRoleMember.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public SDSet deleteSsdRoleMember(SDSet ssdSet, Role role) throws SecurityException {
String methodName = "deleteSsdRoleMember";
assertContext(CLS_NM, methodName, ssdSet, GlobalErrIds.SSD_NULL);
assertContext(CLS_NM, methodName, role, GlobalErrIds.ROLE_NULL);
setEntitySession(CLS_NM, methodName, ssdSet);
SDSet entity = sdP.read(ssdSet);
entity.setContextId(this.contextId);
entity.delMember(role.getName());
// when removing last role member a placeholder must be left in data set:
if (entity.getMembers().isEmpty()) {
entity.addMember(GlobalIds.NONE);
}
setAdminData(CLS_NM, methodName, entity);
SDSet ssdOut = sdP.update(entity);
// remove any references to the old SSD from cache:
clearSSDCache(role);
return ssdOut;
}
Aggregations