mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
acl: Adding IsManagement check
This commit is contained in:
@@ -204,3 +204,8 @@ func (a *ACL) AllowOperatorWrite() bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// IsManagement checks if this represents a management token
|
||||
func (a *ACL) IsManagement() bool {
|
||||
return a.management
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ func TestACLManagement(t *testing.T) {
|
||||
assert.Equal(t, true, acl.AllowNamespaceOperation("foo", NamespaceCapabilityListJobs))
|
||||
|
||||
// Check the other simpler operations
|
||||
assert.Equal(t, true, acl.IsManagement())
|
||||
assert.Equal(t, true, acl.AllowAgentRead())
|
||||
assert.Equal(t, true, acl.AllowAgentWrite())
|
||||
assert.Equal(t, true, acl.AllowNodeRead())
|
||||
@@ -97,6 +98,7 @@ func TestACLMerge(t *testing.T) {
|
||||
assert.Equal(t, false, acl.AllowNamespaceOperation("foo", NamespaceCapabilityListJobs))
|
||||
|
||||
// Check the other simpler operations
|
||||
assert.Equal(t, false, acl.IsManagement())
|
||||
assert.Equal(t, true, acl.AllowAgentRead())
|
||||
assert.Equal(t, true, acl.AllowAgentWrite())
|
||||
assert.Equal(t, true, acl.AllowNodeRead())
|
||||
@@ -118,6 +120,7 @@ func TestACLMerge(t *testing.T) {
|
||||
assert.Equal(t, false, acl.AllowNamespaceOperation("foo", NamespaceCapabilityListJobs))
|
||||
|
||||
// Check the other simpler operations
|
||||
assert.Equal(t, false, acl.IsManagement())
|
||||
assert.Equal(t, true, acl.AllowAgentRead())
|
||||
assert.Equal(t, false, acl.AllowAgentWrite())
|
||||
assert.Equal(t, true, acl.AllowNodeRead())
|
||||
@@ -139,6 +142,7 @@ func TestACLMerge(t *testing.T) {
|
||||
assert.Equal(t, false, acl.AllowNamespaceOperation("foo", NamespaceCapabilityListJobs))
|
||||
|
||||
// Check the other simpler operations
|
||||
assert.Equal(t, false, acl.IsManagement())
|
||||
assert.Equal(t, false, acl.AllowAgentRead())
|
||||
assert.Equal(t, false, acl.AllowAgentWrite())
|
||||
assert.Equal(t, false, acl.AllowNodeRead())
|
||||
|
||||
Reference in New Issue
Block a user