Skip to content

Commit

Permalink
Merge pull request #4508 from KoenZomers/AddAllowWebPropertyBagUpdate…
Browse files Browse the repository at this point in the history
…WhenDenyAddAndCustomizePagesIsEnabled

Adding `-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled` to `Set-PnPTenant`
  • Loading branch information
KoenZomers authored Nov 4, 2024
2 parents a4c63e0 + 5889523 commit 1605bb4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `Restore-PnPFlow` cmdlet which allows for undeleting a flow within 21 days of deletion. [#4415](https://github.com/pnp/powershell/pull/4415)
- Added `-ExcludeDeprecated` to `Export-PnpTaxonomy` which allows for deprecated terms to be excluded from the export [#4053](https://github.com/pnp/powershell/pull/4053)
- Added `-HidePeoplePreviewingFiles` to `Set-PnPSite` which allows for hiding the people previewing files feature on a site [#4416](https://github.com/pnp/powershell/pull/4416)
- Added `-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled` to `Set-PnPTenant` which allows for updating of web property bag when DenyAddAndCustomizePages is enabled

### Changed

Expand Down
15 changes: 15 additions & 0 deletions documentation/Set-PnPTenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Set-PnPTenant [-SpecialCharactersStateInFileFolderNames <SpecialCharactersState>
[-GuestSharingGroupAllowListInTenantByPrincipalIdentity <string[]>]
[-OneDriveSharingCapability <SharingCapabilities>]
[-DelayDenyAddAndCustomizePagesEnforcement <Boolean>]
[-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled <Boolean>]
[-Force] [-Connection <PnPConnection>]
```

Expand Down Expand Up @@ -242,6 +243,20 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled
Enables or disables web property bag update when DenyAddAndCustomizePages is enabled. When AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled is set to $true, web property bag can be updated even if DenyAddAndCustomizePages is turned on when the user had AddAndCustomizePages (prior to DenyAddAndCustomizePages removing it).
```yaml
Type: Boolean
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -ApplyAppEnforcedRestrictionsToAdHocRecipients
When the feature is enabled, all guest users are subject to conditional access policy. By default guest users who are accessing SharePoint Online files with pass code are exempt from the conditional access policy.
Expand Down
8 changes: 8 additions & 0 deletions src/Commands/Admin/SetTenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ public class SetTenant : PnPAdminCmdlet
[Parameter(Mandatory = false)]
public string[] GuestSharingGroupAllowListInTenantByPrincipalIdentity { private set; get; }

[Parameter(Mandatory = false)]
public bool? AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled { private set; get; }

protected override void ExecuteCmdlet()
{
AdminContext.Load(Tenant);
Expand Down Expand Up @@ -1539,6 +1542,11 @@ protected override void ExecuteCmdlet()
Tenant.ODBSharingCapability = OneDriveSharingCapability.Value;
modified = true;
}
if(AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.HasValue)
{
Tenant.AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled = AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.Value;
modified = true;
}
if (GuestSharingGroupAllowListInTenantByPrincipalIdentity !=null)
{
if (GuestSharingGroupAllowListInTenantByPrincipalIdentity.Length > 0)
Expand Down
24 changes: 4 additions & 20 deletions src/Commands/Model/SPOTenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public class SPOTenant
public bool? SharePointAddInsDisabled { private set; get; }
public SharingCapabilities? OneDriveSharingCapability { private set; get; }
public string[] GuestSharingGroupAllowListInTenantByPrincipalIdentity { private set; get; }
public bool? AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled { private set; get; }
#endregion

public SPOTenant(Tenant tenant, ClientContext clientContext)
Expand Down Expand Up @@ -739,26 +740,8 @@ public SPOTenant(Tenant tenant, ClientContext clientContext)
{
}

try
{
AppBypassInformationBarriers = tenant.AppBypassInformationBarriers;
}
catch
{
}

try
{
if (tenant.DefaultODBMode != null)
{
DefaultOneDriveInformationBarrierMode = Enum.Parse<InformationBarriersMode>(tenant.DefaultODBMode);
}
}
catch
{
}


try { AppBypassInformationBarriers = tenant.AppBypassInformationBarriers; } catch { }
try { if (tenant.DefaultODBMode != null) DefaultOneDriveInformationBarrierMode = Enum.Parse<InformationBarriersMode>(tenant.DefaultODBMode); } catch { }
try { CoreSharingCapability = tenant.CoreSharingCapability; } catch { }
try { EnableVersionExpirationSetting = tenant.EnableVersionExpirationSetting; } catch { }
try { BlockUserInfoVisibilityInOneDrive = tenant.BlockUserInfoVisibilityInOneDrive; } catch { }
Expand Down Expand Up @@ -789,6 +772,7 @@ public SPOTenant(Tenant tenant, ClientContext clientContext)
try { SharePointAddInsDisabled = tenant.SharePointAddInsDisabled; } catch { }
try { OneDriveSharingCapability = tenant.ODBSharingCapability; } catch { }
try { GuestSharingGroupAllowListInTenantByPrincipalIdentity = tenant.GuestSharingGroupAllowListInTenantByPrincipalIdentity?.ToArray(); } catch { }
try { AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled = tenant.AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled; } catch { }
}
}
}

0 comments on commit 1605bb4

Please sign in to comment.