(RBAC enable)Fix when permission_type is not provided with API call
@@ -222,6 +222,7 @@ class ResourceController(object):
instance = self._get_by_id(resource_id=id, exclude_fields=exclude_fields)
+ if permission_type:
rbac_utils.assert_user_has_resource_db_permission(user_db=requester_user,
resource_db=instance,
permission_type=permission_type)
@@ -260,7 +261,8 @@ class ResourceController(object):
return result
- def _get_one_by_pack_ref(self, pack_ref, exclude_fields=None, from_model_kwargs=None, **kwargs):
+ def _get_one_by_pack_ref(self, pack_ref, exclude_fields=None, from_model_kwargs=None,
+ **kwargs):
instance = self._get_by_pack_ref(pack_ref=pack_ref, exclude_fields=exclude_fields)
if not instance:
@@ -374,6 +376,7 @@ class ContentPackResourceController(ResourceController):
abort(http_client.NOT_FOUND, e.message)
return
+ if permission_type:
rbac_utils.assert_user_has_resource_db_permission(user_db=requester_user,
resource_db=instance,
permission_type=permission_type)
