Home

PowerApps Rule (hide or disable if you are not in a particular Group)?

%3CLINGO-SUB%20id%3D%22lingo-sub-146868%22%20slang%3D%22en-US%22%3EPowerApps%20Rule%20(hide%20or%20disable%20if%20you%20are%20not%20in%20a%20particular%20Group)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-146868%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20messing%20with%20PowerApps%2C%20and%20trying%20to%20see%20if%20it%20is%20possible%20to%20hide%20of%20disable%20certain%20elements%20based%20on%20Group%20membership.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ee.g.%20have%20a%20SharePoint%20Group%20(or%20maybe%20a%20Security%20Group)%20called%20%22Test%20App%20Administrators%22%3C%2FP%3E%0A%3CP%3EIf%20the%20user%20is%20in%20that%20group%2C%20they%20can%20edit%20certain%20fields%3C%2FP%3E%0A%3CP%3EIf%20the%20user%20is%20NOT%20in%20that%20group%2C%20then%20those%20fields%20are%20locked%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-146868%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-325284%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20Rule%20(hide%20or%20disable%20if%20you%20are%20not%20in%20a%20particular%20Group)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-325284%22%20slang%3D%22en-US%22%3E%3CP%3EMy%20colleague%2C%20Geetha%2C%20wrote%20a%20blog%20post%20outlining%20how%20to%20do%20this%20using%20Flow%20and%20SharePoint%20Groups.%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fsvaghub.wordpress.com%2F2018%2F11%2F03%2Frole-based-security-in-powerapps-using-spgroups%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsvaghub.wordpress.com%2F2018%2F11%2F03%2Frole-based-security-in-powerapps-using-spgroups%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-199545%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20Rule%20(hide%20or%20disable%20if%20you%20are%20not%20in%20a%20particular%20Group)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-199545%22%20slang%3D%22en-US%22%3EThis%20might%20be%20little%20late%20but%20hopefully%20others%20will%20find%20it%20useful.%20Showing%20exactly%20how%20to%20do%20achieve%20this%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DLRGfH7bOhNA%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DLRGfH7bOhNA%3C%2FA%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-158860%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20Rule%20(hide%20or%20disable%20if%20you%20are%20not%20in%20a%20particular%20Group)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-158860%22%20slang%3D%22en-US%22%3EInteresting%20approach.%20I%20suppose%20its%20no%20different%20then%20managing%20the%20users%20as%20an%20actual%20SharePoint%20Group%2C%20just%20doing%20it%20in%20a%20different%20place.%3CBR%20%2F%3E%3CBR%20%2F%3EA%20single%20list%20called%20permissions%2C%20with%20the%20Title%2C%20and%20maybe%20another%20field%20(multi-user)%20should%20work.%20I'll%20have%20to%20start%20exploring%20this.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-158851%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20Rule%20(hide%20or%20disable%20if%20you%20are%20not%20in%20a%20particular%20Group)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-158851%22%20slang%3D%22en-US%22%3E%3CP%3ECan%20you%20please%20give%20an%20example%20%3F%20as%20i%20am%20new%20to%20PowerApps%20i%20don't%20know%20how%20to%20save%20this%20to%20collection%20and%20use%20it%20for%20show%2Fhide.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-152063%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20Rule%20(hide%20or%20disable%20if%20you%20are%20not%20in%20a%20particular%20Group)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-152063%22%20slang%3D%22en-US%22%3EThe%20only%20way%20to%20do%20something%20like%20this%20at%20this%20time%20is%20to%20create%20a%20list%20with%20the%20admin%20users.%20Then%20in%20the%20OnStart%20you%20would%20pull%20that%20list%20into%20a%20collection%20(e.g.%20colAdminUsers)%20and%20create%20a%20variable%20(e.g.%20gvIsAdmin)%20and%20set%20the%20value%20(true%2Ffalse)%20by%20checking%20if%20the%20current%20user%20is%20listed%20in%20colAdminUsers.%20Now%20that%20gvIsAdmin%20is%20set%20you%20can%20use%20the%20variable%20with%20different%20fields%20to%20change%20the%20visibility%2C%20display%20mode%20or%20other%20properties.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-150835%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20Rule%20(hide%20or%20disable%20if%20you%20are%20not%20in%20a%20particular%20Group)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-150835%22%20slang%3D%22en-US%22%3ENothing%20yet.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-150156%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20Rule%20(hide%20or%20disable%20if%20you%20are%20not%20in%20a%20particular%20Group)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-150156%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20looking%20for%20a%20similar%20solution%2C%20Did%20you%20find%20anything%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-735628%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20Rule%20(hide%20or%20disable%20if%20you%20are%20not%20in%20a%20particular%20Group)%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-735628%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F637%22%20target%3D%22_blank%22%3E%40Brent%20Ellis%3C%2FA%3E%26nbsp%3BHere's%20a%20blog%20I%20wrote%20on%20how%20to%20do%20this%20with%20Office%20365%20Groups.%26nbsp%3B%20All%20within%20PowerApps%20(No%20Flow%20or%20SharePoint%20required)%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fthebaretta.blogspot.com%2F2019%2F07%2Fpowerapps-hide-buttons-objects-based-on.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fthebaretta.blogspot.com%2F2019%2F07%2Fpowerapps-hide-buttons-objects-based-on.html%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Brent Ellis
Valued Contributor

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

8 Replies

I am looking for a similar solution, Did you find anything?

The 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.

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.

Interesting 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.
This 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

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/

 

 

@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