Search in sources :

Example 1 with AdminMgr

use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.

the class DelAdminMgrImpl method updateRole.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public AdminRole updateRole(AdminRole role) throws SecurityException {
    String methodName = "updateRole";
    assertContext(CLS_NM, methodName, role, GlobalErrIds.ARLE_NULL);
    setEntitySession(CLS_NM, methodName, role);
    AdminRole re = admRP.update(role);
    // search for all users assigned this role and update:
    List<User> users = userP.getAssignedUsers(role);
    if (CollectionUtils.isNotEmpty(users)) {
        final AdminMgr aMgr = AdminMgrFactory.createInstance(this.contextId);
        for (User ue : users) {
            User upUe = new User(ue.getUserId());
            setAdminData(CLS_NM, methodName, upUe);
            List<UserAdminRole> uaRoles = ue.getAdminRoles();
            UserAdminRole chgRole = new UserAdminRole();
            chgRole.setName(role.getName());
            chgRole.setUserId(ue.getUserId());
            chgRole.setOsPSet(role.getOsPSet());
            chgRole.setOsUSet(role.getOsUSet());
            uaRoles.remove(chgRole);
            ConstraintUtil.copy(re, chgRole);
            uaRoles.add(chgRole);
            upUe.setUserId(ue.getUserId());
            upUe.setAdminRole(chgRole);
            aMgr.updateUser(upUe);
        }
    }
    return re;
}
Also used : User(org.apache.directory.fortress.core.model.User) UserAdminRole(org.apache.directory.fortress.core.model.UserAdminRole) AdminRole(org.apache.directory.fortress.core.model.AdminRole) UserAdminRole(org.apache.directory.fortress.core.model.UserAdminRole) AdminMgr(org.apache.directory.fortress.core.AdminMgr) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 2 with AdminMgr

use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.

the class DelAdminMgrImpl method addPermObj.

/**
 * {@inheritDoc}
 */
@Override
public PermObj addPermObj(PermObj pObj) throws SecurityException {
    final AdminMgr adminMgr = AdminMgrFactory.createInstance(this.contextId);
    pObj.setAdmin(true);
    return adminMgr.addPermObj(pObj);
}
Also used : AdminMgr(org.apache.directory.fortress.core.AdminMgr) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr)

Example 3 with AdminMgr

use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.

the class DelAdminMgrImpl method addPermission.

/**
 * {@inheritDoc}
 */
@Override
public Permission addPermission(Permission perm) throws SecurityException {
    final AdminMgr adminMgr = AdminMgrFactory.createInstance(this.contextId);
    perm.setAdmin(true);
    return adminMgr.addPermission(perm);
}
Also used : AdminMgr(org.apache.directory.fortress.core.AdminMgr) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr)

Example 4 with AdminMgr

use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.

the class DelAdminMgrImpl method updatePermObj.

/**
 * {@inheritDoc}
 */
@Override
public PermObj updatePermObj(PermObj pObj) throws SecurityException {
    final AdminMgr adminMgr = AdminMgrFactory.createInstance(this.contextId);
    pObj.setAdmin(true);
    return adminMgr.updatePermObj(pObj);
}
Also used : AdminMgr(org.apache.directory.fortress.core.AdminMgr) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr)

Example 5 with AdminMgr

use of org.apache.directory.fortress.core.AdminMgr in project directory-fortress-core by apache.

the class DelAdminMgrImpl method deletePermission.

/**
 * {@inheritDoc}
 */
@Override
public void deletePermission(Permission perm) throws SecurityException {
    final AdminMgr adminMgr = AdminMgrFactory.createInstance(this.contextId);
    perm.setAdmin(true);
    adminMgr.deletePermission(perm);
}
Also used : AdminMgr(org.apache.directory.fortress.core.AdminMgr) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr)

Aggregations

AdminMgr (org.apache.directory.fortress.core.AdminMgr)104 SecurityException (org.apache.directory.fortress.core.SecurityException)89 Role (org.apache.directory.fortress.core.model.Role)40 User (org.apache.directory.fortress.core.model.User)39 UserRole (org.apache.directory.fortress.core.model.UserRole)35 ReviewMgr (org.apache.directory.fortress.core.ReviewMgr)27 Permission (org.apache.directory.fortress.core.model.Permission)18 RoleConstraint (org.apache.directory.fortress.core.model.RoleConstraint)16 SDSet (org.apache.directory.fortress.core.model.SDSet)12 DelAdminMgr (org.apache.directory.fortress.core.DelAdminMgr)11 PwPolicyMgr (org.apache.directory.fortress.core.PwPolicyMgr)7 PermObj (org.apache.directory.fortress.core.model.PermObj)7 AccessMgr (org.apache.directory.fortress.core.AccessMgr)6 PermissionAttributeSet (org.apache.directory.fortress.core.model.PermissionAttributeSet)3 AdminPermissionOperation (org.apache.directory.fortress.annotation.AdminPermissionOperation)1 FinderException (org.apache.directory.fortress.core.FinderException)1 AdminRole (org.apache.directory.fortress.core.model.AdminRole)1 Session (org.apache.directory.fortress.core.model.Session)1 UserAdminRole (org.apache.directory.fortress.core.model.UserAdminRole)1