From fb903a9515a08745019e8ec01e79964748d23fc1 Mon Sep 17 00:00:00 2001 From: Dominika Zemanovicova Date: Mon, 2 Sep 2024 17:59:43 +0200 Subject: [PATCH] docs(rbac): add group hierarchy support information --- plugins/rbac-backend/README.md | 4 +- plugins/rbac-backend/docs/group-hierarchy.md | 57 ++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 plugins/rbac-backend/docs/group-hierarchy.md diff --git a/plugins/rbac-backend/README.md b/plugins/rbac-backend/README.md index c43a3d61470..574d88f1b65 100644 --- a/plugins/rbac-backend/README.md +++ b/plugins/rbac-backend/README.md @@ -10,7 +10,7 @@ With the RBAC plugin, you'll have the means to efficiently administer permission Before you dive into utilizing the RBAC plugin for Backstage, there are a few essential prerequisites to ensure a seamless experience. Please review the following requirements to make sure your environment is properly set up -### Setup Permision Framework +### Setup Permission Framework To effectively utilize the RBAC plugin, you must have the Backstage permission framework in place. If you're using the Red Hat Developer Hub, some of these steps may have already been completed for you. However, for other Backstage application instances, please verify that the following prerequisites are satisfied: @@ -264,6 +264,8 @@ permission: The maxDepth must be greater than 0 to ensure that the graphs are built correctly. Also the graph will be built with a hierarchy of 1 + maxDepth. +More information about group hierarchy can be found in the doc: [Group hierarchy](./docs/group-hierarchy.md). + ### Optional RBAC provider module support We also include the ability to create and load in RBAC backend plugin modules that can be used to make connections to third part access management tools. For more information, consult the [RBAC Providers documentation](./docs/providers.md). diff --git a/plugins/rbac-backend/docs/group-hierarchy.md b/plugins/rbac-backend/docs/group-hierarchy.md new file mode 100644 index 00000000000..9f2a5acbe60 --- /dev/null +++ b/plugins/rbac-backend/docs/group-hierarchy.md @@ -0,0 +1,57 @@ +# Group Hierarchy + +RBAC access control is configured by defining roles and their associated permission policies, which are then assigned to users or groups. Leveraging group hierarchy can greatly simplify RBAC management, making it more scalable and flexible. + +## Group-Based Role Assignment + +Role can be assigned to a specific group. If a user is a member of that group, or a member of any of its child groups, the role (and its associated permissions) will automatically be applied to that user. You need to make sure that assigned groups actually exist in the catalog. + +- Example: + + Sam will inherit `role:default/test`, `subteam-group` must have explicitly defined `team-group` as parent. + + ```yaml + # catalog-entity.yaml + apiVersion: backstage.io/v1alpha1 + kind: Group + metadata: + name: team-group + spec: + type: team + children: [subteam-group] + --- + apiVersion: backstage.io/v1alpha1 + kind: Group + metadata: + name: subteam-group + spec: + type: team + children: [] + parent: team-group + --- + apiVersion: backstage.io/v1alpha1 + kind: User + metadata: + name: sam + spec: + memberOf: + - subteam-group + ``` + + ```CSV + g, group:default/team-group, role:default/test + p, role:default/test, catalog-entity, read, allow + ``` + +## Managing Group Hierarchy Depth + +While group hierarchy provides powerful inheritance features, it can have performance implications. Organizations with potentially complex group hierarchy can specify `maxDepth` configuration value, that will ensure that the RBAC plugin will stop at a certain depth when building user graphs. + +```YAML +permission: + enabled: true + rbac: + maxDepth: 1 +``` + +The `maxDepth` must be greater than 0 to ensure that the graphs are built correctly. Also the graph will be built with a hierarchy of 1 + maxDepth.