Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

User access in canvas app

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have created a canvas app in the app I want some users to only view the data and some users to only edit the data .How to achieve the same. 

Also I have one table created in dataverse which should only be editable by Super admins. How to do the setup for same.

Categories:
  • Pstork1 Profile Picture
    65,908 Most Valuable Professional on at
    Re: User access in canvas app

    @saritawavhal, Just to be clear, those roles and that security only applies to Dataverse tables. If the app is using any other data sources then those roles are meaningless.

  • Sarita Suryawanshi Profile Picture
    64 on at
    Re: User access in canvas app

    To control access to data in a canvas app based on user roles and permissions, you can leverage Power Apps roles and Dataverse security roles.

    Define User Roles in Canvas App: In Power Apps, you can define roles for your users. You might have roles like "Viewers" and "Editors." You can create these roles in the Power Platform admin center.
    Use Security in Formulas: Utilize the roles in the formulas of your app controls. For example, you might have a button that triggers an edit action. In the OnSelect property of that button, you can use the User and Role functions to check the user's role and conditionally allow or block the action.

    If(User().Roles["Editors"], Navigate(EditScreen, ScreenTransition.None), Notify("You don't have permission to edit.", NotificationType.Error))

    This code checks if the user has the "Editors" role and navigates to the edit screen. If not, it shows an error notification.

    Create Dataverse Security Roles: In the Dataverse, you can create security roles. For your scenario, create a "Super Admins" role.

    Assign Roles to Users: Assign users to the appropriate roles in the Dataverse. Super admins should be assigned to the "Super Admins" security role.

    Set Entity Permissions: Go to the Dataverse environment, select your table (entity), and set the entity permissions based on roles. In the entity settings, you can define who can read, write, create, or delete records.

    For "Super Admins," give them full permissions. For other roles, restrict permissions as needed.

    If my response helped resolving your issue, kindly click on "Accept as Solution." This helps others easily locate the solution and also marks the question as resolved. If you found the information beneficial for other reasons, please give it a Thumbs Up. Thank you!

  • Pstork1 Profile Picture
    65,908 Most Valuable Professional on at
    Re: User access in canvas app

    Power apps doesn't provide a security layer. User's will have whatever access they normally have to the underlying data source in the app.  So whether they can view or edit the data depends on what permissions they have in the data source. Different data sources do permissions differently. For Data verse permissions are assigned based on roles created for the tables.

  • ANB Profile Picture
    7,075 Super User 2025 Season 1 on at
    Re: User access in canvas app

    Hi @oshinjain , You can create one table in data verse, let say User Details. This table will have column like Full Name, Email Address and Role. You define 3 roles. View , Edit  and Admin

     

    Add all users in this table with thier roles that you want. You can use Power Automate to upload data to this table.

     

    Now on the App , OnStart property you can have this logic

     

    Set(gblvar_CurrentUserRole, LookUp(TableName, FullName = User().FullName).Role)

     

     

    This variable gives you the role. Now, on each controls displaymode property you can have below code:

     

    If(gblvar_CurrentUserRole = "View", DisplayMode.Disabled, Or(gblvar_CurrentUserRole = "Edit",gblvar_CurrentUserRole = "Admin"),DisplayMode.Edit)

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,535 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,908 Most Valuable Professional

Leaderboard