Author |
|
ThomasH Newbie
Joined: 29 January 2018 Location: Germany
Online Status: Offline Posts: 7
|
Posted: 29 January 2018 at 2:50am | IP Logged
|
|
|
Hello All,
I have an question regarding the Login form.
I want to login the user automatically depending on the Microsoft AD groupmembership. I am using IIS 8 and the latest Webmail version.
So far I have managed to get the code working to know the current User which connects to IIS and query the AD for the group. Depending on the group, Webmail should login automatically with a defined useraccount, which can be defined in php code. There are 4 AD Groups with 4 associated logins.
My Problem is, I do not know where to place this code (also to survive updates). I read already about SSO and "Custom Mapping" of E-Mail addresses, but this is not exactly what I need.
Thanks in advance for your ideas.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 29 January 2018 at 3:36am | IP Logged
|
|
|
Assuming your code knows email address and password you need to log into, you can use the standard PHP integration approach described at:
Logging in programmatically
The code used there is supposed to be placed into a separate file which isn't affected by updates.
You could use Single Sign-On as well, but you're saying that's not exactly what you're looking for - can you explain what exactly about these approaches doesn't meet your requirements?
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
ThomasH Newbie
Joined: 29 January 2018 Location: Germany
Online Status: Offline Posts: 7
|
Posted: 31 January 2018 at 7:58am | IP Logged
|
|
|
Dear Igor,
thank you for your response. I am not a perfect php developer. After reading and investigating a bit further I think now I understand the concept and use the sso-login.php from the example. I put the code there. Get current AD user and group and do the login. Working great.
Only missing pice is signature. I try the global-signature plugin and create the signature with data pulled from AD. It is working, but the Signature is not visible during editing and when replying it is appended at the very end of the message.
I found in the settings > identity > signature the possibility to add an signature which is at the right place in the message but it is static. Is it possible to make this dynamically also with data pulled from AD?
Another php file which contains the code for the signature and is added when create new mail or reply and forward would be perfect.
thanks and best regards
Thomas
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 01 February 2018 at 1:26am | IP Logged
|
|
|
Well there is no easy way to meddle with fetching signature from the database when composing the message, without modifying the source code directly which would be a problem for further updates, but I think there is another option.
Would it be possible for you to use Logging in programmatically approach rather than Integration via Single Sign-On? With that one, you could fetch signature from external source and insert it into the account properties, right after logging in; so it won't be done on composing each new message, only when logging user in, which should be good enough for most cases.
Once you have an Account object, updating the signature is rather straightforward:
Code:
$oApiUsersManager = CApi::Manager('users');
$oAccount->Signature = "My signature goes here";
$oApiUsersManager->UpdateAccount($oAccount); |
|
|
I've uploaded a complete sample here. Hope it helps.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|
ThomasH Newbie
Joined: 29 January 2018 Location: Germany
Online Status: Offline Posts: 7
|
Posted: 12 February 2018 at 8:50am | IP Logged
|
|
|
Dear Igor,
this was exactly what I was looking for. Working perfectly now.
Thanks and best regards
Thomas
|
Back to Top |
|
|