From ceb1fdc095bebf861225cb289cec0030e72a3ace Mon Sep 17 00:00:00 2001 From: Tina Kallio Date: Thu, 27 Dec 2018 10:48:08 +0100 Subject: [PATCH] mgr/dashboard: Correct permission decorator 'CreatePermission' is required in order to restore an image from trash. Signed-off-by: Tina Kallio --- src/pybind/mgr/dashboard/controllers/rbd.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/rbd.py b/src/pybind/mgr/dashboard/controllers/rbd.py index 2e18b37f22f..f16f7b56c5c 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd.py +++ b/src/pybind/mgr/dashboard/controllers/rbd.py @@ -12,13 +12,14 @@ import six import rbd -from . import ApiController, RESTController, Task, UpdatePermission, DeletePermission +from . import ApiController, RESTController, Task, UpdatePermission, \ + DeletePermission, CreatePermission from .. import mgr from ..security import Scope from ..services.ceph_service import CephService from ..tools import ViewCache, str_to_bool from ..services.exception import handle_rados_error, handle_rbd_error, \ - serialize_dashboard_exception + serialize_dashboard_exception # pylint: disable=not-callable @@ -519,7 +520,7 @@ class RbdTrash(RESTController): @RbdTask('trash/restore', ['{pool_name}', '{image_id}', '{new_image_name}'], 2.0) @RESTController.Resource('POST') - @UpdatePermission + @CreatePermission def restore(self, pool_name, image_id, new_image_name): """Restore an image from trash.""" return _rbd_call(pool_name, self.rbd_inst.trash_restore, image_id, new_image_name) -- 2.39.5