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

Feature: add support for RAC in PnPTenantSite cmdlet #3463

Merged
merged 3 commits into from
Oct 8, 2023
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 @@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added option to pass in a Stream or XML string to `Read-PnPTenantTemplate` allowing the tenant template to be modified before being applied. [#3431](https://github.com/pnp/powershell/pull/3431)
- Added `Get-PnPTenantInfo` which allows retrieving tenant information by its Id or domain name. [#3414](https://github.com/pnp/powershell/pull/3414)
- Added option to create a Microsoft 365 Group with dynamic membership by passing in `-DynamicMembershipRule` [#3426](https://github.com/pnp/powershell/pull/3426)
- Added `RestrictedAccessControl`, `ClearRestrictedAccessControl`, `RemoveRestrictedAccessControlGroups`, `AddRestrictedAccessControlGroups` and `RestrictedAccessControlGroups` parameters to `Set-PnPTenantSite` cmdlet to handle restricted access control. [#3463](https://github.com/pnp/powershell/pull/3463)
- Added `Get-PnPRetentionLabel` cmdlet to retrieve Purview retention labels. [#3459](https://github.com/pnp/powershell/pull/3459)

### Fixed
Expand Down
70 changes: 70 additions & 0 deletions documentation/Set-PnPTenantSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,76 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -RestrictedAccessControl
To apply restricted access control to a group-connected or Teams-connected site.

```yaml
Type: Boolean
Parameter Sets: Set Properties

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

### -ClearRestrictedAccessControl
To reset restricted access control configuration for a site.

```yaml
Type: Switch Parameter
Parameter Sets: Set Properties

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

### -RemoveRestrictedAccessControlGroups
You can remove the specified security group from restricted access control configuration. Members of the security group are no longer be able to access site content while the policy is enforced on the site.

```yaml
Type: GUID []
Parameter Sets: Set Properties

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

### -AddRestrictedAccessControlGroups
You can add the specified security groups for restricted access control configuration.

```yaml
Type: GUID []
Parameter Sets: Set Properties

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

### -RestrictedAccessControlGroups
To edit a restricted access control group for a non-group site

```yaml
Type: GUID []
Parameter Sets: Set Properties

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

### -Wait
Wait for the operation to complete

Expand Down
45 changes: 45 additions & 0 deletions src/Commands/Admin/SetTenantSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,21 @@ public class SetTenantSite : PnPAdminCmdlet
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public bool? ListsShowHeaderAndNavigation;

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

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public SwitchParameter ClearRestrictedAccessControl;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public Guid[] RemoveRestrictedAccessControlGroups;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public Guid[] AddRestrictedAccessControlGroups;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public Guid[] RestrictedAccessControlGroups;

[Parameter(Mandatory = false)]
public SwitchParameter Wait;

Expand Down Expand Up @@ -537,6 +552,36 @@ private void SetSiteProperties(Func<TenantOperationMessage, bool> timeoutFunctio
updateRequired = true;
}

if (ParameterSpecified(nameof(RestrictedAccessControl)) && RestrictedAccessControl.HasValue)
{
props.RestrictedAccessControl = RestrictedAccessControl.Value;
updateRequired = true;
}

if (ParameterSpecified(nameof(ClearRestrictedAccessControl)))
{
props.ClearRestrictedAccessControl = true;
updateRequired = true;
}

if (ParameterSpecified(nameof(RemoveRestrictedAccessControlGroups)) && RemoveRestrictedAccessControlGroups.Length > 0)
{
props.RestrictedAccessControlGroupsToRemove = RemoveRestrictedAccessControlGroups;
updateRequired = true;
}

if (ParameterSpecified(nameof(AddRestrictedAccessControlGroups)) && AddRestrictedAccessControlGroups.Length > 0)
{
props.RestrictedAccessControlGroupsToAdd = AddRestrictedAccessControlGroups;
updateRequired = true;
}

if (ParameterSpecified(nameof(RestrictedAccessControlGroups)) && RestrictedAccessControlGroups.Length > 0)
{
props.RestrictedAccessControlGroups = RestrictedAccessControlGroups;
updateRequired = true;
}

if (updateRequired)
{
var op = props.Update();
Expand Down
Loading