Skip to content

Commit 3f46cab

Browse files
committed
Fix RBAC to action-alias help and match api.
1 parent b2dad1e commit 3f46cab

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

CHANGELOG.rst

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Fixed
1313
* Bumped `paramiko` to `2.10.5` to fix an issue with SSH Certs - https://github.com/paramiko/paramiko/issues/2017
1414
Contributed by @jk464
1515

16+
* Added RBAC support to action-alias help end point. #6022
17+
Contributed by @nzlosh
18+
1619
Added
1720
~~~~~
1821
* Move `git clone` to `user_home/.st2packs` #5845

st2api/st2api/controllers/v1/actionalias.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def match(self, action_alias_match_api):
8181
Handles requests:
8282
POST /actionalias/match
8383
"""
84+
8485
command = action_alias_match_api.command
8586

8687
try:
@@ -100,6 +101,7 @@ def match(self, action_alias_match_api):
100101
}
101102

102103
def help(self, filter, pack, limit, offset, **kwargs):
104+
103105
"""
104106
Get available help strings for action aliases.
105107
@@ -109,15 +111,16 @@ def help(self, filter, pack, limit, offset, **kwargs):
109111
try:
110112
aliases_resp = super(ActionAliasController, self)._get_all(**kwargs)
111113
aliases = [ActionAliasAPI(**alias) for alias in aliases_resp.json]
114+
112115
return generate_helpstring_result(
113116
aliases, filter, pack, int(limit), int(offset)
114117
)
115-
except (TypeError) as e:
118+
except TypeError as exception_type:
116119
LOG.exception(
117120
"Helpstring request contains an invalid data type: %s.",
118-
six.text_type(e),
121+
six.text_type(exception_type),
119122
)
120-
return abort(http_client.BAD_REQUEST, six.text_type(e))
123+
return abort(http_client.BAD_REQUEST, six.text_type(exception_type))
121124

122125
def post(self, action_alias, requester_user):
123126
"""

st2common/st2common/openapi.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,11 @@ paths:
806806
description: Object containing the format to be matched.
807807
schema:
808808
$ref: '#/definitions/ActionAliasMatchRequest'
809+
x-parameters:
810+
- name: user
811+
in: context
812+
x-as: requester_user
813+
description: User performing the operation.
809814
responses:
810815
'200':
811816
description: Action alias match pattern
@@ -840,6 +845,11 @@ paths:
840845
description: Number of actions alias to offset
841846
type: integer
842847
default: 0
848+
x-parameters:
849+
- name: user
850+
in: context
851+
x-as: requester_user
852+
description: User performing the operation.
843853
responses:
844854
'200':
845855
description: Action alias match pattern

st2common/st2common/openapi.yaml.j2

+10
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,11 @@ paths:
802802
description: Object containing the format to be matched.
803803
schema:
804804
$ref: '#/definitions/ActionAliasMatchRequest'
805+
x-parameters:
806+
- name: user
807+
in: context
808+
x-as: requester_user
809+
description: User performing the operation.
805810
responses:
806811
'200':
807812
description: Action alias match pattern
@@ -836,6 +841,11 @@ paths:
836841
description: Number of actions alias to offset
837842
type: integer
838843
default: 0
844+
x-parameters:
845+
- name: user
846+
in: context
847+
x-as: requester_user
848+
description: User performing the operation.
839849
responses:
840850
'200':
841851
description: Action alias match pattern

0 commit comments

Comments
 (0)