Introduction
In this article, we are going to see how to hide icons or make them visible (add new, admin) from a power apps form, based on user permissions in a SharePoint group.
If the logged-in user has admin permissions, he/she can see the admin and add new icons.
We are going to use power automate to achieve this.
On the visible part of the application Screen, I run a Flow.
This below flow is checking to see if the logged-in user is the admin of the team that owns the SharePoint list.
Note
I have added some of the extra actions in the flow for my requirement, so please ignore those.
Firstly, initialize some variables, then call the SharePoint API to check the current users’ rights in the given SharePoint site.
The variable in the Uri is passed in from the Power App, which is the logged-in user's email address.
If this call returns a value, it means that the user is in the admin group, and this result is passed back to the Power App.
The isAdmin boolean is set after the call as shown previously.
This global variable is used on the List of Incidents screen to hide or show an icon at the top
The visibility of this is controlled by the isAdmin value.
Conclusion
Here, I have used the power apps screen on the visible property to trigger the flow, but you can do the same in the app on-start property also. You can store the Boolean value in a global variable and use that wherever you want.