Forum Discussion
PowerApps Rule (hide or disable if you are not in a particular Group)?
I am messing with PowerApps, and trying to see if it is possible to hide of disable certain elements based on Group membership.
e.g. have a SharePoint Group (or maybe a Security Group) called "Test App Administrators"
If the user is in that group, they can edit certain fields
If the user is NOT in that group, then those fields are locked
- Jeffrey ThorpeIron ContributorThe only way to do something like this at this time is to create a list with the admin users. Then in the OnStart you would pull that list into a collection (e.g. colAdminUsers) and create a variable (e.g. gvIsAdmin) and set the value (true/false) by checking if the current user is listed in colAdminUsers. Now that gvIsAdmin is set you can use the variable with different fields to change the visibility, display mode or other properties.
- Mahendra GohelCopper Contributor
Can you please give an example ? as i am new to PowerApps i don't know how to save this to collection and use it for show/hide.
- Brent EllisSilver ContributorInteresting approach. I suppose its no different then managing the users as an actual SharePoint Group, just doing it in a different place.
A single list called permissions, with the Title, and maybe another field (multi-user) should work. I'll have to start exploring this.- Sohail MerchantBrass ContributorThis might be little late but hopefully others will find it useful. Showing exactly how to do achieve this:
https://www.youtube.com/watch?v=LRGfH7bOhNA
- Alam ShetasanadiMicrosoft
I am looking for a similar solution, Did you find anything?
- Brent EllisSilver ContributorNothing yet.
- Ben McMannCopper Contributor
My colleague, Geetha, wrote a blog post outlining how to do this using Flow and SharePoint Groups. https://svaghub.wordpress.com/2018/11/03/role-based-security-in-powerapps-using-spgroups/
- BrettRCopper Contributor
Brent Ellis Here's a blog I wrote on how to do this with Office 365 Groups. All within PowerApps (No Flow or SharePoint required): https://thebaretta.blogspot.com/2019/07/powerapps-hide-buttons-objects-based-on.html
- Travis JefferdsCopper Contributor
probably obsolete answer now, but Reza addresses this in linked vid. I wish it was simpler but this workaround isn't horrible. Check if User is Member of SharePoint Group in Power Apps - YouTube