/** * Deletes a group if possible. * * @param proxy The user management webservice. */ private static void deleteGroup(final UserManagementPortTypeProxy proxy) { final AuthenticationToken token = Settings.getAuthToken(); try { final Group group = proxy.getGroup(GROUP_NAME, token); if (group == null) { LOG.info("Group [name=" + GROUP_NAME + "] not deleted because it does not exist"); } else { proxy.deleteGroup(GROUP_NAME, token); LOG.info( "Group [name=" + group.getName() + ", roles=" + Arrays.toString(group.getRoles()) + ']' + " deleted."); } } catch (final RemoteException e) { LOG.error(null, e); } }
/** * Creates a group if it does not exists already. * * @param proxy The user management webservice. */ private static void createGroups(final UserManagementPortTypeProxy proxy) { final AuthenticationToken token = Settings.getAuthToken(); try { final Group group = proxy.getGroup(GROUP_NAME, token); if (group == null) { final Group newGroup = proxy.createGroup(GROUP_NAME, ROLES, token); LOG.info( "Group [name=" + newGroup.getName() + ", roles=" + Arrays.toString(newGroup.getRoles()) + "] created."); } else { LOG.info( "Group [name=" + group.getName() + ", roles=" + Arrays.toString(group.getRoles()) + "]" + " already exists."); } } catch (final RemoteException e) { LOG.error(null, e); } }