Can you please let me know - is Role based permissions available in PowerApps? or do we need to implement customized functionality to achieve this?
Solved! Go to Solution.
If("System Administrator" in (LookUp(Users,'User Name'=User().Email).'Security Roles (systemuserroles_association)').name,Set(IsAuthorized, true ),Set(IsAuthorized, false ));
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.
Thanks for your reply.
My requirement is like blow: I have database table data
|Conversation Part 3||User 1|
|Conversation Part 2||User 2|
|Conversation Part 1||User 2|
|Sidney Sheldon - Chasing Tomorrow||User 4|
|Man's Search for Meaning||User 1|
|Keep off the grass||User 3|
|A wounded civilization||User 4|
|The Great Novel - Shashi Tharoor||User 2|
|Dalai Lama - Worlds in Harmony||User 3|
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
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.
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 = "email@example.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
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
Check out the winners of the recent 'Can You Solve These?' community challenge!
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Featuring samples like Return to the Workplace and Emergency Response Applications
Features releasing from October 2020 through March 2021