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

#1694 - added ScriptSafeDomainName param to Set-PnPSite #2363

Merged
merged 2 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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