resolve user and groups in nested groups first before filtering the results#14464
Merged
resolve user and groups in nested groups first before filtering the results#14464
Conversation
1e00d56 to
09357b8
Compare
Member
Author
|
Member
Merged. |
Currently groupsMatchFilter is called before nested groups are resolved.
This basicly breaks this feature since it is not possible to inherit
membership in a group from another group.
Minimal example:
Group filter: (&(objectClass=group),(cn=nextcloud))
Nested groups: enabled
cn=nextcloud,ou=Nextcloud,ou=groups,dn=company,dn=local
objectClass: group
cn=IT,ou=groups,dn=company,dn=local
objectClass: group
memberOf: cn=nextcloud,ou=Nextcloud,ou=groups,dn=company,dn=local
cn=John Doe,ou=users,dn=company,dn=local
objectClass: person
memberOf: cn=IT,ou=groups,dn=company,dn=local
Since 'cn=IT,ou=groups,dn=company,dn=local' doesn't match the group
filter, John wouldn't be a member of group 'nextcloud'.
This patch fixes this by filtering the groups after all nested groups
have been collected. If nested groups is disabled the result will be the
same as without this patch.
Signed-off-by: Roland Tapken <roland@bitarbeiter.net>
The previous patch fixed the problem only for one level of indirection because groupsMatchFilter() had been applied on each recursive call (and thus there would be no second level if the first level fails the check). This new implementation replaces the recursive call with a stack that iterates all nested groups before filtering with groupsMatchFilter(). Signed-off-by: Roland Tapken <roland@bitarbeiter.net>
Nested groups are now cached in a CappedMemoryCache object to reduce queries to the LDAP backend. Signed-off-by: Roland Tapken <roland@bitarbeiter.net>
…anymore. Signed-off-by: Roland Tapken <roland@bitarbeiter.net>
and also consolidate logic in one method Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
14315cc to
ca963fa
Compare
…more Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
ca963fa to
dfc7007
Compare
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
|
🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 16802: failureTESTS=acceptance, TESTS-ACCEPTANCE=app-files
Show full logTESTS=acceptance, TESTS-ACCEPTANCE=app-files-sharing
Show full logTESTS=acceptance, TESTS-ACCEPTANCE=app-files-sharing-link
Show full log |
Member
Author
|
failing tests are unrelated |
Member
Author
|
/backport to stable15 |
Member
Author
|
/backport to stable14 |
ChristophWurst
approved these changes
Mar 7, 2019
Member
ChristophWurst
left a comment
There was a problem hiding this comment.
🐘, but 👍 because there are tests 😉
rullzer
approved these changes
Mar 7, 2019
Member
rullzer
left a comment
There was a problem hiding this comment.
Makes sense. And tests so lets 🎢
|
The backport to stable15 failed. Please do this backport manually. |
|
The backport to stable14 failed. Please do this backport manually. |
This was referenced Mar 7, 2019
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Continuation of #8227
As described by @Cybso in #8227 (comment), when users were not part directly of a whitelisted group, but of an excluded subgroup, they would wrongly not appear as member of the top group. While the excluded groups should not be used and shown in Nextcloud, their users still qualify to be associated with the top group. Users are only subject to user filter and user base restrictions.
We have had three places covering the nesting logic aka recursive lookup. I continued @Cybso approach to cover all cases, and consolidating it into one. Plus, integration tests make sure that all desired users are being found :)