mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
Grant write to policies to global maintainer (#4321)
This commit is contained in:
parent
ad9a225033
commit
84ac0f05a9
5 changed files with 9 additions and 14 deletions
|
|
@ -0,0 +1 @@
|
|||
* Grant write access to team policies to the global maintainer role.
|
||||
|
|
@ -37,6 +37,8 @@ The following table depicts various permissions levels for each role.
|
|||
| Delete labels | | ✅ | ✅ |
|
||||
| Add policies for all hosts | | ✅ | ✅ |
|
||||
| Remove policies for all hosts | | ✅ | ✅ |
|
||||
| Add policies for hosts assigned to team\* | | ✅ | ✅ |
|
||||
| Remove policies for hosts assigned to team\* | | ✅ | ✅ |
|
||||
| Create users | | | ✅ |
|
||||
| Edit users | | | ✅ |
|
||||
| Delete users | | | ✅ |
|
||||
|
|
|
|||
|
|
@ -438,25 +438,17 @@ allow {
|
|||
# Policies
|
||||
##
|
||||
|
||||
# Global Admin can read and write policies
|
||||
# Global Admin and Maintainer can read and write policies
|
||||
allow {
|
||||
object.type == "policy"
|
||||
subject.global_role == admin
|
||||
subject.global_role == [admin,maintainer][_]
|
||||
action == [read, write][_]
|
||||
}
|
||||
|
||||
# Global Maintainer can read and write global policies
|
||||
allow {
|
||||
is_null(object.team_id)
|
||||
object.type == "policy"
|
||||
subject.global_role == maintainer
|
||||
action == [read, write][_]
|
||||
}
|
||||
|
||||
# Global Maintainer and Observer users can read any policies
|
||||
# Global Observer can read any policies
|
||||
allow {
|
||||
object.type == "policy"
|
||||
subject.global_role == [maintainer,observer][_]
|
||||
subject.global_role == observer
|
||||
action == read
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ func TestAuthorizePolicies(t *testing.T) {
|
|||
|
||||
{user: test.UserAdmin, object: teamPolicy, action: write, allow: true},
|
||||
{user: test.UserAdmin, object: teamPolicy, action: read, allow: true},
|
||||
{user: test.UserMaintainer, object: teamPolicy, action: write, allow: false},
|
||||
{user: test.UserMaintainer, object: teamPolicy, action: write, allow: true},
|
||||
{user: test.UserMaintainer, object: teamPolicy, action: read, allow: true},
|
||||
{user: test.UserObserver, object: teamPolicy, action: write, allow: false},
|
||||
{user: test.UserObserver, object: teamPolicy, action: read, allow: true},
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ func TestTeamPoliciesAuth(t *testing.T) {
|
|||
{
|
||||
"global maintainer",
|
||||
&fleet.User{GlobalRole: ptr.String(fleet.RoleMaintainer)},
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue