Skip to content

Commit

Permalink
Fix sessions authorized actions output (#1527)
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai authored Sep 14, 2021
1 parent 92809b7 commit 70cb75d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Canonical reference for changes, improvements, and bugfixes for Boundary.
`managed-group` would not be accepted as specific `type` values in grant
strings. Also, fix authorized actions not showing `credential-store` values in
project scope output. ([PR](https://github.com/hashicorp/boundary/pull/1524))
* actions: Fix `sessions` collection actions not being visible when reading a
scope ([PR](https://github.com/hashicorp/boundary/pull/1527))

## 0.6.0 (2021/09/03)

Expand Down
3 changes: 1 addition & 2 deletions internal/servers/controller/handlers/scopes/scope_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ var (
resource.Group: groups.CollectionActions,
resource.Role: roles.CollectionActions,
resource.Scope: CollectionActions,
resource.Session: sessions.CollectionActions,
resource.User: users.CollectionActions,
},

Expand All @@ -72,7 +71,6 @@ var (
resource.Group: groups.CollectionActions,
resource.Role: roles.CollectionActions,
resource.Scope: CollectionActions,
resource.Session: sessions.CollectionActions,
resource.User: users.CollectionActions,
},

Expand All @@ -81,6 +79,7 @@ var (
resource.Group: groups.CollectionActions,
resource.HostCatalog: host_catalogs.CollectionActions,
resource.Role: roles.CollectionActions,
resource.Session: sessions.CollectionActions,
resource.Target: targets.CollectionActions,
},
}
Expand Down
15 changes: 5 additions & 10 deletions internal/servers/controller/handlers/scopes/scope_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ var globalAuthorizedCollectionActions = map[string]*structpb.ListValue{
structpb.NewStringValue("list"),
},
},
"sessions": {
Values: []*structpb.Value{
structpb.NewStringValue("list"),
},
},
"users": {
Values: []*structpb.Value{
structpb.NewStringValue("create"),
Expand Down Expand Up @@ -132,11 +127,6 @@ var orgAuthorizedCollectionActions = map[string]*structpb.ListValue{
structpb.NewStringValue("list"),
},
},
"sessions": {
Values: []*structpb.Value{
structpb.NewStringValue("list"),
},
},
"users": {
Values: []*structpb.Value{
structpb.NewStringValue("create"),
Expand Down Expand Up @@ -170,6 +160,11 @@ var projectAuthorizedCollectionActions = map[string]*structpb.ListValue{
structpb.NewStringValue("list"),
},
},
"sessions": {
Values: []*structpb.Value{
structpb.NewStringValue("list"),
},
},
"targets": {
Values: []*structpb.Value{
structpb.NewStringValue("create"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (s Service) CancelSession(ctx context.Context, req *pbs.CancelSessionReques
var outputFields perms.OutputFieldsMap
authorizedActions := authResults.FetchActionSetForId(ctx, ses.GetPublicId(), IdActions)

// Check to see if we need to verify Read vs. just ReadSelf
// Check to see if we need to verify Cancel vs. just CancelSelf
if ses.UserId != authResults.UserId {
if !authorizedActions.HasAction(action.Cancel) {
return nil, handlers.ForbiddenError()
Expand Down

0 comments on commit 70cb75d

Please sign in to comment.