Check roles not working

Check roles not working

  

Hi everyone,

 We are having quite a weird problem in one of our applications. All of the sudden our checkrole() functions are not working, here are some facts.

- If the user has a role called "engineer" and we use somewhere ( either action or screen) the function checkengineerrole(getuserid()) then the application runs smoothly.

- If the user does not have the role, then, when the function checkengineerrole(getuserid()) is called then we have the following error stack (from service center) :

   Object reference not set to an instance of an object.
   at OutSystems.ObjectKeys.GlobalObjectKey.ToString(String format)
   at OutSystems.HubEdition.RuntimePlatform.SessionInfo.#Erb()
   at OutSystems.HubEdition.RuntimePlatform.SessionInfo.#Drb()
   at OutSystems.HubEdition.RuntimePlatform.GenericExtendedActions.Check(HeContext heContext, ObjectKey key, Int32 userId, Int32 eSpaceId)
   at ssDUP.Functions.ssCheckUitvoerderRole(HeContext heContext, Int32 inParamUserId)
   at ssDUP.Actions.ActionAction1(HeContext heContext, Int32 inParamUserid)
   at ssDantasSB.RsseSpaceDUP.MssAction1(HeContext heContext, Int32 inParamUserid)
   at ssDantasSB.Flows.FlowMainFlow.ScrnResizeWindow.CommandOk2(HeContext heContext)


Does anyone have an idea what might be generating this error???

Hi Guilherme,

All these calls to CheckRole() are done in the context of a screen web request right?

If you're calling them in a timer, for instance, GetUserId() will not return a user...

Hi Joao,

 Yes correct, they are in screen web requests! We didnt have a problem with this before, because our applications always used the CheckRole() actions without a problem, and moreover, they now fail only if the user does not have the role being checked!


Have you made any change recently to the apps?

Is the user provider of your modules still “Users”?

1 - Yes this is happening in dev environment, so we have constantly changes being applied!

2- Yes, the user provider is users, do you think that might be the problem? The weird thing is that it does the check "correctly" if the user has the role, it only fails, and turn the above stated error, when the user does not have the role being checked!

Thanks for the feedback Guilherme. I must try to replicate that behaviour myself later...

Also our users application is having that problem, we cant login in the users application at all! Might this be related to Tenants somehow?