MCPcopy Index your code
hub / github.com/apache/casbin / GetRolesForUser

Method GetRolesForUser

rbac_api.go:29–36  ·  view source on GitHub ↗

GetRolesForUser gets the roles that a user has.

(name string, domain ...string)

Source from the content-addressed store, hash-verified

27
28// GetRolesForUser gets the roles that a user has.
29func (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.
39func (e *Enforcer) GetUsersForRole(name string, domain ...string) ([]string, error) {

Callers 1

HasRoleForUserMethod · 0.95

Calls 2

GetRoleManagerMethod · 0.95
GetRolesMethod · 0.65

Tested by

no test coverage detected