Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes an issue where URLControl checks upload permissions wrong #5461

Conversation

skamphuis
Copy link
Contributor

Fixes #5423

Summary

The URLControl tries for "ADD" permission on the selected folder, but that doesn't exist (anymore?). It changed it to "WRITE" instead, which seems logical because that's actually the permission you're controlling by giving a user or role Edit permissions on a folder. This seems to fix the issues mentioned in #5423 and in Links and Documents.

However, I did find other references to the "ADD" permission in several other places:

  • ResourceManager.PermissionsManager
  • InternalServices.FileUploadController (but that checks for both ADD and WRITE)
  • Modules.Export.ascx.cs

These might need changing too. Happy to do so, by the way. Just let me know.

@sleupold
Copy link
Contributor

Add permission is part of the advanced permission provider and should get mapped to write in the community provider.

@skamphuis
Copy link
Contributor Author

Add permission is part of the advanced permission provider and should get mapped to write in the community provider.

Right. So the URLControl needs to check for ADD like it does without this PR, but the PermissionProvider needs to check for WRITE if ADD was requested by calling code?

@sleupold
Copy link
Contributor

sleupold commented Dec 29, 2022

Add permission is part of the advanced permission provider and should get mapped to write in the community provider.

Right. So the URLControl needs to check for ADD like it does without this PR, but the PermissionProvider needs to check for WRITE if ADD was requested by calling code?

yes, that is correct

@skamphuis
Copy link
Contributor Author

skamphuis commented Dec 29, 2022

Add permission is part of the advanced permission provider and should get mapped to write in the community provider.

Right. So the URLControl needs to check for ADD like it does without this PR, but the PermissionProvider needs to check for WRITE if ADD was requested by calling code?

yes, that is correct

Hmm, doesn't look like that's true, because the LoadFolders method in the UrlControl uses the FolderManager which goes straight to the DB and doesn't use the PermissionProvider. Also, that looks like checks need to be somewhat more complex, like: if ADD permission exists in Permissions, then check for ADD permission, otherwise check for WRITE permission.

Any advice on how to fix this further would be appreciated.

Copy link
Contributor

@david-poindexter david-poindexter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow - hard to believe this has been this way for so long! Thanks @skamphuis

@david-poindexter david-poindexter added this to the 9.11.1 milestone Jan 3, 2023
@david-poindexter david-poindexter merged commit c4ecd89 into dnnsoftware:develop Jan 3, 2023
@skamphuis skamphuis deleted the feature/5423-UrlControl-Upload-Permission-check branch June 8, 2023 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UrlControl issue: cannot upload for any role (Only works for admin/Superuser)
4 participants