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

Fixed dynamic group ldap access #23344

Closed
wants to merge 5 commits into from
Closed

Fixed dynamic group ldap access #23344

wants to merge 5 commits into from

Conversation

alexweirig
Copy link
Contributor

getUserGroups:
Using $userDN instead of $uid to query LDAP
Converting groupDN to group name using API instead of substring
Removing cache processing at the end of the method

getUserGroups:
Using $userDN instead of $uid to query LDAP
Converting groupDN to group name using API instead of substring
Removing cache processing at the end of the method
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @blizzz, @leo-b and @GreenArchon to be potential reviewers

@ghost
Copy link

ghost commented Mar 17, 2016

@alexweirig

Thanks a lot for your contribution!
Contributions to the core repo require a signed contributors agreement http://owncloud.org/about/contributor-agreement/

Alternatively you can add a comment here where you state that this contribution is MIT licensed.

Some more details about out pull request workflow can be found here: http://owncloud.org/code-reviews-on-github/

@MorrisJobke
Copy link
Contributor

cc @owncloud/ldap

if(isset($this->cachedGroupsByMember[$uid])) {
$groups = $this->cachedGroupsByMember[$uid];
} else {
$groups = array_values($this->getGroupsByMember($uid));
Copy link
Contributor

Choose a reason for hiding this comment

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

this and following line is still necessary, or did I oversee anything?

Copy link
Contributor

Choose a reason for hiding this comment

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

Of course it should not overwrite, but append to $groups

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@blizzz
I don't know (yet) how your caching is working? Is that cache in the DB or in memory. I have the impression (can't prove it yet) that something goes wrong with the caching because of the cachekeys. At the top of the function the cachekey is generate with the uid and then the cache is read, but at the end of the method, the cachedGroupByMember is written with the userDN (in our case).
I'm trying to put back the cache code in place and just noticed that although the dynamic groups are now working in my code, the "static" groups (based on "uniquemember") are no longer being added to the groups list...

Copy link
Contributor

Choose a reason for hiding this comment

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

$this->cachedGroupsByMember[$uid]

only exists on run-time. It is a member array of the class instance.

What should not be kept is the caching part, but the fetching of the other groups.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@blizzz
I think I've got the groups working (both dynamic and static) ... but I need to do some more tests and get back on Monday.

Copy link
Contributor

Choose a reason for hiding this comment

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

@alexweirig sounds great, thank you.

alexweirig added 2 commits March 21, 2016 08:06
added back the cache processing and fixed
spaces -> tab conversion
@alexweirig
Copy link
Contributor Author

@blizzz

I committed my latest code changes that have both dynamic and static groups being correctly returned.

I'm still having performance issues but I'm wondering if this might not be a rendering time issue. Maybe it's that multi-select combobox that is causing the problem since it's being loaded with some 50 groups for each user if LDAP returns 500 users, thats 25.000 entries?

@alexweirig
Copy link
Contributor Author

@blizzz

When looking at the server processes and the rendering in the browser, I get the impression that the poor performance is indeed in the Javascript processing of the users list.
Has anybody else reported a similar concern? I know you've got huge customers that have gazillions of users so they should face this problem too?

@alexweirig
Copy link
Contributor Author

@blizzz
Here're some interesting results for the rendering performance:
Safari : +/- 30 seconds to render the page
Chrome: +/- 11 seconds to render the page
Firefox: +/- 11 seconds to render the page

These results are reproducible at will.

Even though FF and Chrome are not fast, they're significantly faster than Safari. I don't have any other browser to compare to. All browsers are updated at their latest version.

@ghost
Copy link

ghost commented Mar 21, 2016

@alexweirig

Thanks a lot for your contribution!
Contributions to the core repo require a signed contributors agreement http://owncloud.org/about/contributor-agreement/

Alternatively you can add a comment here where you state that this contribution is MIT licensed.

Some more details about out pull request workflow can be found here: http://owncloud.org/code-reviews-on-github/

@alexweirig
Copy link
Contributor Author

@blizzz
I checked how our patched (to support dynamic groups) oc 8.2.1 performs when building the users list:
Safari takes about 11 seconds while Chrome and Firefox take about 5 seconds to build the users list.

So something has changed that performs very badly ... twice as slow on Chrome and FF and about 3 times as slow on Safari.

@blizzz
Copy link
Contributor

blizzz commented Mar 21, 2016

