Skip to content

Commit

Permalink
-Add v2 IAM policies to viewer and editor role
Browse files Browse the repository at this point in the history
-Update v1 policies to actually be v1 policy and not the v2 ones

Signed-off-by: kmacgugan <[email protected]>
  • Loading branch information
kmacgugan committed May 31, 2019
1 parent 3a9da67 commit 7c7959a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 0 additions & 2 deletions api/external/applications/applications.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import "api/external/common/query/parameters.proto";
service ApplicationsService {
rpc GetServiceGroups(ServiceGroupsReq) returns (ServiceGroups) {
option (google.api.http).get = "/beta/applications/service-groups";
// TODO (dan, 2/2019): need to replace this once we have resources and such
// created in the auth system
option (chef.automate.api.policy) = {
resource: "service_groups"
action: "list"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ BEGIN;

INSERT INTO policies
VALUES ('aee14d59-da0b-4974-ba6d-1a018b024874',
'{"action": "*", "effect": "allow", "resource": "applications:serviceGroups", "subjects": ["user:*"]}',
'{"action": "*", "effect": "allow", "resource": "service_groups", "subjects": ["user:*"]}',
CURRENT_TIMESTAMP,
1,
TRUE)
ON CONFLICT (id) DO UPDATE
SET policy_data='{"action": "list", "effect": "allow", "resource": "applications:serviceGroups", "subjects": ["user:*"]}',
SET policy_data='{"action": "list", "effect": "allow", "resource": "service_groups", "subjects": ["user:*"]}',
deletable=TRUE;

UPDATE iam_roles
SET
actions = actions || '{applications:*:list}'
WHERE
id = 'viewer';

UPDATE iam_roles
SET
actions = actions || '{applications:*}'
WHERE
id = 'editor';
END;
2 changes: 1 addition & 1 deletion components/authz-service/storage/v1/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func DefaultPolicies() (map[string]*Policy, error) {
constants.ApplicationsServiceGroupsPolicyID: {
ID: ids[constants.ApplicationsServiceGroupsPolicyID],
Subjects: []string{"user:*"},
Resource: "applications:serviceGroups",
Resource: "service_groups",
Action: "*",
Effect: "allow",
Version: 1,
Expand Down
2 changes: 2 additions & 0 deletions components/authz-service/storage/v2/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ func DefaultRoles() []Role {
"ingest:*",
"secrets:*",
"telemetry:*",
"applications:*",
},
Type: ChefManaged,
}
Expand All @@ -254,6 +255,7 @@ func DefaultRoles() []Role {
"event:*:list",
"ingest:*:get",
"ingest:*:list",
"applications:*:list",
},
Type: ChefManaged,
}
Expand Down

0 comments on commit 7c7959a

Please sign in to comment.