SaaS CMS has officially launched! Learn more now.

Community User null?



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,


Oct 22, 2012 16:05

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

Oct 23, 2012 9:11

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?



Oct 23, 2012 10:12

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?

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.