use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class GroupMgrImpl method deassign.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public Group deassign(Group group, String member) throws SecurityException {
String methodName = "deassign";
assertContext(CLS_NM, methodName, group, GlobalErrIds.GROUP_NULL);
checkAccess(CLS_NM, methodName);
ReviewMgr reviewMgr = ReviewMgrFactory.createInstance(this.contextId);
String dn;
if (group.getType() == Group.Type.ROLE) {
Role role = reviewMgr.readRole(new Role(member));
dn = role.getDn();
} else {
User user = reviewMgr.readUser(new User(member));
dn = user.getDn();
}
return groupP.deassign(group, dn);
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class PwPolicyMgrImpl method deletePasswordPolicy.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public void deletePasswordPolicy(String userId) throws SecurityException {
String methodName = "deletePasswordPolicy";
VUtil.assertNotNullOrEmpty(userId, GlobalErrIds.USER_NULL, CLS_NM + "." + methodName);
User user = new User(userId);
user.setAdminSession(adminSess);
setEntitySession(CLS_NM, methodName, user);
userP.deletePwPolicy(user);
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class ReviewMgrImpl method assignedUsers.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public List<String> assignedUsers(Role role, int limit) throws SecurityException {
String methodName = "assignedUsers";
assertContext(CLS_NM, methodName, role, GlobalErrIds.ROLE_NULL);
checkAccess(CLS_NM, methodName);
List<String> users = null;
// If role occupant is set on role, get it from the role object itself:
if (Config.getInstance().isRoleOccupant()) {
Role entity = roleP.read(role);
// this one retrieves from the role itself.
users = entity.getOccupants();
if (users != null && users.size() > limit) {
users = users.subList(0, limit);
}
} else // otherwise, search across the people tree for all users assigned to this role:
{
users = userP.getAssignedUserIds(role);
}
// return empty list to caller:
if (users == null) {
users = new ArrayList<>();
}
return users;
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class ReviewMgrImpl method dsdRoleSetCardinality.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public int dsdRoleSetCardinality(SDSet dsd) throws SecurityException {
String methodName = "dsdRoleSetCardinality";
assertContext(CLS_NM, methodName, dsd, GlobalErrIds.DSD_NULL);
checkAccess(CLS_NM, methodName);
SDSet se = ssdP.read(dsd);
return se.getCardinality();
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class ReviewMgrImpl method permissionRoles.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public List<String> permissionRoles(Permission perm) throws SecurityException {
String methodName = "permissionRoles";
assertContext(CLS_NM, methodName, perm, GlobalErrIds.PERM_OBJECT_NULL);
checkAccess(CLS_NM, methodName);
Permission pe = permP.read(perm);
List<String> retVals;
if (pe != null && CollectionUtils.isNotEmpty(pe.getRoles())) {
retVals = new ArrayList<>(pe.getRoles());
} else {
retVals = new ArrayList<>();
}
return retVals;
}
Aggregations