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

unify count filters and introduce display name attribute detection #11837

Merged
merged 14 commits into from Nov 24, 2014

Conversation

blizzz
Copy link
Contributor

@blizzz blizzz commented Oct 29, 2014

This fixes #11328 and introduces some bigger changes.

  1. we introduce the detection of the display name attribute, because on not so few LDAP setups "displayname" is not present. The detectors first checks whether there are entries having "displayname" according to the current user filter. If not it checks "cn". "cn", short for "common name" should be available everywhere. If necessary we can extend it with "uid" and "samaccountname" although those are not meant to be displayed to users. This also ensures that users will be able to log in since a present display name is a condition.
  2. The wizard and the user backend created different filters for counting users by there own. They have been consolidated in Access and are used by both. The created filter also takes display name into account, and the number of LDAP users in user managament and wizard is now the same.
  3. We now have three detectors, one for the email attribute and one for the group member association was already there. They were called in several places, now I cleaned it up so that they are always one run just before a count action. For setups using the totally assisted mode it means that the detectors will run anyway. They will also run in experienced mode, when "test filter" is clicked. To make sure they run even if the button is not clicked, we watch the state and run them ONCE when the user respectively group tab is left. All in all that saves some initiated and cancelled calls.
  4. The wizard backend was improved in a way that for certain count operations a flag can be set limits the query to just 1. We need this to verifiy whether an attribute does still work with the current filter (email, displayname) where it is not necessary to count every single object, one presence is enough. This is done to avoid another full detection run. Also, when determining the display name this limit is used. I.e. those actions are faster now. It incorporates a fix where the limit was not respected properly in the count method (no side effects as it was not used anywhere else).
  5. it incorporates a fix where the email attribute was detected and presented in the user interface, but not saved.

While testing i have seen some disbehaviour in the wizard which however is also present in master. Those I will investigated independtly from this PR.

Call for comments, tests and reviews @craigpg @jnfrmarks @PVince81 @Xenopathic @butonic

@@ -151,8 +151,10 @@ var LdapWizard = {
ajaxRequests: {},

ajax: function(param, fnOnSuccess, fnOnError, reqID) {
if(reqID !== undefined) {
if(typeof reqID !== 'undefined') {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can also use _.isUndefined(reqID)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ty

@PVince81
Copy link
Contributor

Soooo much code for detectors. I hope that one day we'll be able to refactor these JS classes and make them a bit easier to understand.

} else if (this.target === 'Group') {
LdapWizard.countGroups(doneCallback);
}
var beforeUpdateCountDone = $.Deferred();
Copy link
Contributor

Choose a reason for hiding this comment

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

You could make beforeUpdateCount create the $.Deferred() instead of here.
This way you only need to write $.when(this.beforeUpdateCount()).done(...)

Copy link
Contributor

Choose a reason for hiding this comment

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

It would make it more readable.

@PVince81
Copy link
Contributor

I'm not sure how to test this with openLDAP ?
When using master with your zombie script (batchCreateUsers) all users already have a "displayName" attribute and it seems to be detected on master already.

Should I try and create users that have "cn" as display name and see whether it's detected on this branch ?

@blizzz
Copy link
Contributor Author

blizzz commented Oct 29, 2014

@PVince81 one way is to manually set the display name to something unexisting, and trigger a count action again ("Test Filter" button on User filter in experienced mode, or by changing the user list filter). Displayname should be found correctly again.

To test for cn, create a users which is not of inetOrgPerson objectclass to avoid display name and configure the user list filter to only find them.

@blizzz
Copy link
Contributor Author

blizzz commented Oct 29, 2014

@PVince81 thanks for reviewing and your suggestions!

@ghost
Copy link

ghost commented Nov 4, 2014

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/1944/
🚀 Test PASSed. 🚀

@blizzz
Copy link
Contributor Author

blizzz commented Nov 4, 2014

@PVince81 satisfied?

others: More testers or reviewers? 💐

@blizzz
Copy link
Contributor Author

blizzz commented Nov 11, 2014

cc @MorrisJobke :octocat:

@MorrisJobke
Copy link
Contributor

The display name is detected successfully. But I don't know how to properly review this.

I would give this a thumbs up, but I can't decide on the quality of the code. 👍

@LukasReschke
Copy link
Member

As discussed with @blizzz via IRC I'll review this (in exchange for 🍻) ;-)

/**
* called after detectors have run
* @callback runDetectorsCallback
*/
Copy link
Member

Choose a reason for hiding this comment

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

Seems somewhat lonely and without context to me that comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's how JS doc works :) This defines the runDetectorsCallback used in the following method.

Copy link
Member

Choose a reason for hiding this comment

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

Okay. Good to know. Black magic that is. ;-)

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
Copy link
Contributor Author

blizzz commented Nov 19, 2014

Best currency that is!

@@ -1168,6 +1170,18 @@ private function getFilterPartForSearch($search, $searchAttributes, $fallbackAtt
}

/**
* returns the filter used for counting users
*/
Copy link
Member

Choose a reason for hiding this comment

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

 * @return string

@LukasReschke
Copy link
Member

Works, but I wonder why it shows "0 users" found instead of my user count at the setup? - The users are shown correctly on the users page.

Recorded video of setup at https://s3.owncloud.com/owncloud/public.php?service=files&t=0a1b1a586e577884c49e25fa6710762f

If I access the page after the setup the correct numbers of users (7) is shown, but not before. This is kinda confusing.

@LukasReschke LukasReschke added this to the 2014-sprint-08-current milestone Nov 19, 2014
@blizzz
Copy link
Contributor Author

blizzz commented Nov 20, 2014

Hm, maybe it could make sense to trigger as user count instead of a group one in that case.

@blizzz
Copy link
Contributor Author

blizzz commented Nov 21, 2014

Needed adjustments for current master and got a fix when paging size is set to 0.

@MorrisJobke @LukasReschke @PVince81 like to revisit?

@LukasReschke
Copy link
Member

I actually don't really like to do it. But I'll do it anyways - you know the deal ;-)

@blizzz
Copy link
Contributor Author

blizzz commented Nov 21, 2014

yeah, yes you break it anyway and even expect 🍻 for it. But that's 👌

@LukasReschke
Copy link
Member

Port is a number and therefore not shown correctly:
screen shot 2014-11-21 at 16 36 31

@LukasReschke
Copy link
Member

Rest works - port should get fixed though, might also exist on master. 👍

@blizzz
Copy link
Contributor Author

blizzz commented Nov 21, 2014

@LukasReschke yes, port field needs to be addressed on master, but a different issue (and the same without this PR). Thx for your thumb!

…n with xp'ed mode (would be a regression otherwise)
@scrutinizer-notifier
Copy link

The inspection completed: 16 new issues, 5 updated code elements

@LukasReschke
Copy link
Member

@blizzz This will most likely not work properly. Solution is to create a new branch, cherry-pick the commits to it, and create a new PR to have CI run over it.

@MorrisJobke
Copy link
Contributor

@blizzz This will most likely not work properly. Solution is to create a new branch, cherry-pick the commits to it, and create a new PR to have CI run over it.

Checkout the branch and then directly create a new branch (no cherry-picking needed) just clone the branch ;)

