feat: Add Role Clone Button (#1000)
What does this MR do?
This MR introduces the "clone" feature for roles, as requested in #1000 (closed).
It achieves this by adding a new "clone" button to the role-edit page. Clicking this button creates a new role with all of the same properties as the original - only difference being the Id (ofc) and the name which gets marked with "(cloned)".
After the clone has been created the user is redirected to the edit page of the new role, as this seems like the most likely workflow. (eg. "I want to create this same role, but with a different name and color" -> click "clone" -> edit the properties -> save)
Demo
Dev notes
- A small testsuite has been added
- Cloning will currently result in the same side effects as creating (eg. "User created ..." in Audit Log, ...) as the
RoleService.createfunction is used creation of the new role. - Cloning currently happens upon clicking the "clone" button. Handeling most of the process in FE would also have been an option, but would include more complex state management and would make it harder to add other side-effects later on. Also it is assumed that the "clone" button is always pressed with the intend of actually cloning. If not, deletion of the created role is not dificult. (imo)
Commits
- feat(frontend): Add Clone Button To Role Page
- feat(backend): Add Clone Endpoint
Contribution Guidelines
By submitting this merge request, you agree to follow our Contribution Guidelines
-
I agree to follow this project's Contribution Guidelines -
I have made sure to test this merge request
Edited by Lillychan
