use of org.ocpsoft.rewrite.annotation.RequestAction in project muikku by otavanopisto.
the class WorkspaceHelpPageBackingBean 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();
try {
WorkspaceMaterial helpPage = workspaceMaterialController.ensureWorkspaceHelpPageExists(workspaceEntity);
contentNodes = Arrays.asList(workspaceMaterialController.createContentNode(helpPage));
} catch (WorkspaceMaterialException e) {
logger.log(Level.SEVERE, "Error loading materials", e);
return NavigationRules.INTERNAL_ERROR;
}
workspaceId = workspaceEntity.getId();
workspaceBackingBean.setWorkspaceUrlName(urlName);
workspaceName = workspaceBackingBean.getWorkspaceName();
materialsBaseUrl = String.format("/workspace/%s/materials", workspaceUrlName);
return null;
}
use of org.ocpsoft.rewrite.annotation.RequestAction in project muikku by otavanopisto.
the class EvaluationIndexBackingBean method init.
@RequestAction
public String init() {
UserEntity userEntity = sessionController.getLoggedUserEntity();
if (userEntity == null) {
return NavigationRules.ACCESS_DENIED;
}
WorkspaceEntity workspaceEntity = null;
if (workspaceEntityId != null) {
workspaceEntity = workspaceEntityController.findWorkspaceEntityById(workspaceEntityId);
if (workspaceEntity == null) {
return NavigationRules.NOT_FOUND;
}
}
if (workspaceEntity == null) {
if (!sessionController.hasEnvironmentPermission(EvaluationResourcePermissionCollection.EVALUATION_VIEW_INDEX)) {
return NavigationRules.ACCESS_DENIED;
}
} else {
if (!sessionController.hasWorkspacePermission(EvaluationResourcePermissionCollection.EVALUATION_VIEW_INDEX, workspaceEntity)) {
return NavigationRules.ACCESS_DENIED;
}
}
listAllWorkspaces = sessionController.hasEnvironmentPermission(EvaluationResourcePermissionCollection.EVALUATION_LIST_ALL_WORKSPACES);
return null;
}
use of org.ocpsoft.rewrite.annotation.RequestAction in project muikku by otavanopisto.
the class AnnouncementsViewBackingBean method init.
@RequestAction
public String init() {
UserEntity loggedUserEntity = sessionController.getLoggedUserEntity();
if (announcementId != null) {
currentAnnouncement = announcementController.findById(announcementId);
if (currentAnnouncement != null) {
List<AnnouncementWorkspace> announcementWorkspaces = announcementController.listAnnouncementWorkspacesSortByUserFirst(currentAnnouncement, loggedUserEntity);
currentAnnouncementWorkspaces = new ArrayList<WorkspaceBasicInfo>();
for (AnnouncementWorkspace aw : announcementWorkspaces) {
currentAnnouncementWorkspaces.add(workspaceRESTModelController.workspaceBasicInfo(aw.getWorkspaceEntityId()));
}
}
}
AnnouncementEnvironmentRestriction environment = sessionController.hasEnvironmentPermission(AnnouncerPermissions.LIST_ENVIRONMENT_GROUP_ANNOUNCEMENTS) ? AnnouncementEnvironmentRestriction.PUBLICANDGROUP : AnnouncementEnvironmentRestriction.PUBLIC;
AnnouncementTimeFrame timeFrame = AnnouncementTimeFrame.CURRENT;
activeAnnouncements = announcementController.listAnnouncements(true, true, environment, timeFrame, loggedUserEntity, false, false);
return null;
}
use of org.ocpsoft.rewrite.annotation.RequestAction in project muikku by otavanopisto.
the class WorkspaceAnnouncerBackingBean 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 (!workspaceEntity.getPublished()) {
if (!sessionController.hasWorkspacePermission(MuikkuPermissions.ACCESS_UNPUBLISHED_WORKSPACE, workspaceEntity)) {
return NavigationRules.NOT_FOUND;
}
}
if (workspaceEntity.getAccess() != WorkspaceAccess.ANYONE) {
if (!sessionController.hasWorkspacePermission(AnnouncerPermissions.WORKSPACE_ANNOUNCER_TOOL, workspaceEntity)) {
if (!sessionController.isLoggedIn()) {
return navigationController.requireLogin();
} else {
return NavigationRules.ACCESS_DENIED;
}
}
}
workspaceEntityId = workspaceEntity.getId();
workspaceBackingBean.setWorkspaceUrlName(urlName);
workspaceName = workspaceBackingBean.getWorkspaceName();
workspaceNameExtension = workspaceBackingBean.getWorkspaceNameExtension();
return null;
}
use of org.ocpsoft.rewrite.annotation.RequestAction 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