MCPcopy
hub / github.com/apache/casbin / DeletePermissionsForUser

Method DeletePermissionsForUser

rbac_api.go:176–182  ·  view source on GitHub ↗

DeletePermissionsForUser deletes permissions for a user or role. Returns false if the user or role does not have any permissions (aka not affected).

(user string)

Source from the content-addressed store, hash-verified

174// DeletePermissionsForUser deletes permissions for a user or role.
175// Returns false if the user or role does not have any permissions (aka not affected).
176func (e *Enforcer) DeletePermissionsForUser(user string) (bool, error) {
177 subIndex, err := e.GetFieldIndex("p", constant.SubjectIndex)
178 if err != nil {
179 return false, err
180 }
181 return e.RemoveFilteredPolicy(subIndex, user)
182}
183
184// GetPermissionsForUser gets permissions for a user or role.
185func (e *Enforcer) GetPermissionsForUser(user string, domain ...string) ([][]string, error) {

Callers 3

TestPermissionAPIFunction · 0.95
TestCustomizedFieldIndexFunction · 0.95

Calls 2

GetFieldIndexMethod · 0.95
RemoveFilteredPolicyMethod · 0.95

Tested by 3

TestPermissionAPIFunction · 0.76
TestCustomizedFieldIndexFunction · 0.76