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

Fixed an issue where the wrong PortalId was getting set when there was multiple sites existing #4773

Merged

Conversation

berkarslan-xo
Copy link
Contributor

Fixes #4772

Summary

Currently used portal id is getting set correctly now. As a fallback, the old logic is preserved too.

Copy link
Contributor

@valadas valadas left a comment

Choose a reason for hiding this comment

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

Tested it out and works great, a most welcome bug fix!

@valadas valadas added this to the 9.10.1 milestone Aug 3, 2021
@mitchelsellers mitchelsellers merged commit db2c94f into dnnsoftware:develop Aug 3, 2021
@valadas valadas changed the title Issue-4772 - Wrong PortalId is getting set when there are multiple sites existing Fixed an issue where the wrong PortalId was getting set when there was multiple sites existing Aug 13, 2021
@ggiordan
Copy link

ggiordan commented Aug 20, 2021

I think there may still be an issue here. We happen to use the DNN.Events module and this exposes the error then the API is called.

If you try to load or create an event, it loads the CKE editor. As soon as the CKE editor loads, the user gets logged out.

Watching the network trace, it can be seen that this is done by the call to: https://<host>/API/CKEditorProvider/CloudServices/GetToken

In chasing this down, in the call to Authenticate in (MembershipModule.cs:99) request, this code returns the portal settings for portal 0, not the current portal:
// Obtain PortalSettings from Current Context PortalSettings portalSettings = PortalController.Instance.GetCurrentPortalSettings();

So unless the logged in user is a user in portal 0, this results in a NULL being returned:
var user = UserController.GetCachedUser(portalSettings.PortalId, context.User.Identity.Name);

To see this happen do the following:

  1. have a user who is not a member of portalid = 0
  2. log that user in
  3. from the current tab or another tab in your brower hit the URL: https://<host>/API/CKEditorProvider/CloudServices/GetToken

At this point the user is logged out... web server will return with a 302 and a delete the session login cookie

if you grab the process in the debugger, you will see that portalSettings.PortalId == 0, where is was correct for all the other calls.

Another way to recreate this is to have a calendar on the page, try to add a new event to the calendar (where the CKE editor gets loaded) you will find that the user gets logged out.

If you change the Event module to not use the CKE editor, the problem is hidden because it does not call the API.

We just upgraded our production site to DNN 9.10.0 and this is hurting us very badly, any thoughts on a quick fix would be much appreciated too. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong PortalId is getting set when there are multiple sites existing
4 participants