Yeah, rendering performance is really bad. What also changed compared to older version is that we initially load more users. This will add up to the fun :( Otherwise nothing really changed with the Users page AFAIK.

@blizzz blizzz added this to the 9.1-current milestone Mar 21, 2016
@blizzz
Copy link
Contributor

blizzz commented Mar 21, 2016

The code looks good, I'll give it some tests after lunch.

@alexweirig in the past you declared your code MIT. Do you do again? #23344 (comment)

}
$groupName = $this->access->dn2groupname($dynamicGroup['dn'][0]);
if(is_string($groupName)) {
// be sure to never return false if the dn could not be
Copy link
Contributor

Choose a reason for hiding this comment

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

the indentation is broken (seen in my IDE), please use tabs instead of spaces.

alexweirig added 2 commits March 21, 2016 16:28
Using tabs now
fixed another line with spaces instead of tab
@ghost
Copy link

ghost commented Mar 21, 2016

@alexweirig

Thanks a lot for your contribution!
Contributions to the core repo require a signed contributors agreement http://owncloud.org/about/contributor-agreement/

Alternatively you can add a comment here where you state that this contribution is MIT licensed.

Some more details about out pull request workflow can be found here: http://owncloud.org/code-reviews-on-github/

@blizzz
Copy link
Contributor

blizzz commented Mar 21, 2016

👍 only formatting issues (I'd just fix intention and ship it in the jenkins-PR)

@blizzz
Copy link
Contributor

blizzz commented Mar 21, 2016

Jenkins PR here: #23450

We need a second reviewer. At least make sure that group memberships are fetched and represented correctly for LDAP users, with and without memory cache confiugred. Maybe @owncloud/qa @PeteSSS @dbenz04 ?

@blizzz
Copy link
Contributor

blizzz commented Mar 23, 2016

@rperezb can we have some testing?

@PVince81
Copy link
Contributor

@SergioBertolinSG @davitol can you help testing?

@SergioBertolinSG
Copy link
Contributor

What are the steps here?
@blizzz

@blizzz
Copy link
Contributor

blizzz commented Mar 30, 2016

@SergioBertolinSG make sure that reading user groups (e.g. users page, personal page) continues to work. With and without configured memcache.

As plus, get an LDAP setup where dynamic group memberships are existing. @alexweirig perhaps might give pointers, if needed?

@alexweirig a wourd about your code's license or CLA?

@ghost
Copy link

ghost commented Apr 8, 2016

@SergioBertolinSG @davitol ping

@alexweirig
Copy link
Contributor Author

@blizzz our code is MIT licensed.

in order to use dynamic groups:

  1. create a group in LDAP with objectClass:
    top, groupofurls, groupofnames, posixgroup, extensibleObject
  2. set a CN, gidNumber
  3. add the attribute memberURL with a value like
    ldap://cn=users,dc=......??one?(some LDAP filter here to filter your users)

Then you can try to add/remove the attribute used in the filter to see if the users is added or removed to/from the group.

@alexweirig
Copy link
Contributor Author

@blizzz When looking at 9.0.1 it seems the contribution did not make it? Am I right?
Do you know what version will include our code?

@blizzz
Copy link
Contributor

blizzz commented Apr 11, 2016

@alexweirig yes, two reviewers are required to get this merged to master, subsequently we can do the backport for 9.0x. Thus, next possible release is 9.0.2.

@alexweirig
Copy link
Contributor Author

@blizzz OK, so you're one of the reviewers?

@alexweirig
Copy link
Contributor Author

@blizzz Anything new about this? Have you found a second reviewer?

I'd like to upgrade our owncloud but want to do so if I don't have to patch the code again and again on our server.

@PVince81
Copy link
Contributor

@SergioBertolinSG @davitol can you help testing this ?

@SergioBertolinSG
Copy link
Contributor

can you help testing this ?

Yes, I'll give it a try.

@SergioBertolinSG
Copy link
Contributor

@alexweirig regarding #23344 (comment)

How can I add this steps to an existing openldap server?

@alexweirig
Copy link
Contributor Author

@SergioBertolinSG Thanks for offering your support. Actually I don't think you need to add anything to the server. I would expect that it is enough to define a new group with the following objectClass(es):
groupofurls
nestedgroup
groupofnames (might event not be needed)
posixgroup
extensibleObject

You then add the following attributes:
cn
gidNumber
mail
memberURL

memberURL must have the following format:
ldap://the DN to your users??one?(an LDAP filter to identify a group of users)

this should give you a dynamic group that owncloud would be able to process and show you the list of users matching the filter

We're using a 389DS/IPA from RHEL so some terms tend to change compared to OpenLDAP.
Here's a link to a document with more details ...

HTH

Alex

@SergioBertolinSG
Copy link
Contributor

Trying to add ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/dyngroup.schema
to our ldap server, apparently this bug has appeared:
https://bugs.launchpad.net/ubuntu/+source/openldap/+bug/1392018

@ghost
Copy link

ghost commented Apr 20, 2016

#23344 (comment) @karlitschek what's the process for MIT-licensed code?

@karlitschek
Copy link
Contributor

if stated that the code is MIT licensed as above then this is fine. fully compatible and no cla needed. but this has been done in every pull request. in the long run a signed cla is easier for everyone

@ghost
Copy link

ghost commented Apr 20, 2016

thanks

@alexweirig
Copy link
Contributor Author

@karlitschek Hello, I'm sending you the CLA to the email address specified on the CLA website.

@alexweirig
Copy link
Contributor Author

Hello,
anything new on integrating the contribution into owncloud code?

Thanks

Alex

@PVince81
Copy link
Contributor

PVince81 commented May 9, 2016

@SergioBertolinSG @davitol @blizzz did you guys eventually managed to test this ?

@MorrisJobke
Copy link
Contributor

Let's move this forward in the internal PR because there are additional fixes included: #23450

@MorrisJobke
Copy link
Contributor

@alexweirig This is not dead - it was just moved to another branch and therefore another PR :)

@blizzz
Copy link
Contributor

blizzz commented May 17, 2016

@alexweirig the testing-branch was finally merged #23450 \o/ Thank you for the contribution and my sincere apologies it took so long to review and test it!

@lock
Copy link

lock bot commented Aug 5, 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 Aug 5, 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.

7 participants