@Test public void checkCanCreateWhenFeatureDisabled() { when(authorizationManagerMock.authorize(any(ResourceRef.class), eq(ResourceAction.READ), eq(userMock))).thenReturn(false); assertFalse(handler.canCreate()); assertResourceRef(); }
@Override public boolean canCreate() { return authorizationManager.authorize(new ResourceRef(ScenarioSimulationEditorPresenter.IDENTIFIER, ActivityResourceType.EDITOR), ResourceAction.READ, sessionInfo.getIdentity()); }
NewScenarioSimulationHandler extends DefaultNewResourceHandler { @Override public boolean canCreate() { return authorizationManager.authorize(new ResourceRef(ScenarioSimulationEditorPresenter.IDENTIFIER, ActivityResourceType.EDITOR), ResourceAction.READ, sessionInfo.getIdentity()); } }
NewScenarioSimulationHandler extends DefaultNewResourceHandler { @Override public boolean canCreate() { return authorizationManager.authorize(new ResourceRef(ScenarioSimulationEditorPresenter.IDENTIFIER, ActivityResourceType.EDITOR), ResourceAction.READ, sessionInfo.getIdentity()); } @Inject  NewScenarioSimulationHandler(final ScenarioSimulationResourceType resourceType,
                                        final BusyIndicatorView busyIndicatorView,
                                        final Event<NotificationEvent> notificationEvent,
                                        final Event<NewResourceSuccessEvent> newResourceSuccessEvent,
                                        final PlaceManager placeManager,
                                        final Caller<ScenarioSimulationService> scenarioSimulationService,
                                        final AuthorizationManager authorizationManager,
                                        final SessionInfo sessionInfo,
                                        @Named(ScenarioSimulationDropdown.BEAN_NAME) final ScenarioSimulationDropdown scenarioSimulationDropdown); }
NewScenarioSimulationHandler extends DefaultNewResourceHandler { @Override public boolean canCreate() { return authorizationManager.authorize(new ResourceRef(ScenarioSimulationEditorPresenter.IDENTIFIER, ActivityResourceType.EDITOR), ResourceAction.READ, sessionInfo.getIdentity()); } @Inject  NewScenarioSimulationHandler(final ScenarioSimulationResourceType resourceType,
                                        final BusyIndicatorView busyIndicatorView,
                                        final Event<NotificationEvent> notificationEvent,
                                        final Event<NewResourceSuccessEvent> newResourceSuccessEvent,
                                        final PlaceManager placeManager,
                                        final Caller<ScenarioSimulationService> scenarioSimulationService,
                                        final AuthorizationManager authorizationManager,
                                        final SessionInfo sessionInfo,
                                        @Named(ScenarioSimulationDropdown.BEAN_NAME) final ScenarioSimulationDropdown scenarioSimulationDropdown); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override boolean canCreate(); @Override Command getCommand(final NewResourcePresenter newResourcePresenter); @Override void create(final Package pkg,
                       final String baseFileName,
                       final NewResourcePresenter presenter); @PostConstruct void setupExtensions(); }
NewScenarioSimulationHandler extends DefaultNewResourceHandler { @Override public boolean canCreate() { return authorizationManager.authorize(new ResourceRef(ScenarioSimulationEditorPresenter.IDENTIFIER, ActivityResourceType.EDITOR), ResourceAction.READ, sessionInfo.getIdentity()); } @Inject  NewScenarioSimulationHandler(final ScenarioSimulationResourceType resourceType,
                                        final BusyIndicatorView busyIndicatorView,
                                        final Event<NotificationEvent> notificationEvent,
                                        final Event<NewResourceSuccessEvent> newResourceSuccessEvent,
                                        final PlaceManager placeManager,
                                        final Caller<ScenarioSimulationService> scenarioSimulationService,
                                        final AuthorizationManager authorizationManager,
                                        final SessionInfo sessionInfo,
                                        @Named(ScenarioSimulationDropdown.BEAN_NAME) final ScenarioSimulationDropdown scenarioSimulationDropdown); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override boolean canCreate(); @Override Command getCommand(final NewResourcePresenter newResourcePresenter); @Override void create(final Package pkg,
                       final String baseFileName,
                       final NewResourcePresenter presenter); @PostConstruct void setupExtensions();  }