Event for SignOff?

1040
9
Jump to solution
03-23-2020 02:38 AM
Vidar
by
Occasional Contributor II

Hi,

It doesn't look like there is an event to listen out for users signing out of their active portal. Is there something I'm missing or is there another way to do this? Or do I have to keep checking if the user is signed in before my code does anything that requires the user to be actually signed in.

I only ask as I was going to disable my addin toolbar if the user had signed out.

Cheers.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

Hi Simon,

Uma and I are looking into this with the development team. There is an internal event that fires when a user signs in or when a user signs out of online or portal. However, if the user toggles between active portals into which he or she is already signed in then, of course, that event does not fire (as the portal _signed on_ status did not change).....but.... the "active portal changed" event does fire because the active portal did change (and this event is already public) even though its signed on status didn't.

Therefore, with the addition of this "new" event getting  exposed to give you notification of a given portal's sign in/sign out status changing _combined with_ the existing "active portal changed" event giving you notification of the active portal changing - that should give you everything you need.

We will get that in for 2.6.

View solution in original post

0 Kudos
9 Replies
UmaHarano
Esri Regular Contributor

Hi Simon

There is a IsSignedOn property that you can use.  To use this property to enable/Disable your toolbar, I recommend States and Conditions.

You can create your own condition based on IsSignedOn property,  then build the underlying state using your condition.

Thanks

Uma

0 Kudos
Vidar
by
Occasional Contributor II

I understand that - but I need to dynamically enable or disable my toolbar based on a user signing out, i.e. the exact moment the user signs off - can that be done?

0 Kudos
UmaHarano
Esri Regular Contributor

Hi Simon,

Here is a better approach -

There is a condition in Pro you can use out of the box - The condition is "esri_core_isSignedIn" .

<button id="SigningOffPortal_StatusButton" caption="StatusButton" condition="esri_core_isSignedIn" ../>

I tested it and the button enables/disabled based on the Sign In status.

Thanks

Uma

0 Kudos
Vidar
by
Occasional Contributor II

Hi,

Just wondering if you have had any further thoughts in response to my last post (below)?

0 Kudos
Vidar
by
Occasional Contributor II

OK - this works in part and that's useful to know .

But I still need to know things about the user when they sign in or sign out, and this gives me no chance to do that as far as I can see.

The context is - I want the control to change state if the user is a member of group in Portal or not, also it needs to disable/enable if signed in or out (which is where your fix works partly).

Below is by custom control with an embedded button and image that toggles between two images:

Here are the use cases:

  • User A not signed in to Portal and is not a member of foo group. "Request Access" (to foo group) button is disabled.  This is where your answer works as the whole control is deactivated, and that's good.

  • User A signs in to Portal and is not a member of foo group, the control enables (again your answer solves this scenario) the user can now press "Request Access" button and go from there:

  • User A signs out, user B signs in and already has access to foo group. This is where it breaks down.  The control should change but it doesn't, as no event is raised when the user signs in. The control should change to this:

but it doesn't it, just re-enables the the control without changing the icon:

Hopefully this makes some sense - and how I need to intercept the signing in and out process/event.

0 Kudos
CharlesMacleod
Esri Regular Contributor

Hi Simon,

Uma and I are looking into this with the development team. There is an internal event that fires when a user signs in or when a user signs out of online or portal. However, if the user toggles between active portals into which he or she is already signed in then, of course, that event does not fire (as the portal _signed on_ status did not change).....but.... the "active portal changed" event does fire because the active portal did change (and this event is already public) even though its signed on status didn't.

Therefore, with the addition of this "new" event getting  exposed to give you notification of a given portal's sign in/sign out status changing _combined with_ the existing "active portal changed" event giving you notification of the active portal changing - that should give you everything you need.

We will get that in for 2.6.

0 Kudos
Vidar
by
Occasional Contributor II

Hi Charlie,

Thanks for getting back to me. Good to know that this will happen in a future version, I will try and figure out some work-around for now.

Cheers

Simon.

0 Kudos
CharlesMacleod
Esri Regular Contributor

Simon, with the release of 2.6, (tomorrow, July 28th, PST) this event is now available:

ArcGIS.Desktop.Core.Events.PortalSignOnChangedEvent

0 Kudos
Vidar
by
Occasional Contributor II

Thats really excellent news - and thank you for getting back to me. It's really appreciated.

0 Kudos