-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add exclude_groups_from_sharing to capabilities #31580
Conversation
Codecov Report
@@ Coverage Diff @@
## master #31580 +/- ##
============================================
- Coverage 63.27% 63.26% -0.01%
- Complexity 18479 18483 +4
============================================
Files 1161 1161
Lines 69377 69386 +9
Branches 1261 1261
============================================
+ Hits 43895 43900 +5
- Misses 25112 25116 +4
Partials 370 370
Continue to review full report at Codecov.
|
d5299d0
to
9fb33f0
Compare
| files_sharing | groups_excluded_from_sharing@@@element[1] | | ||
| files_sharing | groups_excluded_from_sharing@@@element[2] | | ||
|
||
@skip @issue-enterprise-2508 |
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.
This scenario should be fixed by #31490 - so when/if this PR is merged, this skip
line can be removed in that PR.
9fb33f0
to
3fd24df
Compare
@PVince81 please have a look and see if I have done reasonable stuff here. I am not familiar with exactly how the DI should be done to get hold of the user and group classes so as to work out if the user is an admin. But this code does work. |
@@ -103,6 +131,20 @@ public function getCapabilities() { | |||
$res['share_with_group_members_only'] = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'yes') === 'yes'; | |||
$res['share_with_membership_groups_only'] = $this->config->getAppValue('core', 'shareapi_only_share_with_membership_groups', 'yes') === 'yes'; | |||
|
|||
if ($this->isAdmin()) { | |||
$res['exclude_groups_from_sharing'] = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'yes') === 'yes'; |
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.
in general admins already have access to the config APIs and would be able to retrieve the value from there (which the settings page does), so not sure we really need that in the capabilities for admins
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.
what to do?
do I look somewhere in "config APIs" to get these settings during acceptance test scenarios?
do I remove the code here?
(which will leave just the calculation of can_share
which was just a bonus when I started this)
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.
hmm, the "config APIs" are likely a private endpoint... see https://github.com/owncloud/core/blob/v10.0.8/core/js/config.js#L11
We'll likely need to expose those private APIs using public API format (OCS or Webdav)
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.
@phil-davis any reason you need to read any detailed config values during tests ? you could simply set the value to something known so you know it's set during test setup as part of the prerequisite ?
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.
No, we do not have to read back the values. It was just that for other "system/app settings" (at least the ones we used so far), the current setting could be found in capabilities. So I was just maintaining consistency.
We can let the tests make the settings and then the next test steps will observe the changed behavior. If the behavior does not change then either the setting change failed or theere is a bug in the behavior.
The DI looks ok. See my comment about the admin part. |
3fd24df
to
9770be2
Compare
9770be2
to
fcb267e
Compare
I'd rather not expose this setting if there is no need for clients to know this information, considering that it's conditional. So it's not really a capability any more as it depends on the logged in user. I see you added some utility functions for tests, maybe we could keep those though? |
which setting do you mean: |
I will look through and separate out useful acceptance test stuff related to processing lists in returned xml - that will be good for other stuff in capabilities and... that can have more/better tests. |
I meant not exposing "exclude_groups_from_sharing". we can keep "can_share" |
fcb267e
to
e39b0cd
Compare
e39b0cd
to
13dac01
Compare
I rebased this to sit on top of the |
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.
👍
backport? |
@PVince81 the This PR here is the remaining code, which reports the I didn't think that you wanted to add this stuff to the capabilities report? But I am very happy to have it available - it will make tests flow easily. |
I didn't. When I saw the PR I thought it was the updated version where this one was removed already without looking more closely. Reverting... |
revert PR here #31937 |
This part is not being implemented. Backport request removed. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
In the capabilities API response,
files_sharing
section, add:and only report this if the user is an admin.
In the capabilities API response,
files_sharing
section, add:Set to
true
if the user requesting the capabilities can do sharing (i.e. the sharing API is enabled and the user is not excluded from sharing). Otherwise set to ``false```.This capability could be used by a client app to, for example, decide if the client app should bother to display UI elements for adding shares...
Related Issue
#31576
Motivation and Context
The setting of "exclude groups from sharing and the list of groups that are excluded is not in the capabilities API response.
How Has This Been Tested?
Local API test runs, and browsing to the capabilities URL.
Types of changes
Checklist: