@@ -75,13 +75,22 @@ def get_one(self, ref_or_id, requester_user):
7575 ref_or_id , requester_user = requester_user , permission_type = permission_type
7676 )
7777
78- def match (self , action_alias_match_api ):
78+ def match (self , action_alias_match_api , requester_user = None ):
7979 """
8080 Find a matching action alias.
8181
8282 Handles requests:
8383 POST /actionalias/match
8484 """
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+
8594 command = action_alias_match_api .command
8695
8796 try :
@@ -111,32 +120,23 @@ def help(self, filter, pack, limit, offset, **kwargs):
111120
112121 permission_type = PermissionType .ACTION_ALIAS_HELP
113122 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+ )
115127 try :
116128 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 ]
130130
131131 return generate_helpstring_result (
132132 aliases , filter , pack , int (limit ), int (offset )
133133 )
134- except ( TypeError ) as e :
134+ except TypeError as exception_type :
135135 LOG .exception (
136136 "Helpstring request contains an invalid data type: %s." ,
137- six .text_type (e ),
137+ six .text_type (exception_type ),
138138 )
139- return abort (http_client .BAD_REQUEST , six .text_type (e ))
139+ return abort (http_client .BAD_REQUEST , six .text_type (exception_type ))
140140
141141 def post (self , action_alias , requester_user ):
142142 """
0 commit comments