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

is Role based permissions available in PowerApps?

Hi,

 

Can you please let me know - is Role based permissions available in PowerApps? or do we need to implement customized functionality to achieve this?

 

Thanks

Durga

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: is Role based permissions available in PowerApps?

Hi @Durga 

 

To display only associated records from the data table for a normal user and all records for admin, you can use the expression as:
 
First, you can set a variable to check if current user is admin, this can be done on AppStart:
 
-> Set(isAdmin, User().Email = "admin@xyz.com")
Here I have used email address to compare, please replace this with your condition to determine admin.
 
Now to filter data:
Filter(DataSourceName,If(isAdmin,true,Name = User().Name))
 
Here, we are checking if isAdmin is true, then return all records, otherwise return only related records. Please replace DataSourceName with the actual data source name and Name attribute with the correct attribute name.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

6 REPLIES 6
Dual Super User
Dual Super User

Re: is Role based permissions available in PowerApps?

Hi @Durga 

 

Can you please provide more details over this? Are you looking for something that show controls/screens based on User role? If yes, you can use Users entity to check if logged-in user has specific role, by using below expression:
 
If("System Administrator" in (LookUp(Users,'User Name'=User().Email).'Security Roles (systemuserroles_association)').name,Set(IsAuthorized, true ),Set(IsAuthorized, false ));
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Dual Super User
Dual Super User

Re: is Role based permissions available in PowerApps?

Permissions in PowerApps are handled by the back end data source. So if the data source you are connecting to has role based permissions then you can leverage those in PowerApps.  But for example, SharePoint and OneDrive are two of the most popular data sources and they don't really have a concept of role based permissions.  You can do permissions in both of them based on group membership, which is similar, but not quite the same thing.

 

You can also add your own level of permissions programmatically inside PowerApps.  But that won't apply to the users if they bypass the app and go directly to the data source. 

 

If you provide a bit more information we might be able to suggest alternatives.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Durga
Level: Powered On

Re: is Role based permissions available in PowerApps?

Thanks for your reply.

 

My requirement is like blow: I have database table data 

Ex:

BookUser
Conversation Part 3User 1
Conversation Part 2User 2
Conversation Part 1User 2
Sidney Sheldon - Chasing TomorrowUser 4
Man's Search for MeaningUser 1
Keep off the grassUser 3
A wounded civilizationUser 4
The Great Novel - Shashi TharoorUser 2
Dalai Lama - Worlds in HarmonyUser 3

 

Scenarios:

1) End users(logged in) can only view and edit the their own records
2) Need an admin role, users with this role can view and edit all the records

 

 

Also, an other requirement is need to send an email to Admin(specific email address)  when new record gets inserted into DB table from power app form.

 

Thanks in advance

Durga

Dual Super User
Dual Super User

Re: is Role based permissions available in PowerApps?

I'll assume you are using a SQL database when you say database table.  The connector to SQL is going to use a connection account that will have access to all the records. So you won't be able to use permissions in SQL to accomplish what you want.  The one possibility is to use a field in the database to record who the user is.  Then you could filter based on current user if the user is not an admin. 

 

If you create a Flow with a Trigger that fires when a new row is created in the SQL db then you can have that Flow run whenever a new records is added, whether its from a PowerApp or other means.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Dual Super User
Dual Super User

Re: is Role based permissions available in PowerApps?

Hi @Durga 

 

To display only associated records from the data table for a normal user and all records for admin, you can use the expression as:
 
First, you can set a variable to check if current user is admin, this can be done on AppStart:
 
-> Set(isAdmin, User().Email = "admin@xyz.com")
Here I have used email address to compare, please replace this with your condition to determine admin.
 
Now to filter data:
Filter(DataSourceName,If(isAdmin,true,Name = User().Name))
 
Here, we are checking if isAdmin is true, then return all records, otherwise return only related records. Please replace DataSourceName with the actual data source name and Name attribute with the correct attribute name.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Durga
Level: Powered On

Re: is Role based permissions available in PowerApps?


@yashag2255 wrote:

Hi @Durga 

 

To display only associated records from the data table for a normal user and all records for admin, you can use the expression as:
 
First, you can set a variable to check if current user is admin, this can be done on AppStart:
 
-> Set(isAdmin, User().Email = "admin@xyz.com")
Here I have used email address to compare, please replace this with your condition to determine admin.
 
Now to filter data:
Filter(DataSourceName,If(isAdmin,true,Name = User().Name))
 
Here, we are checking if isAdmin is true, then return all records, otherwise return only related records. Please replace DataSourceName with the actual data source name and Name attribute with the correct attribute name.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Thanks @yashag2255 for your prompt replies on my requirement.

 

 

Your solution worked for me. But as per our requiremnt, we have created a SG for Admins and checking if user part of SG then showing complete data else respected logged in user data. 

 

If(User().Email in AzureAD.GetGroupMembers("<Security Group ID>").value.mail, <Show>,<Hide>)

 

Thank you all for your replies

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,531)