public class UserManager extends Manager
| Modifier and Type | Class and Description |
|---|---|
protected static class |
UserManager.UserManagerSerializableDTO |
Manager.GenericManagerSingletonCreator, Manager.ManagerSingletonCreator| Modifier and Type | Field and Description |
|---|---|
static boolean |
ALLOW_CUSTOMER_ADMIN_DEFAULT |
static java.lang.String |
BEAN_NAME
Identifier of this manager used at core-spring.xml spring configuration.
|
static java.lang.String |
CONFIG_ALLOW_CUSTOMER_ADMIN |
static java.lang.String |
FIELD_NAME
Search property constant denoting the address field name to search in.
|
static java.lang.String |
SEARCH_PATTERN
Search property constant denoting the address field value to search for.
|
| Constructor and Description |
|---|
UserManager() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkBeforeItemRemoval(SessionContext ctx,
Item item)
Avoids call to ejb layer except for
Principals. |
boolean |
checkPassword(User user,
LoginToken token) |
boolean |
checkPassword(User user,
java.lang.String plainPassword) |
Address |
createAddress(Item item)
Creates address for given item.
|
Address |
createAddress(PK pkBase,
Item item)
Creates address for given item.
|
protected Address |
createAddress(PK pkBase,
Item owner,
Address original,
Country country,
Region region,
Title title,
JaloPropertyContainer props) |
Address |
createAddress(PK pkBase,
Item item,
boolean asCopy)
Creates address for given item.
|
Customer |
createCustomer(PK pk,
java.lang.String login)
Creates a new
Customer. |
Customer |
createCustomer(java.lang.String login)
Creates a new
Customer. |
Employee |
createEmployee(PK pk,
java.lang.String login)
Creates a new
Employee. |
Employee |
createEmployee(java.lang.String login)
Creates a new
Employee. |
Title |
createTitle(PK pkBase,
java.lang.String code)
Creates a new
Title. |
Title |
createTitle(java.lang.String code)
Creates a new
Title. |
User |
createUser(PK pk,
java.lang.String uid)
Creates a new
User. |
User |
createUser(PK pkBase,
java.lang.String userID,
ComposedType type)
Creates a new
User with a specified user type. |
User |
createUser(java.lang.String uid)
Creates a new
User. |
UserGroup |
createUserGroup(PK pkBase,
java.lang.String groupId)
Creates a new
UserGroup. |
UserGroup |
createUserGroup(java.lang.String uid)
Creates a new
UserGroup. |
void |
deleteLoginTokenCookie(HttpServletRequest request,
HttpServletResponse response)
Deletes a cookie at given request according to
storeLoginTokenCookie(String, String, String, HttpServletResponse) method. |
protected java.lang.String |
doGenerateLoginTokenCookieValue(java.lang.String uid,
java.lang.String languageISO,
java.lang.String plainTextPassword,
User user) |
java.util.Collection |
findUserGroups(ComposedType type,
java.lang.String groupId,
java.lang.String name,
java.lang.String description)
Searches for specific users groups.
|
java.util.Collection<? extends UserGroup> |
findUserGroups(ComposedType type,
java.lang.String groupId,
java.lang.String name,
java.lang.String description,
boolean disableRestrictions)
Searches for specific users groups.
|
java.util.Collection |
findUsers(ComposedType type,
java.lang.String uid,
java.lang.String name,
java.lang.String description)
Searches for specific users.
|
java.util.Collection<? extends User> |
findUsers(ComposedType type,
java.lang.String uid,
java.lang.String name,
java.lang.String description,
boolean disableRestrictions)
Searches for specific users.
|
java.lang.String |
generateCustomerID()
Generates a new customer ID using the number series with identifier
NumberSeriesConstants.Series#CUSTOMER_ID. |
java.lang.String |
generateLoginTokenCookieValue(java.lang.String uid,
java.lang.String languageISO,
java.lang.String plainTextPassword)
Generates a value entry for a CookieBasedLoginToken instance, which will be used by some web apps (like
printcockpit, hmc, ...) for an 'auto' login process All occurrences if possible should be replace with
generateLoginTokenCookieValue(User, String) |
java.lang.String |
generateLoginTokenCookieValue(User user,
java.lang.String languageISO) |
protected java.lang.String |
getAddressTypeCode() |
Employee |
getAdminEmployee()
Returns the admin employee.
|
UserGroup |
getAdminUserGroup()
Returns the admin user group.
|
java.util.Collection |
getAllAddresses()
Returns all addresses.
|
java.util.Collection |
getAllAddresses(Item owner)
Returns all address of the given owner.
|
java.util.Collection |
getAllCustomers()
Finds all customer users.
|
java.util.Collection |
getAllEmployees()
Finds all employees.
|
java.util.Collection |
getAllPrincipals()
Returns absolute every user and usergroup stored in the system.
|
java.util.Collection |
getAllTitles()
Returns all titles.
|
java.util.Collection |
getAllUserGroups()
Finds all user groups.
|
java.util.Collection |
getAllUsers()
Returns all users (excluding all UserGroups).
|
Customer |
getAnonymousCustomer()
Returns the anonymous customer.
|
CookieBasedLoginToken |
getCookieBasedLoginToken(HttpServletRequest request) |
Customer |
getCustomerByLogin(java.lang.String login)
Find a customer by its login name.
|
protected ComposedType |
getCustomerType() |
Employee |
getEmployeeByLogin(java.lang.String login)
Finds an employee by its login name.
|
protected ComposedType |
getEmployeeType() |
static UserManager |
getInstance()
Gets the instance of this manager.
|
LoginToken |
getLoginToken(HttpServletRequest request)
Tries to get a login token from request.
|
protected PasswordEncoder |
getLoginTokenPasswordEncoder(User user) |
PasswordCheckingStrategy |
getPasswordCheckingStrategy() |
Title |
getTitleByCode(java.lang.String code)
Returns the
Title with the specified code. |
protected java.lang.String |
getTitleTypeCode() |
StringBasedLoginToken |
getURLBasedLoginToken(HttpServletRequest request) |
User |
getUserByLogin(java.lang.String login)
Finds a user by its login name.
|
UserGroup |
getUserGroupByGroupID(java.lang.String groupID)
Finds a user group by its login name.
|
protected java.lang.String |
getUserGroupTypeCode() |
protected java.lang.String |
getUserTypeCode()
Gets the code of the User composed type.
|
void |
init()
called once for each tenant, so this method fits best to perform some initialization stuff
|
boolean |
isAdmin(Customer customer) |
boolean |
isAdmin(Employee employee) |
boolean |
isAdmin(User user) |
static boolean |
isCustomersAllowedAsAdmin() |
protected boolean |
isPlainTextPasswordStored(User user) |
protected void |
notifyItemRemoval(SessionContext ctx,
Item item)
Superclass method overridden to avoid calls to ejb layer.
|
void |
removeItem(Item item) |
void |
setPasswordCheckingStrategy(PasswordCheckingStrategy paramPasswordCheckingStrategy) |
void |
storeLoginTokenCookie(java.lang.String uid,
java.lang.String language,
java.lang.String passwd,
HttpServletResponse response)
Stores given login informations at a cookie of given session.
|
void |
storeLoginTokenCookie(java.lang.String uid,
java.lang.String language,
java.lang.String passwd,
java.lang.String path,
HttpServletResponse response) |
void |
storeLoginTokenCookie(java.lang.String name,
java.lang.String uid,
java.lang.String language,
java.lang.String passwd,
java.lang.String path,
HttpServletResponse response) |
void |
storeLoginTokenCookie(java.lang.String name,
java.lang.String uid,
java.lang.String language,
java.lang.String passwd,
java.lang.String path,
java.lang.String domain,
boolean secure,
int ttl,
HttpServletResponse response) |
java.lang.Object |
writeReplace() |
afterItemCreation, beforeItemCreation, destroy, extractNonRequiredRemoteFromItem, extractRequiredRemoteFromItem, getAllValuesSessionContext, getAttribute, getAttributeMap, getFirstItemByAttribute, getFirstItemByAttribute, getRemote, getRemoteManagerClass, getSession, getSingletonManagerInstance, getTenant, getTransientObject, getTransientObjectMap, setAttribute, setTenant, setTransientObject, wrappublic static final java.lang.String BEAN_NAME
public static final java.lang.String FIELD_NAME
public static final java.lang.String SEARCH_PATTERN
public static final java.lang.String CONFIG_ALLOW_CUSTOMER_ADMIN
public static final boolean ALLOW_CUSTOMER_ADMIN_DEFAULT
public void init()
Managerpublic static UserManager getInstance()
protected void checkBeforeItemRemoval(SessionContext ctx, Item item) throws ConsistencyCheckException
Principals.checkBeforeItemRemoval in class Managerctx - the current session contextitem - the item which should be removedConsistencyCheckException - thrown to abort removal due to consistency errorsprotected void notifyItemRemoval(SessionContext ctx, Item item)
notifyItemRemoval in class Managerctx - the currency session contextitem - the item which is going to be removedprotected java.lang.String getUserTypeCode()
protected java.lang.String getUserGroupTypeCode()
protected java.lang.String getTitleTypeCode()
protected java.lang.String getAddressTypeCode()
protected ComposedType getCustomerType()
protected ComposedType getEmployeeType()
public java.util.Collection getAllUsers()
Collection of all users.public java.util.Collection findUsers(ComposedType type, java.lang.String uid, java.lang.String name, java.lang.String description)
type - The ComposedType which restricts the search or null to search all 'User' typesuid - The uid to search or null to search allname - The name to search or null to search alldescription - The description to search or null to search allpublic java.util.Collection<? extends User> findUsers(ComposedType type, java.lang.String uid, java.lang.String name, java.lang.String description, boolean disableRestrictions)
type - The ComposedType which restricts the search or null to search all 'User' typesuid - The uid to search or null to search allname - The name to search or null to search alldescription - The description to search or null to search alldisableRestrictions - will search restrictions be disabled?public java.util.Collection getAllPrincipals()
Collection of all principals.public java.util.Collection getAllCustomers()
Collection of all customers.public java.util.Collection getAllEmployees()
Collection of all employees.public java.util.Collection getAllUserGroups()
Collection of all user groups.public java.util.Collection findUserGroups(ComposedType type, java.lang.String groupId, java.lang.String name, java.lang.String description)
type - The ComposedType which restricts the search or null to search all 'UserGroup' typesgroupId - The groupid to search or null to search allname - The name to search or null to search alldescription - The description to search or null to search allpublic java.util.Collection<? extends UserGroup> findUserGroups(ComposedType type, java.lang.String groupId, java.lang.String name, java.lang.String description, boolean disableRestrictions)
type - The ComposedType which restricts the search or null to search all 'UserGroup' typesgroupId - The groupid to search or null to search allname - The name to search or null to search alldescription - The description to search or null to search alldisableRestrictions - will search restrictions be disabled?public java.util.Collection getAllTitles()
Collection of all titles.public java.util.Collection getAllAddresses()
Collection of all addresses.public Customer getCustomerByLogin(java.lang.String login) throws JaloItemNotFoundException
Customer with the specified login.JaloItemNotFoundException - if there is no Customer with the specified login.public Employee getEmployeeByLogin(java.lang.String login) throws JaloItemNotFoundException
Employee with the specified login.JaloItemNotFoundException - if there is no Employee with the specified login.public User getUserByLogin(java.lang.String login) throws JaloItemNotFoundException
User with the specified login.JaloItemNotFoundException - if there is no User with the specified login.public UserGroup getUserGroupByGroupID(java.lang.String groupID) throws JaloItemNotFoundException
UserGroup with the specified ID.JaloItemNotFoundException - if there is no UserGroup with the specified ID.public Customer createCustomer(java.lang.String login) throws ConsistencyCheckException
Customer.CustomerConsistencyCheckException - if this login name is already usedpublic Customer createCustomer(PK pk, java.lang.String login) throws ConsistencyCheckException
Customer.pk - the pk for the new item; it will be equipped with type code additionally (CustomerConsistencyCheckException - if this login name is already usedpublic Employee createEmployee(java.lang.String login) throws ConsistencyCheckException
Employee.EmployeeConsistencyCheckException - if this login name is already usedpublic Employee createEmployee(PK pk, java.lang.String login) throws ConsistencyCheckException
Employee.pk - the pk for the new item; it will be equipped with type code additionally (EmployeeConsistencyCheckException - if this login name is already usedpublic UserGroup createUserGroup(java.lang.String uid) throws ConsistencyCheckException
UserGroup.uid - the ID of the new UserGroupUserGroupConsistencyCheckException - if this login name is already usedpublic UserGroup createUserGroup(PK pkBase, java.lang.String groupId) throws ConsistencyCheckException
UserGroup.pkBase - the pk for the new item; it will be equipped with type code additionally (groupId - the ID of the new UserGroupUserGroupConsistencyCheckException - if this login name is already usedpublic User createUser(java.lang.String uid) throws ConsistencyCheckException
User.UserConsistencyCheckException - if this login name is already usedpublic User createUser(PK pk, java.lang.String uid) throws ConsistencyCheckException
User.pk - the pk for the new item; it will be equipped with type code additionally (UserConsistencyCheckException - if this login name is already usedpublic User createUser(PK pkBase, java.lang.String userID, ComposedType type) throws ConsistencyCheckException
User with a specified user type.pkBase - the pk for the new item; it will be equipped with type code additionally (type - the item type of the new user itemUserConsistencyCheckException - if this login name is already usedpublic Title createTitle(java.lang.String code) throws ConsistencyCheckException
Title.code - the code.TitleConsistencyCheckException - if the code is already in use.public Title createTitle(PK pkBase, java.lang.String code) throws ConsistencyCheckException
Title.pkBase - the pk for the new item; it will be equipped with type code additionally (code - the code.TitleConsistencyCheckException - if the code is already in use.public Title getTitleByCode(java.lang.String code) throws JaloItemNotFoundException
Title with the specified code.code - the searched codeTitle with the specified codeJaloItemNotFoundException - if there is no Title with the specified codepublic Employee getAdminEmployee()
JaloInternalException - if admin can not be foundpublic boolean isAdmin(User user)
public boolean isAdmin(Employee employee)
public boolean isAdmin(Customer customer)
public static boolean isCustomersAllowedAsAdmin()
public Customer getAnonymousCustomer()
JaloInternalException - if anonymous can not be foundpublic UserGroup getAdminUserGroup()
public java.util.Collection getAllAddresses(Item owner)
owner - the Item whose addresses will be returned.Collection of all address of the given owner.public Address createAddress(Item item)
item - - for this item address will be createdpublic Address createAddress(PK pkBase, Item item, boolean asCopy)
item - - for this item address will be createdpublic Address createAddress(PK pkBase, Item item)
item - - for this item address will be createdprotected Address createAddress(PK pkBase, Item owner, Address original, Country country, Region region, Title title, JaloPropertyContainer props)
public java.lang.String generateCustomerID()
NumberSeriesConstants.Series#CUSTOMER_ID. This number will be unique in relation to all id's
generated by this method before.public LoginToken getLoginToken(HttpServletRequest request)
public CookieBasedLoginToken getCookieBasedLoginToken(HttpServletRequest request)
public StringBasedLoginToken getURLBasedLoginToken(HttpServletRequest request)
public java.lang.String generateLoginTokenCookieValue(java.lang.String uid,
java.lang.String languageISO,
java.lang.String plainTextPassword)
throws EJBPasswordEncoderNotFoundException
generateLoginTokenCookieValue(User, String)EJBPasswordEncoderNotFoundExceptionpublic java.lang.String generateLoginTokenCookieValue(User user, java.lang.String languageISO) throws EJBPasswordEncoderNotFoundException
EJBPasswordEncoderNotFoundExceptionprotected java.lang.String doGenerateLoginTokenCookieValue(java.lang.String uid,
java.lang.String languageISO,
java.lang.String plainTextPassword,
User user)
throws EJBPasswordEncoderNotFoundException
public void storeLoginTokenCookie(java.lang.String uid,
java.lang.String language,
java.lang.String passwd,
HttpServletResponse response)
throws EJBPasswordEncoderNotFoundException
CookieBasedLoginToken.public void storeLoginTokenCookie(java.lang.String uid,
java.lang.String language,
java.lang.String passwd,
java.lang.String path,
HttpServletResponse response)
throws EJBPasswordEncoderNotFoundException
public void storeLoginTokenCookie(java.lang.String name,
java.lang.String uid,
java.lang.String language,
java.lang.String passwd,
java.lang.String path,
HttpServletResponse response)
throws EJBPasswordEncoderNotFoundException
public void storeLoginTokenCookie(java.lang.String name,
java.lang.String uid,
java.lang.String language,
java.lang.String passwd,
java.lang.String path,
java.lang.String domain,
boolean secure,
int ttl,
HttpServletResponse response)
throws EJBPasswordEncoderNotFoundException
public void deleteLoginTokenCookie(HttpServletRequest request,
HttpServletResponse response)
storeLoginTokenCookie(String, String, String, HttpServletResponse) method.protected boolean isPlainTextPasswordStored(User user)
protected PasswordEncoder getLoginTokenPasswordEncoder(User user) throws EJBPasswordEncoderNotFoundException
public java.lang.Object writeReplace()
throws java.io.ObjectStreamException
writeReplace in class Managerjava.io.ObjectStreamExceptionpublic boolean checkPassword(User user, java.lang.String plainPassword) throws EJBPasswordEncoderNotFoundException
public boolean checkPassword(User user, LoginToken token) throws EJBPasswordEncoderNotFoundException
public void setPasswordCheckingStrategy(PasswordCheckingStrategy paramPasswordCheckingStrategy)
public PasswordCheckingStrategy getPasswordCheckingStrategy()
public void removeItem(Item item) throws ConsistencyCheckException
ConsistencyCheckExceptionCopyright © 2018 SAP SE. All Rights Reserved.