public static Group createGroup(final String name) { if (name == null) { return null; } return new GroupImpl(name); }
public Group createGroup(final String name) { if (name == null) { return null; } return new GroupImpl(name); }
public Group createGroup(final String name) { if (name == null) { return null; } return new GroupImpl(name); }
private Group getGroup(String groupName) { Group group = groupMap.get(groupName); if (group == null) { group = new GroupImpl(groupName); groupMap.put(groupName, group); } return group; }
private Group getGroup(String groupName) { Group group = groupMap.get(groupName); if (group == null) { group = new GroupImpl(groupName); groupMap.put(groupName, group); } return group; }
public AuthorizationPolicyBuilder group(String group) { _currentRole = null; _currentGroup = groups.get(group); if (_currentGroup == null) { groups.put(group, _currentGroup = new GroupImpl(group)); } return this; }
public AuthorizationPolicyBuilder group(String group) { _currentRole = null; _currentGroup = groups.get(group); if (_currentGroup == null) { groups.put(group, _currentGroup = new GroupImpl(group)); } return this; }
/** * Wildfly / EAP realms based on properties do not allow groups with empty users. So the groups are created using the method #assignUsers. * @param entity The entity to create. * @return A runtime instance for a group. * @throws SecurityManagementException */ @Override public Group create(Group entity) throws SecurityManagementException { if (entity == null) { throw new NullPointerException(); } return new GroupImpl(entity.getName()); }
/** * WildFly / EAP realms based on properties do not allow groups with empty users. So the groups are created using the method #assignUsers. * * @param entity The entity to create. * @return A runtime instance for a group. * @throws SecurityManagementException */ @Override public Group create( Group entity ) throws SecurityManagementException { if (entity == null) throw new NullPointerException(); return new GroupImpl( entity.getName() ); }
/** * Wildfly / EAP realms based on properties do not allow groups with empty users. So the groups are created using the method #assignUsers. * @param entity The entity to create. * @return A runtime instance for a group. * @throws SecurityManagementException */ @Override public Group create(Group entity) throws SecurityManagementException { if (entity == null) { throw new NullPointerException(); } return new GroupImpl(entity.getName()); }
public boolean flush() { assert this.isEditMode; this.isFlushed = true; groupEditor.flush(); // Obtain the editor's values final String name = groupEditor.name(); // Create a new resulting instance group = new GroupImpl(name); // Validate the instance and set delegate violations, if any, to the editors hierarchy. Set<ConstraintViolation<Group>> violations = userSystemManager.groupsValidator().validate(group); groupEditor.setViolations(violations); return violations == null || violations.isEmpty(); }
public boolean flush() { assert this.isEditMode; this.isFlushed = true; groupEditor.flush(); // Obtain the editor's values final String name = groupEditor.name(); // Create a new resulting instance group = new GroupImpl(name); // Validate the instance and set delegate violations, if any, to the editors hierarchy. Set<ConstraintViolation<Group>> violations = userSystemManager.groupsValidator().validate(group); groupEditor.setViolations(violations); return violations == null || violations.isEmpty(); }
private void assertGroupsForUser(Set<Group> groupsSet, String[] groups) { assertNotNull(groupsSet); assertEquals(groupsSet.size(), groups.length); int x = 0; for (Group g : groupsSet) { String gName = groups[x]; assertTrue(groupsSet.contains(new GroupImpl(gName))); x++; } }
private void assertGroupsForUser(Set<Group> groupsSet, String[] groups) { assertNotNull(groupsSet); assertEquals(groupsSet.size(), groups.length); int x = 0; for (Group g : groupsSet) { String gName = groups[x]; assertTrue(groupsSet.contains(new GroupImpl(gName))); x++; } } }
private void assertGroupsForUser(Set<Group> groupsSet, String[] groups) { assertNotNull(groupsSet); assertEquals(groupsSet.size(), groups.length); int x = 0; for (Group g : groupsSet) { String gName = groups[x]; assertTrue(groupsSet.contains(new GroupImpl(gName))); x++; } } }
@Test public void testEditGroup() { presenter.edit(new GroupImpl("group1")); verify(view).setHomePerspectiveSelectorEnabled(true); verify(view).setPrioritySelectorEnabled(true); verify(view).setHomePerspectiveSelector(any()); verify(view).setPrioritySelector(any()); verify(homePerspectiveDropDown).setSelectedPerspective("HomeGroup1"); verify(priorityDropDown).setSelectedPriority(DEFAULT_PRIORITY); }
@Test public void testShowGroup() { presenter.show(new GroupImpl("group1")); verify(view).setHomePerspectiveSelectorEnabled(false); verify(view).setPrioritySelectorEnabled(false); verify(view).setHomePerspectiveSelector(any()); verify(view).setPrioritySelector(any()); verify(view).setHomePerspectiveName("HomeGroup1"); verify(view).setHomePerspectiveTitle("HomeGroup1"); verify(view).setPriorityName("Very Low"); }
@Test public void testOnOnUserGroupsUpdatedEvent() { OnUpdateUserGroupsEvent onUpdateUserGroupsEvent = mock(OnUpdateUserGroupsEvent.class); when(onUpdateUserGroupsEvent.getContext()).thenReturn(userAssignedGroupsEditor); final Set<Group> explorerGroups = new HashSet<Group>(); when(userAssignedGroupsExplorer.getValue()).thenReturn(explorerGroups); final Set<Group> groups = new HashSet<Group>(); groups.add(new GroupImpl("group1")); when(userAssignedGroupsEditor.getValue()).thenReturn(groups); presenter.onOnUserGroupsUpdatedEvent(onUpdateUserGroupsEvent); assertEquals(groups, userAssignedGroupsExplorer.getValue()); verify(userAssignedGroupsEditor, times(1)).flush(); verify(userAssignedGroupsExplorer, times(1)).doShow(); assertNoViewCalls(); }
@Test public void testResolvePermissionsCustomDeniedOverDefaultGranted() { final VotingStrategy priority = VotingStrategy.PRIORITY; final Role businessUserRole = new RoleImpl("business-user"); final Group directorGroup = new GroupImpl("director"); // Users have a group with their names by default final User user = makeUser("director", directorGroup, businessUserRole); mockDefaultPermissions(authorizationPolicy, makeGrantedPermissionCollection()); mockRolePermissions(authorizationPolicy, makeDeniedPermissionCollection(), businessUserRole, 0); mockDefaultGroupPermissions(authorizationPolicy, makeGrantedPermissionCollection(), directorGroup); final PermissionCollection resolvedPermission = defaultPermissionManager.resolvePermissions(user, priority); final Permission permission = resolvedPermission.get(PERMISSION_NAME); assertEquals(AuthorizationResult.ACCESS_DENIED, permission.getResult()); }
@Test public void testResolvePermissionsCustomDeniedOverDefaultGranted() { final VotingStrategy priority = VotingStrategy.PRIORITY; final Role businessUserRole = new RoleImpl("business-user"); final Group directorGroup = new GroupImpl("director"); // Users have a group with their names by default final User user = makeUser("director", directorGroup, businessUserRole); mockDefaultPermissions(authorizationPolicy, makeGrantedPermissionCollection()); mockRolePermissions(authorizationPolicy, makeDeniedPermissionCollection(), businessUserRole, 0); mockDefaultGroupPermissions(authorizationPolicy, makeGrantedPermissionCollection(), directorGroup); final PermissionCollection resolvedPermission = defaultPermissionManager.resolvePermissions(user, priority); final Permission permission = resolvedPermission.get(PERMISSION_NAME); assertEquals(AuthorizationResult.ACCESS_DENIED, permission.getResult()); }