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

Exclude users from sharing if they are a member of any excluded group #31490

Merged
merged 1 commit into from
Jun 8, 2018

Conversation

tomneedham
Copy link
Contributor

@tomneedham tomneedham commented May 21, 2018

Description

Sharing is disabled, if a user is a member of any of the excluded groups.

Related Issue

https://github.com/owncloud/enterprise/issues/2508

Motivation and Context

The existing feature is redundant if the user gets added to another group.

How Has This Been Tested?

Manually.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

return true;
}
$matchingGroups = array_intersect($usersGroups, $excludedGroups);
if(!empty($matchingGroups)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

s/if(/if (/
Pretty sure php-cs-fixer wants a space between if and (

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed - still need to cache this in my brain-memory

}
$matchingGroups = array_intersect($usersGroups, $excludedGroups);
if(!empty($matchingGroups)) {
// If the user is a member of any of the exlucded groups they cannot use sharing
Copy link
Contributor

Choose a reason for hiding this comment

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

s/exlucded/excluded/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@phil-davis
Copy link
Contributor

@paurakhsharma as you happen to be working on expanding sharing API acceptance tests, it would be good to cover scenarios for this kind of thing.

@tomneedham tomneedham force-pushed the exclude-groups-frompsharing branch from f69e145 to 4353cb7 Compare May 22, 2018 09:47
@codecov
Copy link

codecov bot commented May 22, 2018

Codecov Report

Merging #31490 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #31490      +/-   ##
============================================
- Coverage     62.83%   62.83%   -0.01%     
+ Complexity    18371    18370       -1     
============================================
  Files          1151     1151              
  Lines         69058    69057       -1     
  Branches       1260     1260              
============================================
- Hits          43395    43394       -1     
  Misses        25294    25294              
  Partials        369      369
Flag Coverage Δ Complexity Δ
#javascript 52.39% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 64.04% <100%> (-0.01%) 18370 <0> (-1)
Impacted Files Coverage Δ Complexity Δ
lib/private/Share20/Manager.php 97.21% <100%> (-0.01%) 226 <0> (-1)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5659036...a1827de. Read the comment docs.

@tomneedham tomneedham force-pushed the exclude-groups-frompsharing branch from 4353cb7 to 4f0eaf5 Compare May 22, 2018 09:48
@phil-davis phil-davis changed the title Exclude users from sharing if they are a member of any exluded group Exclude users from sharing if they are a member of any excluded group May 22, 2018
@tomneedham
Copy link
Contributor Author

Fixes #16346

@paurakhsharma
Copy link
Member

Ok I will look into it.

@PVince81
Copy link
Contributor

needs @pmaier1 approval for this change of behavior

we can still carry on and write acceptance tests as we need them anyway for groups exclusion

@PVince81
Copy link
Contributor

Ok, so this was approved already.

Need to carry on with acceptance tests and code review

@tomneedham
Copy link
Contributor Author

I need to fix the tests

@PVince81
Copy link
Contributor

Estimate to completion: 1md (dev + QA tests) @tomneedham @patrickjahns

@phil-davis
Copy link
Contributor

@paurakhsharma will look on Monday and first make some acceptance tests in master that check the the "easy" behavior when the user is in just the "excluded from sharing" group. Then add a commit to this PR with tests for the case when the user is in the "excluded from sharing" group and also in other group(s).

@PVince81
Copy link
Contributor

@tomneedham code change looks good but PR is missing a unit test. Please add it!

@tomneedham tomneedham force-pushed the exclude-groups-frompsharing branch from 4f0eaf5 to a1827de Compare June 1, 2018 10:59
Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍

@phil-davis acceptance tests to be added separately or on this PR ?

@phil-davis
Copy link
Contributor

If we can resolve #31580 so I can get these "exclude groups" settings easily in the capabilities (which is the way acceptance tests handle most of these sort of file-sharing options) then I can do the acceptance tests "in no time".

@PVince81
Copy link
Contributor

PVince81 commented Jun 8, 2018

I'll merge this, please separate PR for acceptance tests

@PVince81 PVince81 merged commit 63c26f1 into master Jun 8, 2018
@PVince81 PVince81 deleted the exclude-groups-frompsharing branch June 8, 2018 09:59
@PVince81
Copy link
Contributor

PVince81 commented Jun 8, 2018

please backport

@phil-davis
Copy link
Contributor

Issue #31696 for acceptance tests, so we do not forget.

@phil-davis
Copy link
Contributor

@tomneedham backporting?
I guess it would be nice to get this in stable10 for 10.0.9.

@mmattel
Copy link
Contributor

mmattel commented Jun 12, 2018

Question, where can you define that a group is an excluded group for sharing?

@phil-davis
Copy link
Contributor

Settings, Admin, Sharing. Check box "Exclude groups from sharing". Then you see a box to input group names.

@mmattel
Copy link
Contributor

mmattel commented Jun 12, 2018

got it, thanks a lot 😄

@phil-davis
Copy link
Contributor

See #31819 for another place where this logic lives.

@PVince81
Copy link
Contributor

issue raised here #31820, need to look into steps to confirm this

@lock
Copy link

lock bot commented Jul 30, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants