public boolean isGroupCapabilityEnabled(final Capability capability) { if (groupManagerSettings != null) { return isCapabilityEnabled(groupManagerSettings.getCapabilities(), capability); } return false; }
public Collection<String> getConstrainedGroups() { return groupManagerSettings != null ? groupManagerSettings.getConstrainedGroups() : null; }
@Test public void testAllowsEmpty() { assertTrue(groupsManager.getSettings().allowEmpty()); }
@Override public GroupManagerSettings getSettings() { final GroupManager serviceImpl = getService(); final GroupManagerSettings settings = serviceImpl.getSettings(); if (null != settings) { settings.setConstrainedGroups(SecurityManagementUtils.getRegisteredRoleNames()); } return settings; }
@Test public void testAllowsEmpty() { assertTrue(groupsManager.getSettings().allowEmpty()); }
@Test public void testGetConstrainedGroups() { tested.groupManagerSettings = getGroupSettings(); Collection<String> cGroups = new ArrayList<String>(1); cGroups.add("admin"); tested.groupManagerSettings.setConstrainedGroups(cGroups); assertEquals(cGroups, tested.getConstrainedGroups()); }
protected void assignUsers(final Collection<String> users) { assert group != null; final String name = group.getName(); final boolean isEmptyUsersAllowed = userSystemManager.getGroupManagerSettings().allowEmpty(); final boolean isEmpty = users == null || users.isEmpty(); if (!isEmptyUsersAllowed && isEmpty) { showErrorMessage(UsersManagementWidgetsConstants.INSTANCE.groupMustHaveAtLeastOneUser()); showUsersAssignment(name); } else { loadingBox.show(); userSystemManager.groups(new RemoteCallback<Void>() { @Override public void callback(Void o) { loadingBox.hide(); fireUsersAssigned(name); create(); } }, errorCallback).assignUsers(name, users); } }
@Test public void testGetConstrainedGroups() { tested.groupManagerSettings = getGroupSettings(); Collection<String> cGroups = new ArrayList<String>(1); cGroups.add("admin"); tested.groupManagerSettings.setConstrainedGroups(cGroups); assertEquals(cGroups, tested.getConstrainedGroups()); }
public boolean isGroupCapabilityEnabled(final Capability capability) { if (groupManagerSettings != null) { return isCapabilityEnabled(groupManagerSettings.getCapabilities(), capability); } return false; }
public Collection<String> getConstrainedGroups() { return groupManagerSettings != null ? groupManagerSettings.getConstrainedGroups() : null; }
@Test public void testAllowsEmpty() { assertTrue(groupsManager.getSettings().allowEmpty()); }
@Before public void setup() { super.setup(); when(group.getName()).thenReturn("group1"); when(view.setWidget(any(IsWidget.class))).thenReturn(view); when(view.clearNotifications()).thenReturn(view); when(view.setCallback(any(EntityWorkflowView.Callback.class))).thenReturn(view); when(view.setCancelButtonVisible(anyBoolean())).thenReturn(view); when(view.setSaveButtonEnabled(anyBoolean())).thenReturn(view); when(view.setSaveButtonVisible(anyBoolean())).thenReturn(view); when(view.setSaveButtonText(anyString())).thenReturn(view); when(view.showNotification(anyString())).thenReturn(view); when(groupsManagerService.get(anyString())).thenReturn(group); GroupManagerSettings settings = mock(GroupManagerSettings.class); when(settings.allowEmpty()).thenReturn(true); when(userSystemManager.getGroupManagerSettings()).thenReturn(settings); tested = new GroupCreationWorkflow(userSystemManager, errorEvent, confirmBox, loadingBox, workbenchNotification, createEntity, groupUsersAssignment, onCreateGroupEvent, view); }
@Test public void testAllowsEmpty() { assertFalse(groupsPropertiesManager.getSettings().allowEmpty()); }
@Test public void testAllowsEmpty() { assertFalse(groupsPropertiesManager.getSettings().allowEmpty()); }
@Test public void testAllowsEmpty() { assertTrue(groupsManager.getSettings().allowEmpty()); }
protected void assignUsers(final Collection<String> users) { assert group != null; final String name = group.getName(); final boolean isEmptyUsersAllowed = userSystemManager.getGroupManagerSettings().allowEmpty(); final boolean isEmpty = users == null || users.isEmpty(); if (!isEmptyUsersAllowed && isEmpty) { showErrorMessage(UsersManagementWidgetsConstants.INSTANCE.groupMustHaveAtLeastOneUser()); showUsersAssignment(name); } else { loadingBox.show(); userSystemManager.groups(new RemoteCallback<Void>() { @Override public void callback(Void o) { loadingBox.hide(); fireUsersAssigned(name); create(); } }, errorCallback).assignUsers(name, users); } }
@Test public void testAllowsEmpty() { assertFalse(groupsPropertiesManager.getSettings().allowEmpty()); }
@Override public void callback(Group group) { GroupCreationWorkflow.this.group = group; final boolean isEmptyUsersAllowed = userSystemManager.getGroupManagerSettings().allowEmpty(); loadingBox.hide(); if (!isEmptyUsersAllowed) { showUsersAssignment(name); } else { confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(), UsersManagementWidgetsConstants.INSTANCE.assignUsersToGroupName() + " " + name, new Command() { @Override public void execute() { showUsersAssignment(name); } }, new Command() { @Override public void execute() { fireGroupCreated(name); create(); } }); } } },
@Override public void callback(Group group) { GroupCreationWorkflow.this.group = group; final boolean isEmptyUsersAllowed = userSystemManager.getGroupManagerSettings().allowEmpty(); loadingBox.hide(); if (!isEmptyUsersAllowed) { showUsersAssignment(name); } else { confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(), UsersManagementWidgetsConstants.INSTANCE.assignUsersToGroupName() + " " + name, new Command() { @Override public void execute() { showUsersAssignment(name); } }, new Command() { @Override public void execute() { fireGroupCreated(name); create(); } }); } } },