ProcessDefinitionListPresenter extends AbstractMultiGridPresenter<ProcessSummary, ProcessDefinitionListPresenter.ProcessDefinitionListView> { public boolean isUserAuthorizedForPerspective(final String perspectiveId) { final ResourceRef resourceRef = new ResourceRef(perspectiveId, ActivityResourceType.PERSPECTIVE); return authorizationManager.authorize(resourceRef, identity); } ProcessDefinitionListPresenter(); @Inject void setAuthorizationManager(final AuthorizationManager authorizationManager); @Inject void setProcessDefinitionListBasicFiltersPresenter(final ProcessDefinitionListBasicFiltersPresenter processDefinitionListBasicFiltersPresenter); @Override void setupActiveSearchFilters(); @Override boolean existActiveSearchFilters(); @Override void createListBreadcrumb(); void setupDetailBreadcrumb(String detailLabel); void openGenericForm(final String processDefId,
                                final String deploymentId,
                                final String processDefName,
                                final boolean isDynamic); @Inject void setFilterSettingsManager(final ProcessDefinitionListFilterSettingsManager filterSettingsManager); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); void refreshNewProcessInstance(@Observes NewProcessInstanceEvent newProcessInstance); void refreshNewCaseInstance(@Observes NewCaseInstanceEvent newCaseInstance); Predicate<ProcessSummary> getViewProcessInstanceActionCondition(); Predicate<ProcessSummary> getStartCondition(); void viewProcessInstances(String processDefId); boolean isUserAuthorizedForPerspective(final String perspectiveId); @Inject void setProcessRuntimeDataService(final Caller<ProcessRuntimeDataService> processRuntimeDataService);  }
@Test public void testIsAuthorizedForView() { String perspectiveId = PROCESS_INSTANCES; when(authorizationManager.authorize(any(ResourceRef.class), eq(identity))).thenReturn(true, false); assertTrue(presenter.isUserAuthorizedForPerspective(perspectiveId)); final ArgumentCaptor<ResourceRef> captor = ArgumentCaptor.forClass(ResourceRef.class); verify(authorizationManager).authorize(captor.capture(), eq(identity)); assertEquals(perspectiveId, captor.getValue().getIdentifier()); assertEquals(ActivityResourceType.PERSPECTIVE, captor.getValue().getResourceType()); assertFalse(presenter.isUserAuthorizedForPerspective(perspectiveId)); }