Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] HasUniqueRoleAssignments value is returned wrong while using Get-PnPProperty and Get-PnPFolder #4085

Closed
1 task
ShinraTenseiii opened this issue Jul 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ShinraTenseiii
Copy link

Notice

Many bugs reported are actually related to the PnP Framework which is used behind the scenes. Consider carefully where to report an issue:

  1. Are you using Invoke-PnPSiteTemplate or Get-PnPSiteTemplate? No
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/pnp/powershell/tree/master/src/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/pnp/pnpframework/issues

Reporting an Issue or Missing Feature

HasUniqueRoleAssignments value is returned wrong while using Get-PnPProperty and Get-PnPFolder. I am trying to get details if a file or folder has unique permissions or not.

To get unique permission for itemI run:
$Item = Get-PnPListItem -List $LibraryName -Id $Document.Id
#Check if the Item has unique permissions
$HasUniquePermissions = $null
$HasUniquePermissions = Get-PnPProperty -ClientObject $Item -Property HasUniqueRoleAssignments**

I believe fuction is chaching data. Once I get a false value it keeps on giving me the false value.

Even if I run Get-PnPFolder:
$FolderObject = Get-PnPFolder -Url $DocumentServerRelativeURL -Includes "ListItemAllFields.HasUniqueRoleAssignments"
$HasUniquePermissions = $FolderObject.ListItemAllFields.HasUniqueRoleAssignments

Expected behavior

IT should return me correct value if the the item has unique permissions or not.

Actual behavior

Returning me wrong value of $HasUniquePermissionsFile

Steps to reproduce behavior

Please include complete script or code samples in-line or linked from gists

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable)
1.12.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
@ShinraTenseiii ShinraTenseiii added the bug Something isn't working label Jul 10, 2024
@jackpoz
Copy link
Contributor

jackpoz commented Jul 13, 2024

Even if I run Get-PnPFolder:
$FolderObject = Get-PnPFolder -Url $DocumentServerRelativeURL -Includes "ListItemAllFields.HasUniqueRoleAssignments"
$HasUniquePermissions = $FolderObject.ListItemAllFields.HasUniqueRoleAssignments

I cannot confirm this issue with Get-PnPFolder using version 2.5.0.

I ran the command below in a libray with 2 folders and broke/inherited permissions multiple times and the command returned the correct result each time:

Get-PnPFolder -List "Test library" -Includes ListItemAllFields.HasUniqueRoleAssignments | %{[PSCustomobject][ordered]@{Name = $_.Name; UniquePermissions = $_.ListItemAllFields.HasUniqueRoleAssignments}}

image

It works also using the -Url overload:

Get-PnPFolder -Url "Test library/Folder A" -Includes ListItemAllFields.HasUniqueRoleAssignments | %{[PSCustomobject][ordered]@{Name = $_.Name; UniquePermissions = $_.ListItemAllFields.HasUniqueRoleAssignments}}

image

Could you please try upgrading to 2.5.0 ?

@veronicageek
Copy link
Collaborator

Thanks for the testing @jackpoz
@ShinraTenseiii - Version 1.12 is not maintained anymore, so please update to the latest as suggested. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants