Add ability to edit custom role
What does this MR do and why?
We are currently working on a redesign of the Roles and Permissions
page:
This MR adds the ability to edit a role by modifying the form used to create a role:
and also the following:
- For the
memberRoles
query, adds a new field callededitPath
that's the web UI path to edit the role. - Changes form validation to validate-on-change instead of validate-on-submit.
How to set up and validate locally
- Apply this patch to view the redesigned page:
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();
- Go to a top-level group,
Settings
->Roles and Permissions
. - Click the
New role
button. - You should be redirected to the create role page. Fill out the form, then click on
Create Role
to create the role. - You should be redirected back to the list page. Verify that the role has been created.
- Click on the triple dot menu ->
Edit Role
. - You should be redirected to the edit role page. Modify some stuff in the form, then click on
Save Role
to save the role. - You should be redirected back to the list page. Verify that the role has been updated.
- Click on
Admin Area
->Roles and Permissions
. Repeat the same steps to test admin custom roles.
Related to #437590 (closed)
Edited by Daniel Tian