Delete an action alias. Handles requests: DELETE /actionalias/1
(self, ref_or_id, requester_user)
| 214 | return action_alias_api |
| 215 | |
| 216 | def delete(self, ref_or_id, requester_user): |
| 217 | """ |
| 218 | Delete an action alias. |
| 219 | |
| 220 | Handles requests: |
| 221 | DELETE /actionalias/1 |
| 222 | """ |
| 223 | action_alias_db = self._get_by_ref_or_id(ref_or_id=ref_or_id) |
| 224 | LOG.debug( |
| 225 | "DELETE /actionalias/ lookup with id=%s found object: %s", |
| 226 | ref_or_id, |
| 227 | action_alias_db, |
| 228 | ) |
| 229 | |
| 230 | permission_type = PermissionType.ACTION_ALIAS_DELETE |
| 231 | rbac_utils = get_rbac_backend().get_utils_class() |
| 232 | rbac_utils.assert_user_has_resource_db_permission( |
| 233 | user_db=requester_user, |
| 234 | resource_db=action_alias_db, |
| 235 | permission_type=permission_type, |
| 236 | ) |
| 237 | |
| 238 | try: |
| 239 | ActionAlias.delete(action_alias_db) |
| 240 | except Exception as e: |
| 241 | LOG.exception( |
| 242 | 'Database delete encountered exception during delete of id="%s".', |
| 243 | ref_or_id, |
| 244 | ) |
| 245 | abort(http_client.INTERNAL_SERVER_ERROR, six.text_type(e)) |
| 246 | return |
| 247 | |
| 248 | extra = {"action_alias_db": action_alias_db} |
| 249 | LOG.audit( |
| 250 | "Action alias deleted. ActionAlias.id=%s." % (action_alias_db.id), |
| 251 | extra=extra, |
| 252 | ) |
| 253 | |
| 254 | return Response(status=http_client.NO_CONTENT) |
| 255 | |
| 256 | |
| 257 | action_alias_controller = ActionAliasController() |
nothing calls this directly
no test coverage detected