Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2014 Philip Helger (www.helger.com) philip[at]helger[dot]com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package com.helger.appbasics.security.usergroup;
 
 import java.util.Map;
 
 
Interface for a user group manager

Author(s):
Philip Helger
 
 public interface IUserGroupManager
 {
  

Returns:
The user group callback list. Never null.
 
   @Nonnull
   @ReturnsMutableObject (reason = "design")
Create a new user group.

Parameters:
sName The name of the user group to create. May neither be null nor empty.
Returns:
The created user group.
 
   @Nonnull
Create a new user group.

Parameters:
sName The name of the user group to create. May neither be null nor empty.
aCustomAttrs A set of custom attributes. May be null.
Returns:
The created user group.
 
   @Nonnull
   IUserGroup createNewUserGroup (@Nonnull @Nonempty String sName, @Nullable Map <String, ?> aCustomAttrs);

  
Create a predefined user group.

Parameters:
sID The ID to use
sName The name of the user group to create. May neither be null nor empty.
Returns:
The created user group.
 
   @Nonnull
Delete the user group with the specified ID

Parameters:
sUserGroupID The ID of the user group to be deleted. May be null.
Returns:
com.helger.commons.state.EChange.CHANGED if the user group was deleted, com.helger.commons.state.EChange.UNCHANGED otherwise
 
   @Nonnull
   EChange deleteUserGroup (@Nullable String sUserGroupID);

  
Check if a user group with the specified ID is contained

Parameters:
sUserGroupID The ID of the user group to check
Returns:
true if no user group exists, false otherwise.
  boolean containsUserGroupWithID (@Nullable String sUserGroupID);

  
Check if all passed user group IDs are contained

Parameters:
aUserGroupIDs The user group IDs to be checked. May be null.
Returns:
true if the collection is empty or if all contained user group IDs are contained
  boolean containsAllUserGroupsWithID (@Nullable Collection <StringaUserGroupIDs);

  
Get the user group with the specified ID

Parameters:
sUserGroupID The ID of the user group to search
Returns:
null if no such user group exists
  IUserGroup getUserGroupOfID (@Nullable String sUserGroupID);

  

Returns:
A non-null list of all user groups
  Collection <? extends IUserGroupgetAllUserGroups ();

  
Rename the user group with the specified ID

Parameters:
sUserGroupID The ID of the user group. May be null.
sNewName The new name of the user group. May neither be null nor empty.
Returns:
com.helger.commons.state.EChange.CHANGED if the user group ID was valid, and the new name was different from the old name
  EChange renameUserGroup (@Nullable String sUserGroupID, @Nonnull @Nonempty String sNewName);

  
Change the modifiable data of a user group

Parameters:
sUserGroupID The ID of the user group. May be null.
sNewName The new name of the user group. May neither be null nor empty.
aNewCustomAttrs Custom attributes. May be null.
Returns:
com.helger.commons.state.EChange
  EChange setUserGroupData (@Nullable String sUserGroupID,
                            @Nonnull @Nonempty String sNewName,
                            @Nullable Map <String, ?> aNewCustomAttrs);

  
Assign the passed user ID to the passed user group.
Note: no validity check must be performed for the user ID

Parameters:
sUserGroupID ID of the user group to assign to
sUserID ID of the user to be assigned.
Returns:
com.helger.commons.state.EChange.CHANGED if the user group ID was valid, and the specified user ID was not already contained.
  EChange assignUserToUserGroup (@Nullable String sUserGroupID, @Nonnull @Nonempty String sUserID);

  
Unassign the specified user ID from the passed user group ID.

Parameters:
sUserGroupID The ID of the user group to unassign the user ID from
sUserID The user ID to be unassigned
Returns:
com.helger.commons.state.EChange.CHANGED if the user group ID was resolved, and the passed user ID was assigned to the user group
  EChange unassignUserFromUserGroup (@Nullable String sUserGroupID, @Nullable String sUserID);

  
Unassign the passed user ID from all user groups.

Parameters:
sUserID ID of the user to be unassigned.
Returns:
com.helger.commons.state.EChange.CHANGED if the passed user ID was at least assigned to one user group.
Check if the passed user is assigned to the specified user group

Parameters:
sUserGroupID ID of the user group to check
sUserID ID of the user to be checked.
Returns:
true if the specified user is assigned to the specified user group.
  boolean isUserAssignedToUserGroup (@Nullable String sUserGroupID, @Nullable String sUserID);

  
Get a collection of all user groups to which a certain user is assigned to.

Parameters:
sUserID The user ID to search
Returns:
A non-nullbut may be empty collection with all matching user groups.
Get a collection of all user group IDs to which a certain user is assigned to.

Parameters:
sUserID The user ID to search
Returns:
A non-nullbut may be empty collection with all matching user group IDs.
Assign the passed role ID to the user group with the passed ID.
Note: the role ID must not be checked for consistency

Parameters:
sUserGroupID The ID of the user group to assign the role to.
sRoleID The ID of the role to be assigned
Returns:
com.helger.commons.state.EChange.CHANGED if the passed user group ID was resolved, and the role ID was not already previously contained
  EChange assignRoleToUserGroup (@Nullable String sUserGroupID, @Nonnull @Nonempty String sRoleID);

  
Unassign the passed role ID from the passed user group ID

Parameters:
sUserGroupID The ID of the user group to unassign the role ID from
sRoleID The role ID to be unassigned.
Returns:
com.helger.commons.state.EChange.CHANGED if the user group ID was resolved and the passed role ID was contained
  EChange unassignRoleFromUserGroup (@Nullable String sUserGroupID, @Nullable String sRoleID);

  
Unassign the passed role ID from existing user groups.

Parameters:
sRoleID The role ID to be unassigned
Returns:
com.helger.commons.state.EChange.CHANGED if the passed role ID was contained in at least one user group
Get a collection of all user groups to which a certain role is assigned to.

Parameters:
sRoleID The role ID to search
Returns:
A non-nullbut may be empty collection with all matching user groups.
Get a collection of all user group IDs to which a certain role is assigned to.

Parameters:
sRoleID The role ID to search
Returns:
A non-nullbut may be empty collection with all matching user group IDs.
New to GrepCode? Check out our FAQ X