cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Elitezone
Post Prodigy
Post Prodigy

Exit/reload app when rights taken away

Hello,

 

Is there a way to reload /exit app for user that have rights taken away?

I have a button function:

 

 

Remove(ListaAdmin,Gallery4.Selected);UpdateContext({showDialogAdmin:false});Notify("Administrator został usunięty!",NotificationType.Success)

 

 

with this I delete admins - but this works after next user session (app reload).

ListaAdmin is a sharepoint list with a field people that lists all users with particular rights (admins). It loads the list of users onStart of application.

Set(gblUserEmail,User().Email);Set(varAdmin1,false);Set(
   varAdmin,
   !IsBlank(
      LookUp(
         ListaAdmin,
         'Dane administratora'.Email=gblUserEmail
      )
   )
)

 

Is there a way to do something like that?

 

If not how can I incorporate a check if I deleted my own rights then exit? 

Or maybe a timer that check this rights in several minutes or something?

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@Elitezone 
I think the reason its still working on the next time the User opens an app is because Power Apps is being cached locally in the User's web browser.  Caching is a great way to improve app load speeds but it can cause problems like the one you described.

 

You could bypass this a couple of different ways.

 

#1.  Perform a check when the user enters the screen to see if they are still an Admin user.  Do this in the OnVisible property of the screen.

 

#2.  Perform a check every minute when the user is on a sensitive screen using a timer.  I don't like this idea though because it would make way too many calls.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

2 REPLIES 2
mdevaney
Super User
Super User

@Elitezone 
I think the reason its still working on the next time the User opens an app is because Power Apps is being cached locally in the User's web browser.  Caching is a great way to improve app load speeds but it can cause problems like the one you described.

 

You could bypass this a couple of different ways.

 

#1.  Perform a check when the user enters the screen to see if they are still an Admin user.  Do this in the OnVisible property of the screen.

 

#2.  Perform a check every minute when the user is on a sensitive screen using a timer.  I don't like this idea though because it would make way too many calls.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Ok. I have added it on some screens, seems to be working sometimes... but not always...

Can it be done with IF statement?

 

Set(
   varAdmin,
   !IsBlank(
      LookUp(
         ListaAdmin,
         'Dane administratora'.Email=gblUserEmail
      )
   )

 

 

 

 

For example - first this check it sets varAdmin.

If varAdmin is false then navigate to different screen or exit.

 

Seems to have made something like that:

 

 

 

showDialogAdmin=false;Set(
   varAdmin,
   !IsBlank(
      LookUp(
         ListaAdmin,
         'Dane administratora'.Email=gblUserEmail
      )));If(varAdmin=false,Navigate(Screen1;Fade))

 

 

 

But wish I could make it on change in gallery or form.

it spams a bit of errors mostly.

And the new one for me - navigate cannot be used in onVisible.

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,484)