cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GrootCRM
Helper I
Helper I

Check privileges on current record (PCF component Dataverse/MDA)

Hi to all!

 

I would like to know how I can query if the current user has create/update privileges on the current record.

So an update button (within the PCF component) may be shown or not.

 

Feels basic, but I'm new into this 🙂

 

Thanks a lot!

Elowy.

1 ACCEPTED SOLUTION

Accepted Solutions

Well, it depends on your security model and the roles available. If your users only ever have BU level privs or no privs, then there is no reason to check if they have Global. That said, yeah, unfortunately there is no direct api implementation in PCFs for RetrievePrincipalAccessRequest.

 

Your only alternative is to create the Dataverse Web API request yourself and send it, which is absolutely do-able, just a fair bit more work. Also worth noting, the WebApi.execute() function does exist, it just isn't documented by Microsoft so if you're comfortable with an unsupported approach, you can get to the RetrievePrincipalAccessRequest very quickly that way.

View solution in original post

4 REPLIES 4
cchannon
Super User
Super User
GrootCRM
Helper I
Helper I

Thanks for your response, Cchannon!

If I just want to check if a user has write access to (for example) an account record with an owner. What should I use for privilegeDepth? Or isn't that as simple as one statement and do I have to check all depths?

 

Well, it depends on your security model and the roles available. If your users only ever have BU level privs or no privs, then there is no reason to check if they have Global. That said, yeah, unfortunately there is no direct api implementation in PCFs for RetrievePrincipalAccessRequest.

 

Your only alternative is to create the Dataverse Web API request yourself and send it, which is absolutely do-able, just a fair bit more work. Also worth noting, the WebApi.execute() function does exist, it just isn't documented by Microsoft so if you're comfortable with an unsupported approach, you can get to the RetrievePrincipalAccessRequest very quickly that way.

View solution in original post

GrootCRM
Helper I
Helper I

Thanks again!

So if I use hasEntityPrivilege for the Account entity to check whether the user has write access, the condition will be something like:

 

- ( hasEntityPrivilege (Write, Global) ) or

- ( ( hasEntityPrivilege (Write, Deep) or hasEntityPrivilege (Write, Local) ) and user.BU is record.BU ) or

- ( hasEntityPrivilege (Write,Basic) and ( user == record.owner or user.team == record.owner ) )

 

Regards,

Elowy.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,469)