Search in sources :

Example 16 with Permission

use of fi.otavanopisto.muikku.model.security.Permission in project muikku by otavanopisto.

the class EnvironmentPermissionsManagementBackingBean method init.

@RequestAction
public String init() {
    if (!sessionController.hasEnvironmentPermission(MuikkuPermissions.MANAGE_PERMISSIONS)) {
        return NavigationRules.ACCESS_DENIED;
    }
    permissions = permissionController.listPermissionsByScope(PermissionScope.ENVIRONMENT);
    Collections.sort(permissions, new Comparator<Permission>() {

        @Override
        public int compare(Permission o1, Permission o2) {
            return o1.getName().compareTo(o2.getName());
        }
    });
    roleEntities = new ArrayList<RoleEntity>();
    List<SystemRoleEntity> systemRoleEntities = roleController.listSystemRoleEntities();
    List<EnvironmentRoleEntity> environmentRoleEntities = roleController.listEnvironmentRoleEntities();
    Collections.sort(environmentRoleEntities, new Comparator<EnvironmentRoleEntity>() {

        @Override
        public int compare(EnvironmentRoleEntity o1, EnvironmentRoleEntity o2) {
            return o1.getArchetype().compareTo(o2.getArchetype());
        }
    });
    for (SystemRoleEntity systemRoleEntity : systemRoleEntities) {
        roleEntities.add(systemRoleEntity);
    }
    for (EnvironmentRoleEntity environmentRoleEntity : environmentRoleEntities) {
        roleEntities.add(environmentRoleEntity);
    }
    return null;
}
Also used : RoleEntity(fi.otavanopisto.muikku.model.users.RoleEntity) SystemRoleEntity(fi.otavanopisto.muikku.model.users.SystemRoleEntity) EnvironmentRoleEntity(fi.otavanopisto.muikku.model.users.EnvironmentRoleEntity) EnvironmentRoleEntity(fi.otavanopisto.muikku.model.users.EnvironmentRoleEntity) Permission(fi.otavanopisto.muikku.model.security.Permission) SystemRoleEntity(fi.otavanopisto.muikku.model.users.SystemRoleEntity) RequestAction(org.ocpsoft.rewrite.annotation.RequestAction)

Aggregations

Permission (fi.otavanopisto.muikku.model.security.Permission)16 RoleEntity (fi.otavanopisto.muikku.model.users.RoleEntity)9 WorkspaceEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceEntity)6 RolePermission (fi.otavanopisto.muikku.model.security.RolePermission)4 EnvironmentRoleEntity (fi.otavanopisto.muikku.model.users.EnvironmentRoleEntity)4 UserGroupEntity (fi.otavanopisto.muikku.model.users.UserGroupEntity)4 EnvironmentRoleArchetype (fi.otavanopisto.muikku.model.users.EnvironmentRoleArchetype)3 WorkspaceRoleArchetype (fi.otavanopisto.muikku.model.workspace.WorkspaceRoleArchetype)3 WorkspaceRoleEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceRoleEntity)3 WorkspaceUserEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity)3 ArrayList (java.util.ArrayList)3 RequestAction (org.ocpsoft.rewrite.annotation.RequestAction)3 SystemRoleEntity (fi.otavanopisto.muikku.model.users.SystemRoleEntity)2 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)2 ForumArea (fi.otavanopisto.muikku.plugins.forum.model.ForumArea)2 WorkspaceForumArea (fi.otavanopisto.muikku.plugins.forum.model.WorkspaceForumArea)2 MuikkuPermissionCollection (fi.otavanopisto.muikku.security.MuikkuPermissionCollection)2 EntityManager (javax.persistence.EntityManager)2 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)2 WorkspaceGroupPermission (fi.otavanopisto.muikku.model.security.WorkspaceGroupPermission)1