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

LDAP auth: get user information to fill full name and/or address #973

Closed
arno-st opened this issue Sep 14, 2017 · 14 comments
Closed

LDAP auth: get user information to fill full name and/or address #973

arno-st opened this issue Sep 14, 2017 · 14 comments
Labels
enhancement General tag for an enhancement

Comments

@arno-st
Copy link
Contributor

arno-st commented Sep 14, 2017

I suggest to enhanced the LDAP authentication to be able to have 2 fields that allow to fill the full username and the email address, based on LDAP fields.

I have the code to change that, it touch:
include/global_settings.php (2 mores files when selecting LDAP auth, to have the CN for full username and email)
lib/auth.php (change the user copy function to add the email address update)
lib/ldap.php (add a function ldap_search_fileds to find the 2 news fields)
auth_login.php (add the rule to ask the fileds whend auto create a new user)

@cigamit
Copy link
Member

cigamit commented Sep 14, 2017

Great, idea, you would need to extend this to the user_auth_domains table too. We would welcome a pull request from you of course.

@cigamit cigamit added the enhancement General tag for an enhancement label Sep 14, 2017
@cigamit
Copy link
Member

cigamit commented Sep 14, 2017

I see you are working on a pull. That's great. If you need assistance figuring anything out, just comment here.

@arno-st
Copy link
Contributor Author

arno-st commented Sep 14, 2017

You lost me!
I can't find this user_auth_domains table, i don't have it on my 1.1.23 version, is it based on 'user domains' under configuration ?
If so how did you define on which domain you log on ? (username@domain or something like that ?)

And I need a little help, with my modification on global_setting, the 2 new fields are displayed all the time, but it should be only when you select ldap as authentication method, can you give me some hint how the optional display is done ?
I will have to use also on the user domains settings
thanks

@cigamit
Copy link
Member

cigamit commented Sep 14, 2017

My bad. It's 'user_domains_ldap'. That table replicates the settings in the settings table as columns. So, if I read your thread correctly, you will need two new columns, one for the email CN, and the other for the full name CN.

I would call the columns just as you see them:

cn_email
cn_full_name

Make them a varchar(20) or so, with a default of ''.

You will need an update script in the install/updates directory. That's pretty strait forward, and you will also need to update cacti.sql.

In user_domains.php, you will need to add the two columns as 'textbox' form elements, and finally, modify the sql_save() to include them.

In the lib/ldap. There is a function (for legacy), and the class. You will have to update both.

It's a great little project to kind of familiarize yourself with the user interface.

Lastly, please create your pull request against feature-1.2 branch and not the develop branch.

Thanks!

@cigamit
Copy link
Member

cigamit commented Sep 14, 2017

The rest of the plan looks pretty good. I will review you work. So, no worries.

@arno-st
Copy link
Contributor Author

arno-st commented Sep 15, 2017

So I finish to write the code, but still one minor problem, on the authentication page, I'm unable to display my 2 new fileds only when selecting LDAP as authentication method, it's always there.
can you give me a clue where to look ?

@cigamit
Copy link
Member

cigamit commented Sep 15, 2017

Post a screen shot of what you see now, and then if you would mock it up using paint, then I'll explain what to do.

@arno-st
Copy link
Contributor Author

arno-st commented Sep 15, 2017

authentication with CN fields.docx

The 3 last fields

@cigamit
Copy link
Member

cigamit commented Sep 15, 2017

So, the display is all done using jQuery. Why don't you create the pull request against feature-1.2 branch, and then I'll do the visibility settings.

@cigamit
Copy link
Member

cigamit commented Sep 15, 2017

It's pretty simple though. Say you have a text field called "cn_email", you can do $('#row_cn_email').show(); to display it and $('#row_cn_email').hide(); to hide it.

@arno-st
Copy link
Contributor Author

arno-st commented Sep 15, 2017

Ok I find it, I new it was simple, but where unable to find where.
I saw into setting.php
So I made the change and it works.

I did the pull request, have fun !
If i need to change anything I will do it Tuesday

@cigamit
Copy link
Member

cigamit commented Sep 16, 2017

I just had a few comments as did Kevin. Keep up the good work. There are just a few updates for you.

@cigamit
Copy link
Member

cigamit commented Sep 16, 2017

Resolved. Will be a part of the 1.2 release.

@cigamit cigamit closed this as completed Sep 16, 2017
@cigamit
Copy link
Member

cigamit commented Sep 16, 2017

I did some whitespace cleanup. You should setup your vim sessions to use a tab stop of 4 characters:

vim ~/.vimrc
set ts=4

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement General tag for an enhancement
Projects
None yet
Development

No branches or pull requests

2 participants