cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AJ13
Level: Powered On

Best way to implement role based access to apps

Hi,

 

What is the best way to implement role based access to fields/screens.

I want to have an ticket/response app where all users can raise tickets, certain approvers can approve the tickets and then another group of users can enter data into response fields. 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Best way to implement role based access to apps

@AJ13

 

It would be easier to implement on a screen level.

 

If you have this list of users in an excel on ondedrive or sharepoint list, you could Collect all the different groups into different collections , on start of the app. So set the the OnStart property of the app to 

 

ClearCollect(Admins, AdminListName) ; ClearCollect(Editors, EditorsListName)  or you could use ForAll function as well

 

You probably have all the names is one list and if that's the case, you could filter the list accordingly while collecting in the collection.

 

Now that you have the list of admins, editors, you could set the OnVisible property of the screens to 

 

If(IsEmpty(Filter(Admins,UserEmailColumnName=User().Email)),Back())

 

and if you want to use it on fields/buttons, you could sent the display mode property to  -

 

If(IsEmpty(Filter(Admins,UserEmailColumnName=User().Email)),Disabled,Edit)

 

or if you don't want it to be visible to other users , you could set the visible property to - 

 

If(IsEmpty(Filter(Admins,UserEmailColumnName=User().Email)),false,true)

 

Hope this helps!


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Best way to implement role based access to apps

@AJ13

 

It would be easier to implement on a screen level.

 

If you have this list of users in an excel on ondedrive or sharepoint list, you could Collect all the different groups into different collections , on start of the app. So set the the OnStart property of the app to 

 

ClearCollect(Admins, AdminListName) ; ClearCollect(Editors, EditorsListName)  or you could use ForAll function as well

 

You probably have all the names is one list and if that's the case, you could filter the list accordingly while collecting in the collection.

 

Now that you have the list of admins, editors, you could set the OnVisible property of the screens to 

 

If(IsEmpty(Filter(Admins,UserEmailColumnName=User().Email)),Back())

 

and if you want to use it on fields/buttons, you could sent the display mode property to  -

 

If(IsEmpty(Filter(Admins,UserEmailColumnName=User().Email)),Disabled,Edit)

 

or if you don't want it to be visible to other users , you could set the visible property to - 

 

If(IsEmpty(Filter(Admins,UserEmailColumnName=User().Email)),false,true)

 

Hope this helps!


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Super User
Super User

Re: Best way to implement role based access to apps

Two different ways to look at this off the top of my head.

 

1. You can take advantage of User().email. That is the person who is currently using the PowerApps app email address. So set your approval button to visible  if(User().email = ApproverEmail, true, false) [That might not be exact but that is real close]

 

2. If you want to get more advanced, depending on your Data Source, you can check out the function DataSourceInfo. If your data source supports it you can check if the user has different levels of access to the data source.

 

Hope it helps

 

Shane

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Highlighted
BitLord69
Level 10

Re: Best way to implement role based access to apps

Hi,

 

If you're using Active Directory, you can use security groups. In this post I show how to check for group membership: https://powerusers.microsoft.com/t5/General-Discussion/Is-it-possible-to-switch-the-view-as-InfoPath...

 

Good luck!

Helpful resources

Announcements
thirdimage

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,085)