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;
}
Aggregations