feat: Disable Sharing globally (#20318) [backport] #20500
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Port of #20318
Docs: https://docs.erpnext.com/docs/v13/user/manual/en/setting-up/settings/system-settings/edit-wiki?wiki_page_patch=301c81b67e
The following is tested on a v13 site and the screenshots belong to the same:
Enable or Disable document sharing system wide
Checkbox in System Settings which is unchecked by default to maintain old behaviour
![Screenshot 2023-03-29 at 1 05 46 PM](https://user-images.githubusercontent.com/25857446/228460410-e5545e16-c68c-4319-af82-764601aaed8d.png)
If enabled, system wide, no user will have share access to any document
The share button will be read only, no action (no share access). Although users can see who the doc is shared with (consistent with old behaviour)
![2023-03-29 12 58 54](https://user-images.githubusercontent.com/25857446/228460497-5c7c2564-946c-44ee-88f0-8d4b8aa76338.gif)
On invoking the share API without
![2023-03-29 12 57 24](https://user-images.githubusercontent.com/25857446/228460792-ab64201a-5bb3-47bd-b977-f958764c4abf.gif)
ignore_share_permissions
(from the browser), a perm error is thrownIf any share API is invoked with
![2023-03-29 13 08 53](https://user-images.githubusercontent.com/25857446/228461211-3ba42ef3-d7db-470f-8f32-8cc8129f79f1.gif)
ignore_share_permissions
it will go through (consistent with old behaviour). [Creating a user, doc must be shared with the user themselves]assign_to
is handled as a special case, where assigning a doc to a user will block the assignment if the user does not have access already. The assignee is expected to have access to the document otherwise assignments can be misused