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.

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.

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

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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 314 members 4,194 guests
Please welcome our newest community members: