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

Method AddPermissionForUserCtx

rbac_api_context.go:103–105  ·  view source on GitHub ↗

AddPermissionForUserCtx adds a permission for a user or role with context support. Returns false if the user or role already has the permission (aka not affected).

(ctx context.Context, user string, permission ...string)

Source from the content-addressed store, hash-verified

101// AddPermissionForUserCtx adds a permission for a user or role with context support.
102// Returns false if the user or role already has the permission (aka not affected).
103func (e *ContextEnforcer) AddPermissionForUserCtx(ctx context.Context, user string, permission ...string) (bool, error) {
104 return e.AddPolicyCtx(ctx, util.JoinSlice(user, permission...))
105}
106
107// AddPermissionsForUserCtx adds multiple permissions for a user or role with context support.
108// Returns false if the user or role already has one of the permissions (aka not affected).

Callers 1

Calls 2

AddPolicyCtxMethod · 0.95
JoinSliceFunction · 0.92

Tested by 1