private List<? extends MenuItem> getDashboardViews() { final List<MenuItem> result = new ArrayList<MenuItem>(1); result.add( MenuFactory.newSimpleItem(constants.Process_Dashboard()) .withRoles(kieACL.getGrantedRoles(F_PROCESS_DASHBOARD)) .place(new DefaultPlaceRequest("DashboardPerspective")) .endMenu() .build() .getItems() .get(0)); final String dashbuilderURL = DashboardURLBuilder.getDashboardURL( "/dashbuilder/workspace", "showcase", LocaleInfo.getCurrentLocale().getLocaleName()); result.add( MenuFactory.newSimpleItem(constants.Business_Dashboard()) .withRoles(kieACL.getGrantedRoles(F_DASHBOARD_BUILDER)) .respondsWith( new Command() { @Override public void execute() { Window.open(dashbuilderURL, "_blank", ""); } }) .endMenu() .build() .getItems() .get(0)); return result; }
private List<? extends MenuItem> getExtensionsViews() { final List<MenuItem> result = new ArrayList<MenuItem>(2); result.add( MenuFactory.newSimpleItem(constants.plugins()) .withRoles(kieACL.getGrantedRoles(F_PLUGIN_MANAGEMENT)) .place(new DefaultPlaceRequest("PlugInAuthoringPerspective")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.Apps()) .withRoles(kieACL.getGrantedRoles(F_APPS)) .place(new DefaultPlaceRequest("AppsPerspective")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.DataSets()) .withRoles(kieACL.getGrantedRoles(F_DATASETS)) .place(new DefaultPlaceRequest("DataSetAuthoringPerspective")) .endMenu() .build() .getItems() .get(0)); return result; }
private List<? extends MenuItem> getDeploymentViews() { final List<MenuItem> result = new ArrayList<MenuItem>(3); result.add( MenuFactory.newSimpleItem(constants.Process_Deployments()) .withRoles(kieACL.getGrantedRoles(F_DEPLOYMENTS)) .place(new DefaultPlaceRequest("Deployments")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.Rule_Deployments()) .withRoles(kieACL.getGrantedRoles(F_MANAGEMENT)) .place(new DefaultPlaceRequest("ServerManagementPerspective")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.Jobs()) .withRoles(kieACL.getGrantedRoles(F_JOBS)) .place(new DefaultPlaceRequest("Jobs")) .endMenu() .build() .getItems() .get(0)); return result; }
private List<? extends MenuItem> getHomeViews( final Boolean socialEnabled, final boolean usersSystemActive) { final AbstractWorkbenchPerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity(); final List<MenuItem> result = new ArrayList<MenuItem>(1); result.add( MenuFactory.newSimpleItem(constants.homePage()) .place(new DefaultPlaceRequest(defaultPerspective.getIdentifier())) .endMenu() .build() .getItems() .get(0)); // Social menu items. if (socialEnabled) { result.add( MenuFactory.newSimpleItem(constants.timeline()) .place(new DefaultPlaceRequest("SocialHomePagePerspective")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.people()) .place(new DefaultPlaceRequest("UserHomePagePerspective")) .endMenu() .build() .getItems() .get(0)); } // User management menu items (only if services are active and constrained to admin roles). if (usersSystemActive) { result.add( MenuFactory.newSimpleItem(constants.userManagement()) .withRoles(kieACL.getGrantedRoles(F_ADMINISTRATION)) .place(new DefaultPlaceRequest("UsersManagementPerspective")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.groupManagement()) .withRoles(kieACL.getGrantedRoles(F_ADMINISTRATION)) .place(new DefaultPlaceRequest("GroupsManagementPerspective")) .endMenu() .build() .getItems() .get(0)); } return result; }
private List<MenuItem> getAuthoringViews() { final List<MenuItem> result = new ArrayList<MenuItem>(4); result.add( MenuFactory.newSimpleItem(constants.project_authoring()) .withRoles(kieACL.getGrantedRoles(F_PROJECT_AUTHORING)) .place(new DefaultPlaceRequest("AuthoringPerspective")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.contributors()) .withRoles(kieACL.getGrantedRoles(F_CONTRIBUTORS)) .place(new DefaultPlaceRequest("ContributorsPerspective")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.artifactRepository()) .withRoles(kieACL.getGrantedRoles(F_ARTIFACT_REPO)) .place( new DefaultPlaceRequest( "org.guvnor.m2repo.client.perspectives.GuvnorM2RepoPerspective")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.administration()) .withRoles(kieACL.getGrantedRoles(F_ADMINISTRATION)) .place(new DefaultPlaceRequest("AdministrationPerspective")) .endMenu() .build() .getItems() .get(0)); return result; }
boolean hasAccessRightsForFeature(String feature) { Set<String> grantedRoles = kieACL.getGrantedRoles(feature); if (sessionInfo != null && sessionInfo.getIdentity() != null && sessionInfo.getIdentity().getRoles() != null) { for (Role role : sessionInfo.getIdentity().getRoles()) { if (grantedRoles.contains(role.getName())) { return true; } } } return false; }
private List<MenuItem> getDeploymentViews() { final List<MenuItem> result = new ArrayList<MenuItem>(1); result.add( MenuFactory.newSimpleItem(constants.ruleDeployments()) .withRoles(kieACL.getGrantedRoles(F_MANAGEMENT)) .place(new DefaultPlaceRequest("ServerManagementPerspective")) .endMenu() .build() .getItems() .get(0)); return result; }
private List<? extends MenuItem> getProcessMGMTViews() { final List<MenuItem> result = new ArrayList<MenuItem>(2); result.add( MenuFactory.newSimpleItem(constants.Process_Definitions()) .withRoles(kieACL.getGrantedRoles(F_PROCESS_DEFINITIONS)) .place(new DefaultPlaceRequest("Process Definitions")) .endMenu() .build() .getItems() .get(0)); result.add( MenuFactory.newSimpleItem(constants.Process_Instances()) .withRoles(kieACL.getGrantedRoles(F_PROCESS_INSTANCES)) .place(new DefaultPlaceRequest("DataSet Process Instances With Variables")) .endMenu() .build() .getItems() .get(0)); return result; }
private void setSourceEditionGrant() { Set<String> grantedRoles = kieACL.getGrantedRoles(DataModelerFeatures.EDIT_SOURCES); sourceEditionEnabled = false; if (sessionInfo != null && sessionInfo.getIdentity() != null && sessionInfo.getIdentity().getRoles() != null) { for (Role role : sessionInfo.getIdentity().getRoles()) { if (grantedRoles.contains(role.getName())) { sourceEditionEnabled = true; break; } } } }