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,
Can you inspect the EntityID property of the failing UserAuthor and see if it contains the ID of the expected user?
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:
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?