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
AmbariExceptionpublic User getLocalUser(String userName) throws AmbariException
AmbariExceptionpublic User getLdapUser(String userName) throws AmbariException
AmbariExceptionpublic void modifyPassword(String userName, String currentUserPassword, String newPassword) throws AmbariException
AmbariExceptionpublic void createUser(String userName, String password)
public void removeUser(User user) throws AmbariException
AmbariExceptionpublic void promoteToAdmin(User user) throws AmbariException
AmbariExceptionpublic void demoteAdmin(User user) throws AmbariException
AmbariExceptionpublic void addRoleToUser(User user, String role) throws AmbariException
AmbariExceptionpublic void removeRoleFromUser(User user, String role) throws AmbariException
AmbariExceptionpublic boolean isUserCanBeRemoved(UserEntity userEntity)
public String getUserRole()
public String getAdminRole()
public void createRole(String role)
public void createDefaultRoles()
Copyright © 2016. All rights reserved.