use of fi.otavanopisto.muikku.model.workspace.WorkspaceEntity in project muikku by otavanopisto.
the class WorkspaceRESTService method deleteWorkspaceMaterialProducer.
@DELETE
@Path("/workspaces/{WORKSPACEENTITYID}/materialProducers/{ID}")
@RESTPermit(handling = Handling.INLINE, requireLoggedIn = true)
public Response deleteWorkspaceMaterialProducer(@PathParam("WORKSPACEENTITYID") Long workspaceEntityId, @PathParam("ID") Long workspaceMaterialProducerId) {
WorkspaceEntity workspaceEntity = workspaceController.findWorkspaceEntityById(workspaceEntityId);
if (workspaceEntity == null) {
return Response.status(Status.NOT_FOUND).build();
}
if (!sessionController.hasWorkspacePermission(MuikkuPermissions.MANAGE_WORKSPACE_MATERIAL_PRODUCERS, workspaceEntity)) {
return Response.status(Status.FORBIDDEN).build();
}
WorkspaceMaterialProducer materialProducer = workspaceController.findWorkspaceMaterialProducer(workspaceMaterialProducerId);
workspaceController.deleteWorkspaceMaterialProducer(materialProducer);
return Response.noContent().build();
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceEntity in project muikku by otavanopisto.
the class WorkspacePermissionsManagementBackingBean method hasUserGroupPermission.
public boolean hasUserGroupPermission(UserGroupBean userGroup, Permission permission) {
UserGroupEntity userGroupEntity = userGroupEntityController.findUserGroupEntityById(userGroup.getId());
WorkspaceEntity workspaceEntity = workspaceController.findWorkspaceEntityById(getWorkspaceEntityId());
return permissionController.hasWorkspaceGroupPermission(workspaceEntity, userGroupEntity, permission);
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceEntity in project muikku by otavanopisto.
the class WorkspacePermissionsRoleManagementBackingBean method init.
@RequestAction
public String init() {
String urlName = getWorkspaceUrlName();
if (StringUtils.isBlank(urlName)) {
return NavigationRules.NOT_FOUND;
}
WorkspaceEntity workspaceEntity = workspaceController.findWorkspaceEntityByUrlName(urlName);
if (workspaceEntity == null) {
return NavigationRules.NOT_FOUND;
}
if (!sessionController.hasWorkspacePermission(MuikkuPermissions.WORKSPACE_MANAGEWORKSPACESETTINGS, workspaceEntity)) {
return NavigationRules.ACCESS_DENIED;
}
workspaceEntityId = workspaceEntity.getId();
workspaceBackingBean.setWorkspaceUrlName(urlName);
workspaceName = workspaceBackingBean.getWorkspaceName();
/**
* View data
*/
permissions = permissionController.listPermissionsByScope(PermissionScope.WORKSPACE);
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> environmentRoleEnties = roleController.listEnvironmentRoleEntities();
List<WorkspaceRoleEntity> workspaceRoleEntities = roleController.listWorkspaceRoleEntities();
Collections.sort(environmentRoleEnties, new Comparator<EnvironmentRoleEntity>() {
@Override
public int compare(EnvironmentRoleEntity o1, EnvironmentRoleEntity o2) {
return o1.getArchetype().compareTo(o2.getArchetype());
}
});
Collections.sort(workspaceRoleEntities, new Comparator<WorkspaceRoleEntity>() {
@Override
public int compare(WorkspaceRoleEntity o1, WorkspaceRoleEntity o2) {
return o1.getArchetype().compareTo(o2.getArchetype());
}
});
for (SystemRoleEntity systemRoleEntity : systemRoleEntities) {
roleEntities.add(systemRoleEntity);
}
for (EnvironmentRoleEntity environmentRoleEntity : environmentRoleEnties) {
roleEntities.add(environmentRoleEntity);
}
for (WorkspaceRoleEntity workspaceRoleEntity : workspaceRoleEntities) {
roleEntities.add(workspaceRoleEntity);
}
return null;
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceEntity in project muikku by otavanopisto.
the class WorkspaceUsersBackingBean method init.
@RequestAction
public String init() {
String urlName = getWorkspaceUrlName();
if (StringUtils.isBlank(urlName)) {
return NavigationRules.NOT_FOUND;
}
WorkspaceEntity workspaceEntity = workspaceController.findWorkspaceEntityByUrlName(urlName);
if (workspaceEntity == null) {
return NavigationRules.NOT_FOUND;
}
workspaceEntityId = workspaceEntity.getId();
workspaceBackingBean.setWorkspaceUrlName(urlName);
if (!sessionController.hasWorkspacePermission(MuikkuPermissions.LIST_WORKSPACE_MEMBERS, workspaceEntity)) {
return NavigationRules.NOT_FOUND;
}
return null;
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceEntity in project muikku by otavanopisto.
the class WorkspaceController method archiveWorkspace.
public void archiveWorkspace(Workspace workspace) {
WorkspaceEntity workspaceEntity = workspaceSchoolDataController.findWorkspaceEntity(workspace);
if (workspaceEntity != null) {
archiveWorkspaceEntity(workspaceEntity);
}
workspaceSchoolDataController.removeWorkspace(workspace);
}
Aggregations