-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
feat: Disable Sharing globally #20318
Conversation
- Checkbox in System Settings - If disabled, avoid share UI render - Share APIs return None (non-obstructing) if share APIs are invoked
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #20318 +/- ##
===========================================
+ Coverage 63.80% 63.86% +0.06%
===========================================
Files 758 758
Lines 68672 68654 -18
Branches 6194 6194
===========================================
+ Hits 43814 43849 +35
+ Misses 21320 21263 -57
- Partials 3538 3542 +4
Flags with carried forward coverage won't be shown. Click here to find out more. |
- Treat feature like a perm toggler. Essentially noone is allowed to explicity share anything - Implicit sharing via `ignore_share_permissions` is allowed. Devs can decide where sharing should happen under the hood - UI is made read only and not hidden. Users must see who doc is already shared with - Make sure perm APIs used by share feature return false if sharing is disabled - Rename checkbox to `Disable Document Sharing`
1368f8a
to
e547f6e
Compare
- Also, fix missed system setting rename in `assign_to`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one minor UX fix. Rest looks fine.
4ba0378
to
28bef3e
Compare
- misc: readable conditions
28bef3e
to
3852350
Compare
1d9319b
to
4246289
Compare
4246289
to
1ea9d60
Compare
* feat: Disable Sharing globally - Checkbox in System Settings - If disabled, avoid share UI render - Share APIs return None (non-obstructing) if share APIs are invoked * feat: Settings checkbox must toggle share permission globally - Treat feature like a perm toggler. Essentially noone is allowed to explicity share anything - Implicit sharing via `ignore_share_permissions` is allowed. Devs can decide where sharing should happen under the hood - UI is made read only and not hidden. Users must see who doc is already shared with - Make sure perm APIs used by share feature return false if sharing is disabled - Rename checkbox to `Disable Document Sharing` * test: (server side) Impact of disabling sharing on APIs - Also, fix missed system setting rename in `assign_to` * fix: Inform assigner if assignee lacks perms and sharing is disabled - misc: readable conditions * fix: throw instead of msgprint * fix: Typo and appropriate message for `throw` --------- Co-authored-by: Ankush Menat <ankush@frappe.io> (cherry picked from commit 90f8f94) # Conflicts: # frappe/core/doctype/docshare/test_docshare.py # frappe/core/doctype/system_settings/system_settings.json # frappe/permissions.py # frappe/public/js/frappe/model/model.js
* feat: Disable Sharing globally - Checkbox in System Settings - If disabled, avoid share UI render - Share APIs return None (non-obstructing) if share APIs are invoked * feat: Settings checkbox must toggle share permission globally - Treat feature like a perm toggler. Essentially noone is allowed to explicity share anything - Implicit sharing via `ignore_share_permissions` is allowed. Devs can decide where sharing should happen under the hood - UI is made read only and not hidden. Users must see who doc is already shared with - Make sure perm APIs used by share feature return false if sharing is disabled - Rename checkbox to `Disable Document Sharing` * test: (server side) Impact of disabling sharing on APIs - Also, fix missed system setting rename in `assign_to` * fix: Inform assigner if assignee lacks perms and sharing is disabled - misc: readable conditions * fix: throw instead of msgprint * fix: Typo and appropriate message for `throw` --------- Co-authored-by: Ankush Menat <ankush@frappe.io> (cherry picked from commit 90f8f94)
@ankush don't you want this in v13 at all or can we do a manual backport? |
Way too many conflicts, better to port manually and confirm if it works. |
* feat: Disable Sharing globally (#20318) * feat: Disable Sharing globally - Checkbox in System Settings - If disabled, avoid share UI render - Share APIs return None (non-obstructing) if share APIs are invoked * feat: Settings checkbox must toggle share permission globally - Treat feature like a perm toggler. Essentially noone is allowed to explicity share anything - Implicit sharing via `ignore_share_permissions` is allowed. Devs can decide where sharing should happen under the hood - UI is made read only and not hidden. Users must see who doc is already shared with - Make sure perm APIs used by share feature return false if sharing is disabled - Rename checkbox to `Disable Document Sharing` * test: (server side) Impact of disabling sharing on APIs - Also, fix missed system setting rename in `assign_to` * fix: Inform assigner if assignee lacks perms and sharing is disabled - misc: readable conditions * fix: throw instead of msgprint * fix: Typo and appropriate message for `throw` --------- Co-authored-by: Ankush Menat <ankush@frappe.io> (cherry picked from commit 90f8f94) * test: fix test case to modified behaviour We throw instead of showing warning now --------- Co-authored-by: Marica <maricadsouza221197@gmail.com> Co-authored-by: Ankush Menat <ankush@frappe.io>
* feat: Disable Sharing globally (#20318) * feat: Disable Sharing globally - Checkbox in System Settings - If disabled, avoid share UI render - Share APIs return None (non-obstructing) if share APIs are invoked * feat: Settings checkbox must toggle share permission globally - Treat feature like a perm toggler. Essentially noone is allowed to explicity share anything - Implicit sharing via `ignore_share_permissions` is allowed. Devs can decide where sharing should happen under the hood - UI is made read only and not hidden. Users must see who doc is already shared with - Make sure perm APIs used by share feature return false if sharing is disabled - Rename checkbox to `Disable Document Sharing` * test: (server side) Impact of disabling sharing on APIs - Also, fix missed system setting rename in `assign_to` * fix: Inform assigner if assignee lacks perms and sharing is disabled - misc: readable conditions * fix: throw instead of msgprint * fix: Typo and appropriate message for `throw` --------- Co-authored-by: Ankush Menat <ankush@frappe.io> * test: fix test case to modified behaviour We throw instead of showing warning now * style: format [skip ci] --------- Co-authored-by: Ankush Menat <ankush@frappe.io>
# [14.31.0](v14.30.0...v14.31.0) (2023-04-04) ### Bug Fixes * allow `reset_otp_secret` only if Two Factor Auth is enabled ([#20506](#20506)) ([#20561](#20561)) ([ca486c4](ca486c4)) * allowed only POST and PUT methods in `rename_doc` ([#20504](#20504)) ([#20565](#20565)) ([fd1f6fe](fd1f6fe)) * bulk update using doc method, check perms ([#20522](#20522)) ([2237968](2237968)) * cannot restore cancelled document if workflow is active ([547efe3](547efe3)) * Check if reference_name is set ([2e9068b](2e9068b)) * content_type can be `None` during file upload ([#20572](#20572)) ([#20574](#20574)) ([ebc6059](ebc6059)) * date field shouldn't be formatted for TZ ([#20486](#20486)) ([#20490](#20490)) ([07b7b46](07b7b46)) * don't hide tab with dashboard if there is a visible section/control ([084e8af](084e8af)) * Drop message_id index before migrating email queue ([#20376](#20376)) ([#20578](#20578)) ([394c232](394c232)) * email linking and message_id indexing ([#20356](#20356)) ([#20579](#20579)) ([5ae94ef](5ae94ef)) * escape HTML instead of sanitizing ([2269d6e](2269d6e)) * fix address query for postgres ([f01566a](f01566a)), closes [/github.com//pull/20537#ref-pullrequest-1645575433](https://github.com//github.com/frappe/frappe/pull/20537/issues/ref-pullrequest-1645575433) * get workflow_state_fieldname instead of setting workflow_state to none ([bac4e9b](bac4e9b)) * Handle JsBarcode exceptions ([#20532](#20532)) ([b1c3d8b](b1c3d8b)) * heatmap not reset on dashboard refresh ([3c0659b](3c0659b)) * hide chart and heatmap on dashboard reset ([cec7a73](cec7a73)) * Incorrect use of the Walrus operator ([a70a5ca](a70a5ca)) * nestedset rename ([#20498](#20498)) ([#20499](#20499)) ([b831392](b831392)) * removed unnecessary usage of `[@frappe](https://github.com/frappe).whitelist` ([#20503](#20503)) ([#20563](#20563)) ([0af8315](0af8315)) * rewrite query for postgres ([#20557](#20557)) ([#20559](#20559)) ([d754be5](d754be5)) * sending mails to unintended recipients as cc ([1c47643](1c47643)) * **UI:** align link cards & charts on workspace ([82cfd33](82cfd33)) * unsubscribe from list_update before resubbing ([#20450](#20450)) ([#20581](#20581)) ([7866605](7866605)) * use chart type passed to `render_graph` on form dashboards ([015f7db](015f7db)) ### Features * Disable Sharing globally (backport [#20318](#20318)) ([#20492](#20492)) ([67a537c](67a537c)) * list-view click and drag on check box to select multiple rows (backport [#20457](#20457)) ([#20568](#20568)) ([f757a37](f757a37)) * make workflow state translatable ([#20412](#20412)) ([8675789](8675789)) * **util:** `get_table_name`: wrap in backticks ([#20553](#20553)) ([#20556](#20556)) ([5c56dff](5c56dff)) ### Performance Improvements * Faster address query with explicit joins (backport [#20537](#20537)) ([#20540](#20540)) ([2ef7ef5](2ef7ef5)) * unsubscribe from list_update events ([#20423](#20423)) ([#20580](#20580)) ([8a63144](8a63144))
# [13.52.0](v13.51.3...v13.52.0) (2023-04-04) ### Bug Fixes * better error logging while sending email ([#20570](#20570)) ([8ae4d55](8ae4d55)) * cannot restore cancelled document if workflow is active ([6206dc0](6206dc0)) * escape HTML instead of sanitizing ([68ad9cf](68ad9cf)) * fix address query for postgres ([616dd8b](616dd8b)), closes [/github.com//pull/20537#ref-pullrequest-1645575433](https://github.com//github.com/frappe/frappe/pull/20537/issues/ref-pullrequest-1645575433) * get workflow_state_fieldname instead of setting workflow_state to none ([3249aa2](3249aa2)) * removed unnecessary usage of `[@frappe](https://github.com/frappe).whitelist` ([#20503](#20503)) ([#20562](#20562)) ([08398cb](08398cb)) * rewrite query for postgres ([#20557](#20557)) ([#20558](#20558)) ([e400c5f](e400c5f)) ### Features * Disable Sharing globally ([#20318](#20318)) [backport] ([#20500](#20500)) ([758873c](758873c)) * make workflow state translatable ([#20412](#20412)) ([#20501](#20501)) ([1545fbd](1545fbd)) ### Performance Improvements * Faster address query with explicit joins (backport [#20537](#20537)) ([#20539](#20539)) ([955a723](955a723))
Awesome! Would it not make more sense to actually hide the Share div from the sidebar when this feature is enabled though? :) |
@iMoshi in the case where sharing is disabled after a document is already shared with some users, we would probably still want to see who all can view this document. Seemed consistent with the behaviour when a user has no share access. |
Docs: https://docs.erpnext.com/docs/v14/user/manual/en/setting-up/settings/system-settings/edit-wiki?wiki_page_patch=57c20f0965
Issue:
Enable or Disable document sharing system wide
Checkbox in System Settings which is unchecked by default to maintain old behaviour
![Screenshot 2023-03-14 at 8 11 34 PM](https://user-images.githubusercontent.com/25857446/225041119-a1f913e2-6554-4724-8e58-edc1c2e3eb7c.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-14 20 26 04](https://user-images.githubusercontent.com/25857446/225041732-99ea1756-2445-4d9d-a548-d87b201bfaad.gif)
On invoking the share API without
![2023-03-14 20 33 34](https://user-images.githubusercontent.com/25857446/225044263-75334d2d-0988-4a82-bf64-da69dd4d18c7.gif)
ignore_share_permissions
(form the browser), a perm error is thrownIf any share API is invoked with
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