public class Users extends Object
Modifier and Type | Field and Description |
---|---|
protected Configuration |
configuration |
protected org.springframework.security.crypto.password.PasswordEncoder |
passwordEncoder |
protected RoleDAO |
roleDAO |
protected UserDAO |
userDAO |
Constructor and Description |
---|
Users() |
Modifier and Type | Method and Description |
---|---|
void |
addRoleToUser(User user,
String role) |
void |
createDefaultRoles()
Creates ADMIN adn USER roles if not present
|
void |
createRole(String role)
Creates new role
|
void |
createUser(String userName,
String password)
Creates new local user with provided userName and password
|
void |
demoteAdmin(User user)
Removes ADMIN role form provided user
|
String |
getAdminRole() |
List<User> |
getAllUsers() |
User |
getAnyUser(String userName) |
User |
getLdapUser(String userName) |
User |
getLocalUser(String userName) |
User |
getUser(int userId) |
String |
getUserRole() |
boolean |
isUserCanBeRemoved(UserEntity userEntity) |
void |
modifyPassword(String userName,
String currentUserPassword,
String newPassword)
Modifies password of local user
|
void |
promoteToAdmin(User user)
Grants ADMIN role to provided user
|
void |
removeRoleFromUser(User user,
String role) |
void |
removeUser(User user) |
@Inject protected UserDAO userDAO
@Inject protected RoleDAO roleDAO
@Inject protected org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
@Inject protected Configuration configuration
public User getUser(int userId) throws AmbariException
AmbariException
public User getLocalUser(String userName) throws AmbariException
AmbariException
public User getLdapUser(String userName) throws AmbariException
AmbariException
public void modifyPassword(String userName, String currentUserPassword, String newPassword) throws AmbariException
AmbariException
public void createUser(String userName, String password)
public void removeUser(User user) throws AmbariException
AmbariException
public void promoteToAdmin(User user) throws AmbariException
AmbariException
public void demoteAdmin(User user) throws AmbariException
AmbariException
public void addRoleToUser(User user, String role) throws AmbariException
AmbariException
public void removeRoleFromUser(User user, String role) throws AmbariException
AmbariException
public boolean isUserCanBeRemoved(UserEntity userEntity)
public String getUserRole()
public String getAdminRole()
public void createRole(String role)
public void createDefaultRoles()
Copyright © 2015. All rights reserved.