AddPermissionsForUserCtx adds multiple permissions for a user or role with context support. Returns false if the user or role already has one of the permissions (aka not affected).
(ctx context.Context, user string, permissions ...[]string)
| 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). |
| 109 | func (e *ContextEnforcer) AddPermissionsForUserCtx(ctx context.Context, user string, permissions ...[]string) (bool, error) { |
| 110 | var rules [][]string |
| 111 | for _, permission := range permissions { |
| 112 | rules = append(rules, util.JoinSlice(user, permission...)) |
| 113 | } |
| 114 | return e.AddPoliciesCtx(ctx, rules) |
| 115 | } |
| 116 | |
| 117 | // DeletePermissionForUserCtx deletes a permission for a user or role with context support. |
| 118 | // Returns false if the user or role does not have the permission (aka not affected). |
nothing calls this directly
no test coverage detected