Search in sources :

Example 16 with Role

use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.

the class RoleCacheWrapper method initCache.

@Override
public void initCache(IRoleDAO roleDAO) throws ApsSystemException {
    try {
        Cache cache = this.getCache();
        this.releaseCachedObjects(cache);
        Map<String, Role> roles = roleDAO.loadRoles();
        this.insertObjectsOnCache(cache, roles);
    } catch (Throwable t) {
        _logger.error("Error loading roles", t);
        throw new ApsSystemException("Error loading roles", t);
    }
}
Also used : Role(com.agiletec.aps.system.services.role.Role) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) Cache(org.springframework.cache.Cache)

Example 17 with Role

use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.

the class RoleAction method delete.

public String delete() {
    try {
        String result = this.checkRoleForDelete();
        if (null != result)
            return result;
        IRoleManager roleManager = this.getRoleManager();
        Role role = roleManager.getRole(this.getName());
        roleManager.removeRole(role);
    } catch (Throwable t) {
        _logger.error("error in delete", t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : Role(com.agiletec.aps.system.services.role.Role) IRoleManager(com.agiletec.aps.system.services.role.IRoleManager)

Example 18 with Role

use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.

the class RoleAction method showDetail.

public String showDetail() {
    this.setStrutsAction(ApsAdminSystemConstants.EDIT);
    try {
        if (!this.existsRole()) {
            this.addActionError(this.getText("error.role.notExist"));
            return "roleList";
        }
        Role role = this.getRoleManager().getRole(this.getName());
        this.setDescription(role.getDescription());
        this.setPermissionNames(role.getPermissions());
        this.isRoleInUse();
    } catch (Throwable t) {
        _logger.error("error in view", t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : Role(com.agiletec.aps.system.services.role.Role)

Example 19 with Role

use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.

the class UserControllerIntegrationTest method createRole.

private Role createRole(int i) {
    Role role = new Role();
    role.setDescription("descr" + i);
    role.setName("role" + i);
    return role;
}
Also used : Role(com.agiletec.aps.system.services.role.Role)

Example 20 with Role

use of com.agiletec.aps.system.services.role.Role in project entando-core by entando.

the class OAuth2TestUtils method addAuthorization.

public static void addAuthorization(User user, String groupName, String roleName, String[] permissions) {
    Group group = null;
    if (StringUtils.isNotBlank(groupName)) {
        group = new Group();
        group.setName(groupName);
        group.setDescription(groupName + " descr");
    }
    Role role = null;
    if (StringUtils.isNotBlank(roleName)) {
        role = new Role();
        role.setName(roleName);
        role.setDescription(roleName + " descr");
        if (null != permissions) {
            for (String permissionName : permissions) {
                role.addPermission(permissionName);
            }
        }
    }
    Authorization auth = new Authorization(group, role);
    user.addAuthorization(auth);
}
Also used : Role(com.agiletec.aps.system.services.role.Role) Authorization(com.agiletec.aps.system.services.authorization.Authorization) Group(com.agiletec.aps.system.services.group.Group)

Aggregations

Role (com.agiletec.aps.system.services.role.Role)40 Group (com.agiletec.aps.system.services.group.Group)13 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)9 ArrayList (java.util.ArrayList)5 RoleDto (org.entando.entando.aps.system.services.role.model.RoleDto)5 SearcherDaoPaginatedResult (com.agiletec.aps.system.common.model.dao.SearcherDaoPaginatedResult)4 IRoleManager (com.agiletec.aps.system.services.role.IRoleManager)4 List (java.util.List)4 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)4 RestServerError (org.entando.entando.aps.system.exception.RestServerError)4 ValidationConflictException (org.entando.entando.web.common.exceptions.ValidationConflictException)4 PagedMetadata (org.entando.entando.web.common.model.PagedMetadata)4 FieldSearchFilter (com.agiletec.aps.system.common.FieldSearchFilter)3 UserDetails (com.agiletec.aps.system.services.user.UserDetails)3 UserDto (org.entando.entando.aps.system.services.user.model.UserDto)3 Filter (org.entando.entando.web.common.model.Filter)3 RoleRequest (org.entando.entando.web.role.model.RoleRequest)3 BeanPropertyBindingResult (org.springframework.validation.BeanPropertyBindingResult)3 Authorization (com.agiletec.aps.system.services.authorization.Authorization)2 IAuthorizationService (com.agiletec.aps.system.services.authorization.IAuthorizationService)2