From e75d8f17ba003f010e9290769177509ea7e75d59 Mon Sep 17 00:00:00 2001 From: TuanaCelik Date: Tue, 10 Dec 2024 11:31:10 +0100 Subject: [PATCH] fixing layout --- .../code/python/howto.configure.rbac.roles.py | 24 +++++++++---------- developers/weaviate/configuration/roles.md | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/_includes/code/python/howto.configure.rbac.roles.py b/_includes/code/python/howto.configure.rbac.roles.py index f4da14b26..275155959 100644 --- a/_includes/code/python/howto.configure.rbac.roles.py +++ b/_includes/code/python/howto.configure.rbac.roles.py @@ -1,9 +1,5 @@ import weaviate -# START-ANY -from weaviate.classes.rbac import Permissions -# END-ANY - # START AdminClient from weaviate.classes.init import Auth @@ -12,6 +8,7 @@ # END AdminClient # START CreateRole +from weaviate.classes.rbac import Permissions admin_client.roles.create( role_name="devrel", permissions= @@ -19,6 +16,7 @@ # END CreateRole # START AddRoleAtCreate +from weaviate.classes.rbac import Permissions permissions = [ Permissions.collections( @@ -41,6 +39,8 @@ # END AddRoleAtCreate # START AddRoles +from weaviate.classes.rbac import Permissions + permissions = [ Permissions.data(collection="Test_DevRel", read=True, create=True), Permissions.data(collection="Test_*", read=True, create=False) @@ -50,6 +50,8 @@ # END AddRoles # START ManageRoles +from weaviate.classes.rbac import Permissions + permissions = [ Permissions.roles(role_names="devrel", read=True, manage=True), Permissions.roles(role_names="devrel-*", read=True, manage=False) @@ -59,6 +61,8 @@ # END ManageRoles # START ClusterAndNodePermissions +from weaviate.classes.rbac import Permissions + permissions = [ Permissions.cluster(read=True), Permissions.nodes(collection="Test_DevRel", verbosity="verbose", read=True) @@ -73,44 +77,38 @@ # END AssignRole # START ListUserRoles - admin_client.roles.of_current_user() admin_client.roles.roles.by_user(user="jane-doe") # END ListUserRoles # START CheckRoleExists - admin_client.roles.exists(role_name="role-name") # END CheckRoleExists # START InspectRole - admin_client.roles.by_name(role_name="role-name") # END InspectRole # START AssignedUsers - admin_client.roles.assigned_users(role_name="role-name") # END AssignedUsers # START ListAllRoles - admin_client.roles.list_all() # END ListAllRoles # START DeleteRole - admin_client.roles.delete(role_name="role-name") # END DeleteRole -# START RevoveRoles - +# START RevokeRoles admin_client.roles.revoke_from_user(role_names=["role-1", "role-2"], user="jane-doe") -# END RevoveRoles +# END RevokeRoles # START RemovePermissions +from weaviate.classes.rbac import Permissions permissions = [ Permissions.collections( diff --git a/developers/weaviate/configuration/roles.md b/developers/weaviate/configuration/roles.md index a9ff05c04..c425547ed 100644 --- a/developers/weaviate/configuration/roles.md +++ b/developers/weaviate/configuration/roles.md @@ -239,7 +239,7 @@ Next, let's grant additional permissions to the "devrel". In this example, we're @@ -468,7 +468,7 @@ For example, the `admin_client` below is first listing its own roles, then, of t