Refactor create custom role permissions into its own component
What does this MR do and why?
On the Settings
-> Roles and Permissions
page, there's a CreateMemberRole
component that shows a form to create a new custom role:
Half of the code in CreateMemberRole
is just for the permissions list. To keep the component size more manageable, this MR refactors the permissions list into its own component.
How to set up and validate locally
- Go to any top-level group.
- Go to
Settings
->Roles and Permissions
. - Click the
New role
button. - Verify that the permissions list is shown.
- Do not fill out the form. Scroll to the bottom and click on
Create role
. - Verify that the permission validate properly. All the permission names should turn red.
- Verify that dependent permissions are automatically checked. Check
Admin vulnerability
and verify thatRead vulnerability
is automatically checked as well. - Verify that dependent permissions are automatically unchecked. Uncheck
Read vulnerability
and verify thatAdmin vulnerability
is automatically unchecked as well. - Verify the creation. Fill out the form properly and click on
Create role
. Verify that the role was successfully created with the correct permissions.
We also have a new redesign of the page that's currently in development. To switch to it, apply this patch, then run through the validation steps again:
Patch
Index: ee/app/assets/javascripts/pages/admin/application_settings/roles_and_permissions/index.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ee/app/assets/javascripts/pages/admin/application_settings/roles_and_permissions/index.js b/ee/app/assets/javascripts/pages/admin/application_settings/roles_and_permissions/index.js
--- a/ee/app/assets/javascripts/pages/admin/application_settings/roles_and_permissions/index.js (revision b075421643ab545cfee6ed1c20d3a71f309bb6a8)
+++ b/ee/app/assets/javascripts/pages/admin/application_settings/roles_and_permissions/index.js (date 1710884444267)
@@ -1,3 +1,4 @@
-import { initRolesAndPermissions } from 'ee/roles_and_permissions';
+import { initRolesAndPermissions, initCustomRolesApp } from 'ee/roles_and_permissions';
-initRolesAndPermissions();
+initCustomRolesApp();
+// initRolesAndPermissions();
Index: ee/app/assets/javascripts/pages/groups/settings/roles_and_permissions/index.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ee/app/assets/javascripts/pages/groups/settings/roles_and_permissions/index.js b/ee/app/assets/javascripts/pages/groups/settings/roles_and_permissions/index.js
--- a/ee/app/assets/javascripts/pages/groups/settings/roles_and_permissions/index.js (revision b075421643ab545cfee6ed1c20d3a71f309bb6a8)
+++ b/ee/app/assets/javascripts/pages/groups/settings/roles_and_permissions/index.js (date 1710884444283)
@@ -1,3 +1,4 @@
-import { initRolesAndPermissions } from 'ee/roles_and_permissions';
+import { initRolesAndPermissions, initCustomRolesApp } from 'ee/roles_and_permissions';
-initRolesAndPermissions();
+initCustomRolesApp();
+// initRolesAndPermissions();
Related to #438838 (closed)
Edited by Daniel Tian