For a power Apps project, I needed certain controls to only be visible for Owners and Co-Owners of the app, and not be visible for Users. I had some administrative functions I wanted to hide. This is how I went about doing that.
1) Add Data Sources
I added in "Power Apps for Makers", and "Office 365 Users" to my data sources for the app.2) Create a Variable to get all the role assignments
I created a variable that gets set "OnVisible" for the screen using the code below. You will need to replace the app ID with the App Id for your project.Set(varPermissions,
LookUp(
ForAll(
PowerAppsforMakers.GetAppRoleAssignment("b17axxxx-xxxx-xxxx-xxxx-xxxxxxx1de93").value,
{
User: properties.principal.email,
Role: properties.roleName
}
),
User = Office365Users.MyProfileV2().mail
).Role)
3) Check the signed in User's role assignment in the Visibility section of the control
In the control visibility, paste in this code:If(varPermissions="Owner" || varPermissions="CanEdit",true,false)
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.