@@ -75,13 +75,22 @@ def get_one(self, ref_or_id, requester_user):
75
75
ref_or_id , requester_user = requester_user , permission_type = permission_type
76
76
)
77
77
78
- def match (self , action_alias_match_api ):
78
+ def match (self , action_alias_match_api , requester_user = None ):
79
79
"""
80
80
Find a matching action alias.
81
81
82
82
Handles requests:
83
83
POST /actionalias/match
84
84
"""
85
+
86
+ permission_type = PermissionType .ACTION_ALIAS_MATCH
87
+ rbac_utils = get_rbac_backend ().get_utils_class ()
88
+
89
+ rbac_utils .assert_user_has_permission (
90
+ user_db = requester_user ,
91
+ permission_type = permission_type ,
92
+ )
93
+
85
94
command = action_alias_match_api .command
86
95
87
96
try :
@@ -111,32 +120,23 @@ def help(self, filter, pack, limit, offset, **kwargs):
111
120
112
121
permission_type = PermissionType .ACTION_ALIAS_HELP
113
122
rbac_utils = get_rbac_backend ().get_utils_class ()
114
-
123
+ rbac_utils .assert_user_has_permission (
124
+ user_db = requester_user ,
125
+ permission_type = permission_type ,
126
+ )
115
127
try :
116
128
aliases_resp = super (ActionAliasController , self )._get_all (** kwargs )
117
- aliases = []
118
- for alias in aliases_resp .json :
119
- try :
120
- rbac_utils .assert_user_has_permission (
121
- user_db = requester_user ,
122
- permission_type = permission_type ,
123
- )
124
- aliases .append (ActionAliasAPI (** alias ))
125
- except ResourceTypeAccessDeniedError as exception :
126
- # Permission denied, don't include in output.
127
- pass
128
- except Exception as exception :
129
- LOG .exception (f"Error processing action-alias." )
129
+ aliases = [ActionAliasAPI (** alias ) for alias in aliases_resp .json ]
130
130
131
131
return generate_helpstring_result (
132
132
aliases , filter , pack , int (limit ), int (offset )
133
133
)
134
- except ( TypeError ) as e :
134
+ except TypeError as exception_type :
135
135
LOG .exception (
136
136
"Helpstring request contains an invalid data type: %s." ,
137
- six .text_type (e ),
137
+ six .text_type (exception_type ),
138
138
)
139
- return abort (http_client .BAD_REQUEST , six .text_type (e ))
139
+ return abort (http_client .BAD_REQUEST , six .text_type (exception_type ))
140
140
141
141
def post (self , action_alias , requester_user ):
142
142
"""
0 commit comments