[Bug]: Moving Folders Occasionally Results in Duplicate Permissions
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
The issue is a race condition in the Resource Manager that inserts duplicate rows into the FolderPermissions table when moving folders. Start by locating the server-side folder move logic and permissions update code path, likely in the Resource Manager or FileSystem modules, then add a unique constraint on (FolderId, PermissionId, RoleId) to confirm the duplicate insert. The fix should prevent the race by checking for existing rows before insert or handling duplicates gracefully, and done means moving a folder no longer creates duplicate PermissionId/RoleId combinations.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
When using the Resource Manager to move a folder from one location to another, occasionally, approximately 20% of the time, we are seeing situations where the FOlder Permissions are being duplicated.
Once a folder permission is duplicated you are stuck. The interface allows you to make a change, but it doesn't save at all.
Steps to reproduce?
- Before starting query to get the current permssions for your folder, you should see 1 record per PermissionId,RoleId combination.
SELECT *
FROM FolderPermissions FP
INNER JOIN Roles R ON (FP.RoleId = R.RoleId)
WHERE FolderPath = '<YourPathHere>'
- Go to Site Assets
- Find a folder within the solution, one that has at least a few custom roles assigned
- Select the folder
- Select "Move" and select a different folder
- Query the permissions table again, using your new path (or update to use the existing FolderId)
- If the permissions are still ok, try to edit the permissions and REMOVE one of the roles and hit save
- Query again to validate
The failure seems to happen at either 5 or 7 randomly.
Current Behavior
In testing, depending on factors that I've yet to confirm, at times you will see a duplicated permission where the Folderid, PermissionId,AllowAccess,RoleId,CreatedByUserId, andd LastModifiedByUserId values are the same.
THe "CreatedOnDate" and "LastModifiedOnDate" values will be off, by a few thousands of a second, indicating some sort of race, or double execution issue.
It seems to be more commonly recreated if moving a folder with sub-folders, but again, not able to completely confirm.
Once this happens, there is no way to edit or clean the permissions within the system, you must manually manage/edit the permissions to remove the duplicates and then clear the cache.
Expected Behavior
Not 100% sure of the "right" fix here
Option 1 - Fix the Data Issue
We could consider fixing the DB to have a unique index to prevent bad data from ever being entered, but this will result in a complicated upgrade query.
Option 2 - Fix the "Edit" experience to Handle
Given that the root cause is harder to diagnose, it might be worthwile to fix the glitch that prevents editing of the permissions.
Option 3 - Fix the actual issue
This is harder as the exact timing/cause is unclear especially since it isn't all roles/permissions etc.
Relevant log output
Anything else?
Tested this on an early 10.0.0 installation and latest 10.3.3 as well as 10.4.0 and seeing it randomly, but unable to pinpoint exactly when.
Affected Versions
10.3.3 (latest release)
What browsers are you seeing the problem on?
Chrome
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- C#
- Stars
- 1.1k
- Forks
- 791
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 24
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dnnsoftware/Dnn.Platform
-
[Bug]: Edit Bar buttons are not localizedPossibly taken @idumlupinar claimed this today. OpenStatus: New
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dnnsoftware/Dnn.Platform#7565 ·
Maintainers usually reply within 1 day
-
Status: New
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dnnsoftware/Dnn.Platform#7543 · 3 comments ·
Maintainers usually reply within 1 day
-
Status: New
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
dnnsoftware/Dnn.Platform#6681 ·
Maintainers usually reply within 1 day
-
Status: New
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dnnsoftware/Dnn.Platform#6051 · 4 comments ·
Maintainers usually reply within 1 day
-
Status: New
Difficulty 3/5 1-2 days Newbie friendliness 45/100
dnnsoftware/Dnn.Platform#7555 ·
Maintainers usually reply within 1 day
All issues in dnnsoftware/Dnn.Platform
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
ready-for-agent size:S status:todo
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
elsa-workflows/elsa-foundation#2830 ·
Maintainers usually reply within 1 day
-
Review - Maintainer WG-Maintainers-Build
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
PowerShell/PowerShell#28220 · 1 comment ·
Maintainers usually reply within 1 day
-
area: docs eco: dotnet good first issue help wanted lane: free-agent roadmap size: XS type: docs
Difficulty 2/5 Under an hour Newbie friendliness 72/100
arminazimi/evergreen#377 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day