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 III
Super User III

@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 III
Super User III

@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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,530)