cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

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 II
Super User II

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.
Resolver I
Resolver I

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. 

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

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.

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

 

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.

I'm working with Model-Driven.

 

That's a whole screenshot example:

 

image.png

 

Thanks!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,884)