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

Hide form tab based on Security role

I'm trying to hide some tab from a form, like a Field Security Profiles.

 

Is it possible?

 

Thanks!

7 REPLIES 7
Super User
Super User

Re: Hide form tab based on Security role

You can use the visible property to hide almost any control on a PowerApps screen. I have an app where I check to see if the logged in user is listed in the admin list and if so, sets  a global variable gvIsAdmin to true. Then I am hiding the last two rows of fields on the form if the user isn't an admin by setting the visible property of the datacards to gvIsAdmin.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
gavinleung
Level 8

Re: Hide form tab based on Security role

So how you define and maintain the roles and users? 

 

My app is leveraging a SP List to maintain an admin user table, and then I use:

 

If(CountIf(Role, User.Email = User().Email)>0, something true, something false) to control the behaviour of my app. 

gilberto00
Level: Powered On

Re: Hide form tab based on Security role

I'm using the Security Roles standards of Power Platform...

Super User
Super User

Re: Hide form tab based on Security role

In my case I have a list called "PowerApps Roles" and each item in the list is a role (Title field) and each role item has a person field (Users) with a list of users in that role. Then on the start of my app I run this code to identifiy if the logged in user is in the admin role.

 

Set(gvCurrentUser, User());

ClearCollect(colAdmins, LookUp('PowerApps Roles', Title = "Admins", Users)); 
Set(gvIsAdmin, !IsBlank(LookUp(colAdmins,Concatenate("i:0#.f|membership|", gvCurrentUser.Email) in Claims, DisplayName)))

 

*The reason I am using "Claims" instead of "Email" is because our tenant doesn't use the email address as the UPN and User().Email actually returns the UPN and not the Email address. For most tenants this doesn't matter because their Email and UPN are the same.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
gilberto00
Level: Powered On

Re: Hide form tab based on Security role

Hey!

 

   I'm trying to do what you told me, but I'm tryng to see where should I go to be able to apply some code to Hide/unhide tabs...

 

Thanks!image.png

 

Super User
Super User

Re: Hide form tab based on Security role

I don't recognize the screenshot. What type of PowerApp is this (Canvas, Model or Portal)? 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
gilberto00
Level: Powered On

Re: Hide form tab based on Security role

I'm working with Model-Driven.

 

That's a whole screenshot example:

 

image.png

 

Thanks!

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 (4,733)