Skip to content

Commit

Permalink
#1694 - added ScriptSafeDomainName param to Set-PnPSite (#2363)
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamdsheth committed Sep 20, 2022
1 parent 83f8be8 commit e309641
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added support for `SubscribeMembersToCalendarEventsDisabled` resource behavior option in `New-PnPMicrosoft365Group` and `New-PnPTeamsTeam` cmdlet. [#2349](https://github.com/pnp/powershell/pull/2349)
- Added `-OneDriveRequestFilesLinkEnabled` option to `Set-PnPTenant` to allow configuring the request files anonymously feature on the tenant level [#2360](https://github.com/pnp/powershell/pull/2360)
- Added `-RequestFilesLinkEnabled` option to `Set-PnPSite` to allow configuring the request files anonymously feature on a per site collection level [#2360](https://github.com/pnp/powershell/pull/2360)
- Added `ScriptSafeDomainName` option to `Set-PnPSite` to allow contributors to insert iframe from specified domains only. [#2363](https://github.com/pnp/powershell/pull/2363)
- Added `AlertTemplateName` paramter to `Add-PnPAlert` to allow configuring the Alert Template type name in the email. [#2362](https://github.com/pnp/powershell/pull/2362)

### Changed
Expand Down
16 changes: 15 additions & 1 deletion documentation/Set-PnPSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Set-PnPSite [-Identity <String>] [-Classification <String>] [-DisableFlows] [-Lo
[-DisableCompanyWideSharingLinks <CompanyWideSharingLinksPolicy>] [-DisableSharingForNonOwners]
[-LocaleId <UInt32>] [-RestrictedToGeo <RestrictedToRegion>] [-SocialBarOnSitePagesDisabled]
[-AnonymousLinkExpirationInDays <Int32>] [-OverrideTenantAnonymousLinkExpirationPolicy]
[-MediaTranscription <MediaTranscriptionPolicyType>] [-SensitivityLabel <Guid>] [-RequestFilesLinkEnabled <Boolean>]
[-MediaTranscription <MediaTranscriptionPolicyType>] [-SensitivityLabel <Guid>] [-RequestFilesLinkEnabled <Boolean>] [-ScriptSafeDomainName <string>]
[-Connection <PnPConnection>] [<CommonParameters>]
```

Expand Down Expand Up @@ -470,6 +470,20 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ScriptSafeDomainName
Allow contributors to insert iframes only from the specified domains only

```yaml
Type: String
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Wait
Wait for the operation to complete

Expand Down
15 changes: 14 additions & 1 deletion src/Commands/Site/SetSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ public class SetSite : PnPSharePointCmdlet
public Guid? SensitivityLabel;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public bool? RequestFilesLinkEnabled;
public bool? RequestFilesLinkEnabled;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public string ScriptSafeDomainName;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_LOCKSTATE)]
public SwitchParameter Wait;
Expand Down Expand Up @@ -133,6 +136,16 @@ protected override void ExecuteCmdlet()
context.ExecuteQueryRetry();
}

if (ParameterSpecified(nameof(ScriptSafeDomainName)) && !string.IsNullOrEmpty(ScriptSafeDomainName))
{
ScriptSafeDomainEntityData scriptSafeDomainEntity = new ScriptSafeDomainEntityData
{
DomainName = ScriptSafeDomainName
};
site.CustomScriptSafeDomains.Create(scriptSafeDomainEntity);
context.ExecuteQueryRetry();
}

if (ParameterSpecified(nameof(LogoFilePath)))
{
if (!System.IO.Path.IsPathRooted(LogoFilePath))
Expand Down

0 comments on commit e309641

Please sign in to comment.