June 23, 2024

SamTech 365

PowerPlatform, Power Apps, Power Automate, PVA, SharePoint, C#, .Net, SQL, Azure News, Tips ….etc

PowerApps – Get Users’ Security Roles’

Users’ Security

I will explain in this article how to retrieve the security roles of users in Dataverse. A colleague asked me how he can find out the different security roles a user has in PowerPlatform. If you are interested in learning about the various default security roles that are available in Dataverse, you can check out the Microsoft Documentation at https://learn.microsoft.com/en-us/power-platform/admin/database-security.

Set a user’s security role

Let’s begin by accessing the Power Platform Admin Center at https://admin.powerplatform.microsoft.com/.

From the left-hand navigation menu, select “Environments” to choose the environment in which you want to manage security roles for users.

From the environment page, you can select the users list.

Below is a list of users in the selected environment.

You can either choose an existing user or add a new one.

If you select to add a new user, you will be prompted to select the appropriate security roles for that user.

After selecting the roles, click on the ‘Save’ button to add the user with the selected roles.

Retrieve the security roles for a specified user in your Power Apps Canvas App.

Please keep in mind that you will need to add the “Users” and “Security Roles” data sources to your Power Apps Canvas App.

In my demo app, I have included two galleries. The first gallery, located on the left-hand side, shows a list of all the users in the environment.

The Items property of the users’ gallery is as follows:

To easily distinguish between system accounts and user accounts, I have incorporated unique icons. Furthermore, I have included a search bar that enables you to swiftly filter through the list of users.
This feature is especially helpful if you have a large number of users in your environment.

The Security Roles

On the right side gallery, the items property is driven by the selected user from the left gallery, as follows:

Et voila !