Ldap Exception being thrown in relatedsitesmode

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
8/30/2010 2:10:01 PM
Gravatar
Total Posts 130

Ldap Exception being thrown in relatedsitesmode

Hi Joe,

I have a working install of mojoPortal (v 2.3.4.5 MSSQL) running on related sites mode. I recently made a copy of the database and compiled the most recent (2.3.5.1 MSSQL) mP source, pointing it to the copy db in an attempt to upgrade to the newest version (and maintain the source so I can deploy and upgrade as needed).

I do not know if this issue is related to the upgrade, although it has not surfaced on my live original install, so I am assuming a connection.

The issue:

From the Parent site (Administration -> Site Settings -> MyChildSite -> Security -> Permissions -> Site Editor Roles) when I try to apply a custom role as the Site Editor for a child site and submit, the project throws an exception referencing line 1183 of SiteSettings.aspx.cs (selectedSite.SiteLdapSettings.Port = Convert.ToInt32(txtLdapPort.Text);).  Apparently that entire section of serverside div's are being called even though they are not present on the page (Ldap settings are not shown for the child site security - therefore an empty string value is being passed and causes the exception.

I was able to bypass the error and save the settings by using try and catch statements.  I think this may be a bug, but am unsure what is causing it, as again, it is only occurring when I attempt to point a newer mP install to my original (earlier version) mP database. 

Any help you can provide would be greatly appreciated as it seems I am currently unable to upgrade.

Sincerely,

Beth

8/31/2010 6:56:18 AM
Gravatar
Total Posts 18439

Re: Ldap Exception being thrown in relatedsitesmode

Hi Beth,

I noticed this very thing when I was looking into the other issue you reported about the edit links in related sites mode. This is already fixed in the source code repository and will be fixed in the next release.

Best,

Joe

9/1/2010 12:13:50 PM
Gravatar
Total Posts 130

Re: Ldap Exception being thrown in relatedsitesmode

Hi Joe,

Thanks for the explanation regarding when/how you update the source code. I've fetched the newest source release with your fixes and have discovered another bug.  With the same scenario already described (multi site installation using related sites mode), if I create a new custom role in the Parent site, apply permissions via site settings in the Parent site, then apply that custom role as the Site Editor for the child site, login to the child site, the following happens:

a) the admin panel is gone, b) if I run it in debug mode in Visual Studio I throw an exception relating to SiteUser.cs, line 626.  If I then look in the MSSQL db at the mp_Sites table, I see that the "UseEmailForLogin" for the child site I just applied to Site Editor Role to has changed to false, even though I have set it to true in the Parent site (and it is true for every other child site as I can see in the db).  Because of this switch, I am able to log in, but the system does not know what my user is and does not display the Administer menu or show my login.

Best,

Beth

9/1/2010 12:30:10 PM
Gravatar
Total Posts 18439

Re: Ldap Exception being thrown in relatedsitesmode

That is probably a side effect caused by the previous error that prevented that child site from getting the correct settings. If you go back to the root site and save site settings again I think it should fix the child site to have the same security settings as the root site and all will be well again.

Best,

Joe

9/1/2010 12:37:57 PM
Gravatar
Total Posts 130

Re: Ldap Exception being thrown in relatedsitesmode

Hi Joe,

Unfortunately I've replicated the error three times now.  I've re-run the setup scripts, reset the Email login from the Parent Site Settings - checked the db to confirm.  The role I already created will then work, but if I go to create another custom role the same chain of events happens. :-/

9/1/2010 1:14:15 PM
Gravatar
Total Posts 18439

Re: Ldap Exception being thrown in relatedsitesmode

Hi Beth,

I see it was actually changing those settings when saving site settings in child site, so it was a bug. It is now fixed in the repository, so if you pull the latest change sets and update and rebuild it should be fixed for you.

Thanks,

Joe

9/1/2010 2:19:10 PM
Gravatar
Total Posts 130

Re: Ldap Exception being thrown in relatedsitesmode

Hi Joe,

Sorry to keep bugging (haha) you, but I grabbed the newest release from the repository, ran the setup scripts and tried it again.  I'm still having the same error. 

I'm wondering if when you made the fixes and tested it, did you create a new custom role and attempt using that on the child site?  If I reset the "Use Email for Sign In" and then log into the child site with my custom role it will then work.  The error seems to be happening upon the creation of a new custom role.

Thanks again,

Beth

9/1/2010 2:42:11 PM
Gravatar
Total Posts 130

Re: Ldap Exception being thrown in relatedsitesmode

Addendum: I just realized that it's not the creation of the new custom role, it's the application of the custom role to the user.  I just applied a role I've had to one of my users and attempted to log in and produced the exception:

 

Line 175:            if (setting != null)
Line 176:            {
Line 177:                setting.SetValue(siteUser.TimeZoneId);
Line 178:            }
Line 179:           

Best,
Beth
9/1/2010 2:51:39 PM
Gravatar
Total Posts 18439

Re: Ldap Exception being thrown in relatedsitesmode

Hi Beth,

If you have the latest code and you go to the root/parent site and save site settings it should fix the child site. The code fix did not fix existing data, so if the child site settings were already saved wrong the code fix won't solve it. When you save the root/parent site it updates all child sites to the same setting for UseEmailForLogin and that fixes the problem. Then logout of the child site and when you login again it should need email address not user id and it will work correctly.

The problem was that when you saved the child site site settings to save the site editor roles, that is when it was changing the UseEmailForLogin to false on the child site. Once that happens, it may let you login with email but it doesn't set the correct value for the authentication cookie and therefore all kinds of errors happen because you are technically logged in but it didn't really associate your database user to the cookie.

Hope that clarifies it.

Best,

Joe

9/1/2010 2:56:21 PM
Gravatar
Total Posts 130

Re: Ldap Exception being thrown in relatedsitesmode

Hola Joe,

Unfortunately there is more going on here as well.  With my custom role applied to the child site, after resetting the Email Login field in the Parent Site Settings, I attempted to edit an html content page.  Upon clicking Update the system threw an exception relating to HtmlEdit.aspx.cs line 290:

 html.Body = htmlBody;
                //these will really only be saved if it is a new html instance
                html.CreatedBy = currentUser.UserId;
                html.UserGuid = currentUser.UserGuid;

Where UserId was apparently Null (although I am logged in and have proper rights to edit the content).

Best,

Beth

9/1/2010 3:02:49 PM
Gravatar
Total Posts 18439

Re: Ldap Exception being thrown in relatedsitesmode

You need to sign out of the child site and sign in again after fixing it.

If at any time when you sign into the child site the login form says user id instead of email then the site is broken don't login, you will have errors, if you already logged in log out of the child site.

then login to the root site and go to site settings and save it. this will change the child site back correctly to useemailforlogin

now when you go back to the child site it should say email address not user id and it is now safe to login and no errors will happen.

and it should not revert back because of the code fix if you really have the latest code.

Might be good to clarify here exactly how you grabbed the latest code. You need to pull changes in repository explorer, then close repository explorer and right click the top folder and choose TortsoiseHG > Update, this will apply the changesets to your working copy, next rebuild solution.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.