]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/controllers/role.py
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / controllers / role.py
index 6bf616d08ef12cd1cd9ba3011e80c17bf044e24f..32404237c4a7c17bf3dafdc5632df53f7de3f7b3 100644 (file)
@@ -3,16 +3,27 @@ from __future__ import absolute_import
 
 import cherrypy
 
-from . import ApiController, RESTController, UiApiController,\
-    CreatePermission
 from .. import mgr
-from ..exceptions import RoleDoesNotExist, DashboardException,\
-    RoleIsAssociatedWithUser, RoleAlreadyExists
-from ..security import Scope as SecurityScope, Permission
+from ..exceptions import DashboardException, RoleAlreadyExists, \
+    RoleDoesNotExist, RoleIsAssociatedWithUser
+from ..security import Permission
+from ..security import Scope as SecurityScope
 from ..services.access_control import SYSTEM_ROLES
+from . import ApiController, ControllerDoc, CreatePermission, EndpointDoc, \
+    RESTController, UiApiController
+
+ROLE_SCHEMA = [{
+    "name": (str, "Role Name"),
+    "description": (str, "Role Descriptions"),
+    "scopes_permissions": ({
+        "cephfs": ([str], "")
+    }, ""),
+    "system": (bool, "")
+}]
 
 
 @ApiController('/role', SecurityScope.USER)
+@ControllerDoc("Role Management API", "Role")
 class Role(RESTController):
     @staticmethod
     def _role_to_dict(role):
@@ -42,6 +53,8 @@ class Role(RESTController):
                 if permissions:
                     role.set_scope_permissions(scope, permissions)
 
+    @EndpointDoc("Display Role list",
+                 responses={200: ROLE_SCHEMA})
     def list(self):
         # type: () -> list
         roles = dict(mgr.ACCESS_CTRL_DB.roles)