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

Method GetImplicitRolesForUser

rbac_api_synced.go:155–159  ·  view source on GitHub ↗

GetImplicitRolesForUser gets implicit roles that a user has. Compared to GetRolesForUser(), this function retrieves indirect roles besides direct roles. For example: g, alice, role:admin g, role:admin, role:user GetRolesForUser("alice") can only get: ["role:admin"]. But GetImplicitRolesForUser("ali

(name string, domain ...string)

Source from the content-addressed store, hash-verified

153// GetRolesForUser("alice") can only get: ["role:admin"].
154// But GetImplicitRolesForUser("alice") will get: ["role:admin", "role:user"].
155func (e *SyncedEnforcer) GetImplicitRolesForUser(name string, domain ...string) ([]string, error) {
156 e.m.RLock()
157 defer e.m.RUnlock()
158 return e.Enforcer.GetImplicitRolesForUser(name, domain...)
159}
160
161// GetImplicitPermissionsForUser gets implicit permissions for a user or role.
162// Compared to GetPermissionsForUser(), this function retrieves permissions for inherited roles.

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected