use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class AdminMgrImpl method removeRoleConstraint.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public void removeRoleConstraint(UserRole uRole, RoleConstraint roleConstraint) throws SecurityException {
String methodName = "assignUser";
assertContext(CLS_NM, methodName, uRole, GlobalErrIds.URLE_NULL);
AdminUtil.canDeassign(uRole.getAdminSession(), new User(uRole.getUserId()), new Role(uRole.getName()), contextId);
// todo assert roleconstraint here
userP.deassign(uRole, roleConstraint);
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class PwPolicyMgrImpl method read.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public PwPolicy read(String name) throws SecurityException {
String methodName = "read";
VUtil.assertNotNullOrEmpty(name, GlobalErrIds.PSWD_NAME_NULL, CLS_NM + "." + methodName);
checkAccess(CLS_NM, methodName);
PwPolicy policy = new PwPolicy(name);
policy.setContextId(this.contextId);
return policyP.read(policy);
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class PwPolicyMgrImpl method updateUserPolicy.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public void updateUserPolicy(String userId, String policyName) throws SecurityException {
String methodName = "updateUserPolicy";
VUtil.assertNotNullOrEmpty(userId, GlobalErrIds.USER_NULL, CLS_NM + "." + methodName);
VUtil.assertNotNullOrEmpty(policyName, GlobalErrIds.PSWD_NAME_NULL, CLS_NM + "." + methodName);
User user = new User(userId);
user.setPwPolicy(policyName);
user.setAdminSession(adminSess);
setEntitySession(CLS_NM, methodName, user);
userP.update(user);
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class PwPolicyMgrImpl method search.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public List<PwPolicy> search(String searchVal) throws SecurityException {
String methodName = "search";
VUtil.assertNotNull(searchVal, GlobalErrIds.PSWD_NAME_NULL, CLS_NM + "." + methodName);
checkAccess(CLS_NM, methodName);
PwPolicy policy = new PwPolicy(searchVal);
policy.setContextId(this.contextId);
return policyP.search(policy);
}
use of org.apache.directory.fortress.annotation.AdminPermissionOperation in project directory-fortress-core by apache.
the class ReviewMgrImpl method authorizedPermissionUsers.
/**
* {@inheritDoc}
*/
@Override
@AdminPermissionOperation
public Set<String> authorizedPermissionUsers(Permission perm) throws SecurityException {
Set<String> authorizedUsers = null;
String methodName = "authorizedPermissionUsers";
assertContext(CLS_NM, methodName, perm, GlobalErrIds.PERM_OPERATION_NULL);
checkAccess(CLS_NM, methodName);
// Pull the permission from ldap:
Permission pe = permP.read(perm);
// Get all roles that this permission is authorized for:
Set<String> authorizedRoles = authorizeRoles(pe.getRoles());
if (authorizedRoles != null) {
// Pull the set of users assigned to descendant or assigned roles from ldap:
authorizedUsers = userP.getAssignedUsers(authorizedRoles, this.contextId);
}
// Now add any users who have been directly assigned to this permission entity:
Set<String> assignedUsers = pe.getUsers();
if (assignedUsers != null) {
// It is possible this dataset has not yet been instantiated (if perm has no assigned roles):
if (authorizedUsers == null) {
authorizedUsers = new HashSet<>();
}
authorizedUsers.addAll(assignedUsers);
}
// The returned list includes all assigned users plus any users assigned via authorized roles.
return authorizedUsers;
}
Aggregations