GetRolesForUser gets the roles that a user has.
(name string, domain ...string)
| 27 | |
| 28 | // GetRolesForUser gets the roles that a user has. |
| 29 | func (e *Enforcer) GetRolesForUser(name string, domain ...string) ([]string, error) { |
| 30 | rm := e.GetRoleManager() |
| 31 | if rm == nil { |
| 32 | return nil, fmt.Errorf("role manager is not initialized") |
| 33 | } |
| 34 | res, err := rm.GetRoles(name, domain...) |
| 35 | return res, err |
| 36 | } |
| 37 | |
| 38 | // GetUsersForRole gets the users that has a role. |
| 39 | func (e *Enforcer) GetUsersForRole(name string, domain ...string) ([]string, error) { |
no test coverage detected