November Happy Hour will be moved to Thursday December 5th.

Community User null?

Vote:
 

Hi,

I have a Relate site which has an events calendar and have noticed a minor anomoly between two different users when saving an event. When saving I process the permissions and call the method EntitySecurityHandler.Instance.SetAccessRights passing in the event, the author of the event (cast appropriately) and a FrameworkEntityAccessRights object.

The issue happens with the user of the event, which is cast as follows:

(event.Author as UserAuthor).User

For my account the .User is populated and valid but for another user this is null. I've checked both accounts and can see no obvious difference between them.

Has anyone else experienced this and know what the cause and fix is? I'm expecting a tweak to one of the accounts (hopefully).

Thanks in advance,

Mark

#62331
Oct 22, 2012 16:05
Vote:
 

Can you inspect the EntityID property of the failing UserAuthor and see if it contains the ID of the expected user?

#62352
Oct 23, 2012 9:11
Vote:
 

Hi Magnus,

Thanks for the pointer. Interesting that the EntityID of the UserAuthor is different to the ID of the expected user although the usernames match. I also checked the DB and found that there is no user with the EntityID returned from the UserAuthor.

This leaves me with 2 questions really:

  1. Should I manually update the value in the DB to match the expected user? If I did this I guess there could be other incorrect entries for the same user
  2. Should I amend the code to check for null and pass in the current user? If I do this then it will change the way that it works for example it currently retains the original UserAuthor if someone else edits but I am potentially creating a new UserAuthor if the value is incorrect

Any thoughts?

Thanks,

Mark

#62355
Oct 23, 2012 10:12
Vote:
 

This is very strange... I could maybe understand if the EntityID was -1 (=uncommited user), but if it is just a different valid ID... Could it be that there was a user with that ID before and that user authored the event? Now that user is gone but there is another user with the same username (which means that strictly speaking, they are not the same user)? Or does this happen when the currently existing user creates an event?

#62360
Oct 23, 2012 11:02
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.