@MorrisJobke
Copy link
Contributor

I will take care of this.

@MorrisJobke MorrisJobke mentioned this pull request Nov 24, 2014
@MorrisJobke
Copy link
Contributor

Placeholder PR is in #12388

@MorrisJobke
Copy link
Contributor

From #12388 (comment)
🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3135/
🚀 Test PASSed. 🚀

@MorrisJobke MorrisJobke self-assigned this Nov 24, 2014
@blizzz
Copy link
Contributor Author

blizzz commented Nov 24, 2014

Now I need one more thumb :) Since, after @MorrisJobke 's one there were more changes, adapting to master. 🐫

@MorrisJobke
Copy link
Contributor

@blizzz I know ... but I need time to recover from all the issues that rain on me 🌈

@MorrisJobke
Copy link
Contributor

That's also the reason why I assigned it to myself ;)

@MorrisJobke
Copy link
Contributor

I tested this. The user count on the filter page is updated correct. (I dropped the user name for one user and it got updated) 👍 as it works as expected (login for ldap users work and the login for the one without displayname doesn't work)

MorrisJobke added a commit that referenced this pull request Nov 24, 2014
unify count filters and introduce display name attribute detection
@MorrisJobke MorrisJobke merged commit 02095d4 into master Nov 24, 2014
@MorrisJobke MorrisJobke deleted the fix-11328 branch November 24, 2014 17:13
@blizzz
Copy link
Contributor Author

blizzz commented Nov 24, 2014

Thanks @MorrisJobke ! 🌟

@karlitschek backport? It fixes #11328 but also adds required functionality and thus it's a big PR. @jnfrmarks rated it with high severity.

@karlitschek
Copy link
Contributor

Backport is fine in this case.

@jnfrmarks
Copy link

@blizzz @craigpg

What is the new functionality? Is there a lot of risk to LDAP with this change?

@blizzz
Copy link
Contributor Author

blizzz commented Nov 25, 2014

Detecting display name attribute is new. There are not so small changes to the LDAP wizard code. I think we tested it good, but the amount of changes makes it potentially risky imho.

@MorrisJobke MorrisJobke removed their assignment Oct 5, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Aug 9, 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.

LDAP: Number of users on user filter tab does not match number of users showing up on oC user page
7 participants