Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RBAC to action-alias help api. #6022

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Fixed
* For "local-shell-script" runner, on readonly filesystems, don't attempt to run chmod +x on script_action. Fixes #5591
Contributed by @jk464

* Fixed RBAC support to action-alias help and match end point. #6022
Contributed by @nzlosh

Added
~~~~~
* Move `git clone` to `user_home/.st2packs` #5845
Expand Down
4 changes: 2 additions & 2 deletions st2api/st2api/controllers/v1/actionalias.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_one(self, ref_or_id, requester_user):
ref_or_id, requester_user=requester_user, permission_type=permission_type
)

def match(self, action_alias_match_api):
def match(self, action_alias_match_api, requester_user):
"""
Find a matching action alias.

Expand All @@ -99,7 +99,7 @@ def match(self, action_alias_match_api):
"representation": format_["representation"],
}

def help(self, filter, pack, limit, offset, **kwargs):
def help(self, filter, pack, limit, offset, requester_user, **kwargs):
"""
Get available help strings for action aliases.

Expand Down
10 changes: 10 additions & 0 deletions st2common/st2common/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,11 @@ paths:
description: Object containing the format to be matched.
schema:
$ref: '#/definitions/ActionAliasMatchRequest'
x-parameters:
- name: user
in: context
x-as: requester_user
description: User performing the operation.
responses:
'200':
description: Action alias match pattern
Expand Down Expand Up @@ -840,6 +845,11 @@ paths:
description: Number of actions alias to offset
type: integer
default: 0
x-parameters:
- name: user
in: context
x-as: requester_user
description: User performing the operation.
responses:
'200':
description: Action alias match pattern
Expand Down
10 changes: 10 additions & 0 deletions st2common/st2common/openapi.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,11 @@ paths:
description: Object containing the format to be matched.
schema:
$ref: '#/definitions/ActionAliasMatchRequest'
x-parameters:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see x-permissions above. I wonder why that isn't triggering the permission check.

- name: user
in: context
x-as: requester_user
description: User performing the operation.
responses:
'200':
description: Action alias match pattern
Expand Down Expand Up @@ -836,6 +841,11 @@ paths:
description: Number of actions alias to offset
type: integer
default: 0
x-parameters:
- name: user
in: context
x-as: requester_user
description: User performing the operation.
responses:
'200':
description: Action alias match pattern
Expand Down
Loading