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.user;
 
 import java.util.Map;
 
 
Interface for a user manager

Author(s):
Philip Helger
 
 public interface IUserManager
 {
  

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

Parameters:
sLoginName Login name of the user. May neither be null nor empty.This login name must be unique over all existing users.
sEmailAddress The email address. May be null.
sPlainTextPassword The plain text password to be used. May neither be null nor empty.
sFirstName The users first name. May be null.
sLastName The users last name. May be null.
aDesiredLocale The users default locale. May be null.
aCustomAttrs Custom attributes. May be null.
bDisabled true if the user is disabled
Returns:
The created user or null if another user with the same email address is already present.
 
   @Nullable
   IUser createNewUser (@Nonnull @Nonempty String sLoginName,
                        @Nullable String sEmailAddress,
                        @Nonnull String sPlainTextPassword,
                        @Nullable String sFirstName,
                        @Nullable String sLastName,
                        @Nullable Locale aDesiredLocale,
                        @Nullable Map <String, ?> aCustomAttrs,
                        boolean bDisabled);

  
Create a predefined user.

Parameters:
sID The ID to use
sLoginName Login name of the user. May neither be null nor empty. This login name must be unique over all existing users.
sEmailAddress The email address. May be null.
sPlainTextPassword The plain text password to be used. May neither be null nor empty.
sFirstName The users first name. May be null.
sLastName The users last name. May be null.
aDesiredLocale The users default locale. May be null.
aCustomAttrs Custom attributes. May be null.
bDisabled true if the user is disabled
Returns:
The created user or null if another user with the same email address is already present.
                              @Nonnull @Nonempty String sLoginName,
                              @Nullable String sEmailAddress,
                              @Nonnull String sPlainTextPassword,
                              @Nullable String sFirstName,
                              @Nullable String sLastName,
                              @Nullable Locale aDesiredLocale,
                              @Nullable Map <String, ?> aCustomAttrs,
                              boolean bDisabled);

  
Change the modifiable data of a user

Parameters:
sUserID The ID of the user to be modified. May be null.
sNewLoginName The new login name. May not be null.
sNewEmailAddress The new email address. May be null.
sNewFirstName The new first name. May be null.
sNewLastName The new last name. May be null.
aNewDesiredLocale The new desired locale. May be null.
aNewCustomAttrs Custom attributes. May be null.
bNewDisabled true if the user is disabled
Returns:
com.helger.commons.state.EChange
                       @Nonnull @Nonempty String sNewLoginName,
                       @Nullable String sNewEmailAddress,
                       @Nullable String sNewFirstName,
                       @Nullable String sNewLastName,
                       @Nullable Locale aNewDesiredLocale,
                       @Nullable Map <String, ?> aNewCustomAttrs,
                       boolean bNewDisabled);

  
Change the modifiable data of a user

Parameters:
sUserID The ID of the user to be modified. May be null.
sNewPlainTextPassword The new password in plain text. May not be null.
Returns:
com.helger.commons.state.EChange
  EChange setUserPassword (@Nullable String sUserID, @Nonnull String sNewPlainTextPassword);

  
Delete the user with the specified ID.

Parameters:
sUserID The ID of the user to delete
Returns:
com.helger.commons.state.EChange.CHANGED if the user was deleted, com.helger.commons.state.EChange.UNCHANGED otherwise.
  EChange deleteUser (@Nullable String sUserID);

  
Undelete the user with the specified ID.

Parameters:
sUserID The ID of the user to undelete
Returns:
com.helger.commons.state.EChange.CHANGED if the user was undeleted, com.helger.commons.state.EChange.UNCHANGED otherwise.
  EChange undeleteUser (@Nullable String sUserID);

  
disable the user with the specified ID.

Parameters:
sUserID The ID of the user to disable
Returns:
com.helger.commons.state.EChange.CHANGED if the user was disabled, com.helger.commons.state.EChange.UNCHANGED otherwise.
  EChange disableUser (@Nullable String sUserID);

  
Enable the user with the specified ID.

Parameters:
sUserID The ID of the user to enable
Returns:
com.helger.commons.state.EChange.CHANGED if the user was enabled, com.helger.commons.state.EChange.UNCHANGED otherwise.
  EChange enableUser (@Nullable String sUserID);

  
Check if the passed combination of user ID and password matches.

Parameters:
sUserID The ID of the user
sPlainTextPassword The plan text password to validate.
Returns:
true if the password hash matches the stored hash for the specified user, false otherwise.
  boolean areUserIDAndPasswordValid (@Nullable String sUserID, @Nullable String sPlainTextPassword);

  
Check if a user with the specified ID is present.

Parameters:
sUserID The user ID to resolve. May be null.
Returns:
true if such user exists, false otherwise.
  boolean containsUserWithID (@Nullable String sUserID);

  
Get the user with the specified ID.

Parameters:
sUserID The user ID to resolve. May be null.
Returns:
null if no such user exists
  IUser getUserOfID (@Nullable String sUserID);

  
Get the user with the specified login name

Parameters:
sLoginName The login name to be checked. May be null.
Returns:
null if no such user exists
  IUser getUserOfLoginName (@Nullable String sLoginName);

  
Get the user with the specified email address

Parameters:
sEmailAddress The email address to be checked. May be null.
Returns:
null if no such user exists
  IUser getUserOfEmailAddress (@Nullable String sEmailAddress);

  

Returns:
A non-null collection of all contained users (enabled+disabled and deleted+not-deleted)
  Collection <? extends IUsergetAllUsers ();

  

Returns:
A non-null collection of all contained enabled and not-deleted users
  Collection <? extends IUsergetAllActiveUsers ();

  

Returns:
A non-null collection of all contained disabled and not-deleted users
  Collection <? extends IUsergetAllDisabledUsers ();

  

Returns:
A non-null collection of all contained not deleted users
  Collection <? extends IUsergetAllNotDeletedUsers ();

  

Returns:
A non-null collection of all contained deleted users
  Collection <? extends IUsergetAllDeletedUsers ();
New to GrepCode? Check out our FAQ X