MCPcopy Index your code
hub / github.com/coder/coder / ValidAction

Method ValidAction

coderd/rbac/object.go:65–75  ·  view source on GitHub ↗

ValidAction checks if the action is valid for the given object type.

(action policy.Action)

Source from the content-addressed store, hash-verified

63
64// ValidAction checks if the action is valid for the given object type.
65func (z Object) ValidAction(action policy.Action) error {
66 perms, ok := policy.RBACPermissions[z.Type]
67 if !ok {
68 return xerrors.Errorf("invalid type %q", z.Type)
69 }
70 if _, ok := perms.Actions[action]; !ok {
71 return xerrors.Errorf("invalid action %q for type %q", action, z.Type)
72 }
73
74 return nil
75}
76
77// AvailableActions returns all available actions for a given object.
78// Wildcard is omitted.

Callers 2

TestRolePermissionsFunction · 0.80
AuthorizeMethod · 0.80

Calls 1

ErrorfMethod · 0.45

Tested by 1

TestRolePermissionsFunction · 0.64