No, I'm pretty sure there is no easy way of doing this. Assuming you are on a 1.7.x version of XNAT (rather than 1.6) and are using the LDAP plugin (https://bitbucket.org/xnatx/ldap-auth-plugin), you would have to download the plugin's source code and make some changes. Just glancing at the code, it might be sufficient to customize https://bitbucket.org/xnatx/ldap-auth-plugin/src/master/src/main/java/org/nrg/xnat/auth/ldap/XnatLdapUserDetailsMapper.java so that the mapUserFromContext method calls the cacheRegistrationData(found, comments, phone, lab) method that is called when registering through the XNAT UI (see https://bitbucket.org/xnatdev/xdat/src/master/src/main/java/org/nrg/xdat/turbine/modules/actions/XDATRegisterUser.java ). That is assuming that the context object in mapUserFromContext has a phone number property (you may want to do context.getAttributes() either in a debugger or writing the contents of the Attributes object to a log file to see what the names are for all the properties you care about and make sure that they are accessible here). So it may be possible, but it would require more advanced level XNAT customizations.
-Mike
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
You received this message because you are subscribed to a topic in the Google Groups "xnat_discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xnat_discussion/DAIgVS116tY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/DM6PR02MB5100C41425EF4D3B9573AD62BFB80%40DM6PR02MB5100.namprd02.prod.outlook.com.
No, I'm pretty sure there is no easy way of doing this. Assuming you are on a 1.7.x version of XNAT (rather than 1.6) and are using the LDAP plugin (https://bitbucket.org/xnatx/ldap-auth-plugin), you would have to download the plugin's source code and make some changes. Just glancing at the code, it might be sufficient to customize https://bitbucket.org/xnatx/ldap-auth-plugin/src/master/src/main/java/org/nrg/xnat/auth/ldap/XnatLdapUserDetailsMapper.java so that the mapUserFromContext method calls the cacheRegistrationData(found, comments, phone, lab) method that is called when registering through the XNAT UI (see https://bitbucket.org/xnatdev/xdat/src/master/src/main/java/org/nrg/xdat/turbine/modules/actions/XDATRegisterUser.java ). That is assuming that the context object in mapUserFromContext has a phone number property (you may want to do context.getAttributes() either in a debugger or writing the contents of the Attributes object to a log file to see what the names are for all the properties you care about and make sure that they are accessible here). So it may be possible, but it would require more advanced level XNAT customizations.
-Mike
From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of Timothy Yim <timt...@gmail.com>
Sent: Tuesday, September 3, 2019 10:24:46 PM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: [XNAT Discussion] How to display Phone number from LDAP/Active directory?
--We would like to ask if we can get the "phone number" from Active directory for account registration?
It can retrieved "Username", "First name", "Last name" and "email address". Please help. Thanks.
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/0b532769-1e6f-4428-a695-5d075301606b%40googlegroups.com.
That's because there is no getUserDetailsByNameAndAuth method that takes in a phone number. I was suggesting using cacheRegistrationData. That additional user information is stored separately.
-Mike
You received this message because you are subscribed to a topic in the Google Groups "xnat_discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xnat_discussion/DAIgVS116tY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/DM6PR02MB5100C92821676EC7ADE58F55BFBB0%40DM6PR02MB5100.namprd02.prod.outlook.com.
I don't understand. Where did you change "firstname" to "telephoneNumber" and what do you mean that it worked? I also don't understand your question.
-Mike
(actual and formal argument lists differ in length)
method XdatUserAuthService.getUserDetailsByNameAndAuth(String,String,String) is not applicable
(actual and formal argument lists differ in length)
method XdatUserAuthService.getUserDetailsByNameAndAuth(String,String,String,String) is not applicable
(actual and formal argument lists differ in length)
method XdatUserAuthService.getUserDetailsByNameAndAuth(String,String,String,String,String,String) is not applicable
(actual and formal argument lists differ in length)
1 errorTo view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/DM6PR02MB51004ED80187948774ED443CBFBB0%40DM6PR02MB5100.namprd02.prod.outlook.com.
This approach will not work. There are no versions of that method that take more fields and even though passing a phone number in as the firstname does not give you a build error, that does not mean it will work correctly.
What are you wanting? If you simply want LDAP phone numbers to be stored in XNAT just like phone numbers that users type in when registering through the XNAT site, you want to use the
cacheRegistrationData method to store that information in the
xhbm_user_registration_data table. However, this is currently only used in sending out new user emails, and the phone numbers will not be viewable from within the XNAT site.
And you'd actually want to use cacheUserRegistrationData since cacheRegistrationData is a private method. Basically just copy the two lines from XDATRegisterUser.cacheRegistrationData and pass in the phone number (if you're able to obtain it successfully):
UserRegistrationDataService service = XDAT.getContextService().getBean(UserRegistrationDataService.class);
service.cacheUserRegistrationData(newUser, phone, lab, comments);
-Mike
You received this message because you are subscribed to a topic in the Google Groups "xnat_discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xnat_discussion/DAIgVS116tY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/DM6PR02MB5100DDF12ADD146490E72F2ABFBB0%40DM6PR02MB5100.namprd02.prod.outlook.com.
The instructions from my original message in this thread still apply. I was just clarifying that you should actually be adding those two lines instead of adding a call to cacheRegistrationData. You'd of course also need to make sure you add imports for all the classes mentioned in those two lines and add the XNAT dependencies that contain those classes to the build.gradle file for the plugin as dependencies. But as I said, this is a more advanced customization and maybe not something that makes sense to take on.
-Mike