]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - ui/SecurityPerspective.java
1 package org
.argeo
.security
.ui
;
3 import org
.argeo
.security
.equinox
.CurrentUser
;
4 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
5 import org
.eclipse
.swt
.widgets
.Display
;
6 import org
.eclipse
.ui
.IFolderLayout
;
7 import org
.eclipse
.ui
.IPageLayout
;
8 import org
.eclipse
.ui
.IPerspectiveFactory
;
10 public class SecurityPerspective
implements IPerspectiveFactory
{
11 private String adminRole
= "ROLE_ADMIN";
13 public void createInitialLayout(IPageLayout layout
) {
14 if (!CurrentUser
.roles().contains(adminRole
)) {
16 .openError(Display
.getCurrent().getActiveShell(),
18 "You are not allowed to access this resource.");
22 String editorArea
= layout
.getEditorArea();
23 layout
.setEditorAreaVisible(true);
24 layout
.setFixed(false);
26 IFolderLayout left
= layout
.createFolder("left", IPageLayout
.LEFT
,
29 left
.addView("org.argeo.security.ui.usersView");
30 left
.addView("org.argeo.security.ui.rolesView");
31 // left.addView("org.argeo.security.ui.currentUserView");
34 public void setAdminRole(String adminRole
) {
35 this.adminRole
= adminRole
;