Repository navigation
Expand file tree
/
Copy patherrors.go
More file actions
124 lines (95 loc) · 5.51 KB
/
Copy patherrors.go
File metadata and controls
124 lines (95 loc) · 5.51 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package warden
import (
"errors"
"github.com/xraph/warden/wardenerr"
)
var (
// ErrAccessDenied is returned when an authorization check fails.
ErrAccessDenied = errors.New("warden: access denied")
// ErrNotFound is the common base error for the missing-entity errors
// below. Use errors.Is(err, ErrNotFound) to match any of them.
//
// Defined in wardenerr so that low-level subpackages (e.g. store/memory)
// can return typed not-found errors without an import cycle.
ErrNotFound = wardenerr.ErrNotFound
// ErrRoleNotFound is returned when a role cannot be found in the tenant.
// Every store returns this for a by-ID lookup whose tenant does not own
// the row, so a caller cannot distinguish "no such role" from "that role
// belongs to someone else".
ErrRoleNotFound = wardenerr.ErrRoleNotFound
// ErrPermissionNotFound is returned when a permission cannot be found in the tenant.
ErrPermissionNotFound = wardenerr.ErrPermissionNotFound
// ErrAssignmentNotFound is returned when an assignment cannot be found in the tenant.
ErrAssignmentNotFound = wardenerr.ErrAssignmentNotFound
// ErrPolicyNotFound is returned when a policy cannot be found in the tenant.
ErrPolicyNotFound = wardenerr.ErrPolicyNotFound
// ErrStaleWrite is the common base error for a conditional write that
// found the record changed since the caller read it. Use
// errors.Is(err, ErrStaleWrite) to match any of the specialized
// conflict errors, such as ErrPolicyVersionConflict.
ErrStaleWrite = wardenerr.ErrStaleWrite
// ErrPolicyVersionConflict is returned by UpdatePolicyIfVersion when the
// stored policy's version is not the one the caller expected. Nothing is
// written. Wraps ErrStaleWrite.
ErrPolicyVersionConflict = wardenerr.ErrPolicyVersionConflict
// ErrRelationNotFound is returned when a relation tuple cannot be found in the tenant.
ErrRelationNotFound = wardenerr.ErrRelationNotFound
// ErrResourceTypeNotFound is returned when a resource type cannot be found in the tenant.
ErrResourceTypeNotFound = wardenerr.ErrResourceTypeNotFound
// ErrCheckLogNotFound is returned when a check log entry cannot be found in the tenant.
ErrCheckLogNotFound = wardenerr.ErrCheckLogNotFound
// ErrSystemRoleImmutable is returned when a write would change or
// delete a system role. role.CheckWritable returns an error that wraps
// it. Defined in wardenerr so the role package can wrap it.
ErrSystemRoleImmutable = wardenerr.ErrSystemRoleImmutable
// ErrSystemPermissionImmutable is returned when a write would change or
// delete a system permission. permission.CheckWritable returns an error
// that wraps it. Defined in wardenerr so the permission package can wrap
// it.
ErrSystemPermissionImmutable = wardenerr.ErrSystemPermissionImmutable
// 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 a role's parent would make
// the role its own ancestor. role.CheckParent returns an error that
// wraps it. Defined in wardenerr so the role package can wrap it.
ErrCyclicRoleInheritance = wardenerr.ErrCyclicRoleInheritance
// 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")
// ErrTenantRequired is returned by Check when the resolved scope has no
// tenant ID and Config.RequireTenant is true (the default), and by
// RunTenantMaintenance when it is given no tenant.
ErrTenantRequired = wardenerr.ErrTenantRequired
// ErrGraphBudgetExceeded is returned when a ReBAC graph traversal
// exceeds its configured visited-node or fan-out budget.
ErrGraphBudgetExceeded = errors.New("warden: graph traversal budget exceeded")
// ErrUnauthenticated is returned when a check cannot proceed because no
// subject/actor identity is available.
ErrUnauthenticated = errors.New("warden: unauthenticated")
)