-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
80 lines (58 loc) · 3.39 KB
/
Copy patherrors.go
File metadata and controls
80 lines (58 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package warden
import (
"errors"
"github.com/xraph/warden/wardenerr"
)
var (
// ErrAccessDenied is returned when an authorization check fails.
ErrAccessDenied = errors.New("warden: access denied")
// ErrRoleNotFound is returned when a role cannot be found.
ErrRoleNotFound = errors.New("warden: role not found")
// ErrPermissionNotFound is returned when a permission cannot be found.
ErrPermissionNotFound = errors.New("warden: permission not found")
// ErrAssignmentNotFound is returned when an assignment cannot be found.
ErrAssignmentNotFound = errors.New("warden: assignment not found")
// ErrPolicyNotFound is returned when a policy cannot be found.
ErrPolicyNotFound = errors.New("warden: policy not found")
// ErrRelationNotFound is returned when a relation tuple cannot be found.
ErrRelationNotFound = errors.New("warden: relation not found")
// ErrResourceTypeNotFound is returned when a resource type cannot be found.
ErrResourceTypeNotFound = errors.New("warden: resource type not found")
// ErrSystemRoleImmutable is returned when trying to modify a system role.
ErrSystemRoleImmutable = errors.New("warden: system role cannot be modified")
// ErrSystemPermissionImmutable is returned when trying to modify a system permission.
ErrSystemPermissionImmutable = errors.New("warden: system permission cannot be modified")
// ErrAlreadyExists is the common base error for entity-uniqueness
// violations. Use errors.Is(err, ErrAlreadyExists) to match any of the
// specialized ErrDuplicate* errors below.
//
// Defined in wardenerr so that low-level subpackages (e.g. store/memory)
// can return typed duplicate errors without an import cycle.
ErrAlreadyExists = wardenerr.ErrAlreadyExists
// ErrDuplicateRole is returned when a role would violate the
// (tenant_id, namespace_path, slug) uniqueness constraint.
ErrDuplicateRole = wardenerr.ErrDuplicateRole
// ErrDuplicatePermission is returned when a permission would violate the
// (tenant_id, namespace_path, name) uniqueness constraint.
ErrDuplicatePermission = wardenerr.ErrDuplicatePermission
// ErrDuplicatePolicy is returned when a policy would violate the
// (tenant_id, namespace_path, name) uniqueness constraint.
ErrDuplicatePolicy = wardenerr.ErrDuplicatePolicy
// ErrDuplicateResourceType is returned when a resource type would violate
// the (tenant_id, namespace_path, name) uniqueness constraint.
ErrDuplicateResourceType = wardenerr.ErrDuplicateResourceType
// ErrDuplicateAssignment is returned when a role is already assigned to a
// subject within the same scope. Wraps ErrAlreadyExists.
ErrDuplicateAssignment = wardenerr.ErrDuplicateAssignment
// ErrDuplicateRelation is returned when a relation tuple already exists.
// Wraps ErrAlreadyExists.
ErrDuplicateRelation = wardenerr.ErrDuplicateRelation
// ErrCyclicRoleInheritance is returned when role inheritance would create a cycle.
ErrCyclicRoleInheritance = errors.New("warden: cyclic role inheritance detected")
// ErrMaxMembersExceeded is returned when a role's member limit is reached.
ErrMaxMembersExceeded = errors.New("warden: role max members exceeded")
// ErrInvalidCondition is returned when a policy condition is malformed.
ErrInvalidCondition = errors.New("warden: invalid policy condition")
// ErrGraphDepthExceeded is returned when the relation graph walk exceeds max depth.
ErrGraphDepthExceeded = errors.New("warden: relation graph depth exceeded")
)