Search in sources :

Example 16 with RoleEntity

use of fi.otavanopisto.muikku.model.users.RoleEntity 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

RoleEntity (fi.otavanopisto.muikku.model.users.RoleEntity)16 Permission (fi.otavanopisto.muikku.model.security.Permission)9 EnvironmentRoleEntity (fi.otavanopisto.muikku.model.users.EnvironmentRoleEntity)8 WorkspaceRoleEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceRoleEntity)8 RolePermission (fi.otavanopisto.muikku.model.security.RolePermission)4 SchoolDataSource (fi.otavanopisto.muikku.model.base.SchoolDataSource)3 EnvironmentRoleArchetype (fi.otavanopisto.muikku.model.users.EnvironmentRoleArchetype)3 RoleSchoolDataIdentifier (fi.otavanopisto.muikku.model.users.RoleSchoolDataIdentifier)3 WorkspaceRoleArchetype (fi.otavanopisto.muikku.model.workspace.WorkspaceRoleArchetype)3 ArrayList (java.util.ArrayList)3 SystemRoleEntity (fi.otavanopisto.muikku.model.users.SystemRoleEntity)2 WorkspaceEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceEntity)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 RequestAction (org.ocpsoft.rewrite.annotation.RequestAction)2 EnvironmentUser (fi.otavanopisto.muikku.model.users.EnvironmentUser)1 SystemRoleType (fi.otavanopisto.muikku.model.users.SystemRoleType)1 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)1 UserGroupEntity (fi.otavanopisto.muikku.model.users.UserGroupEntity)1