Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@Adhithimr
Copy link

Summary

  • Fixed bug where original role's permissions disappear after replicating to a new role
  • Added logic to create Custom DocPerm entries for the original role when needed

Root Cause

When replicating a role, get_all_perms() hides DocPerm entries when any Custom DocPerm exists for the same DocType (even for different roles). After replication, the new role gets Custom DocPerm entries, which causes the original role's DocPerm entries to be filtered out in the UI.

Solution

When replicating, we now also create Custom DocPerm entries for the original role (if they don't already exist), ensuring its permissions remain visible after replication.

Test Plan

  • Added test case test_replicate_role_preserves_original_permissions
  • Manual testing:
    1. Go to Role Replication
    2. Select an existing role (e.g., "Sales User")
    3. Enter a new role name (e.g., "Custom sales person")
    4. Click Replicate
    5. Verify both roles show permissions in Role Permission Manager

Fixes #34605

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in Role Replication in Develop branch

1 participant