This repository was archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2569 from SharePoint/dev
March 2020 Release
- Loading branch information
Showing
22 changed files
with
2,689 additions
and
2,105 deletions.
There are no files selected for viewing
Binary file not shown.
2,252 changes: 1,235 additions & 1,017 deletions
2,252
Binaries/SharePointPnP.Modernization.Framework.xml
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
2,252 changes: 1,235 additions & 1,017 deletions
2,252
Binaries/release/SharePointPnP.Modernization.Framework.xml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
using SharePointPnP.PowerShell.CmdletHelpAttributes; | ||
using SharePointPnP.PowerShell.Commands.Base; | ||
using SharePointPnP.PowerShell.Commands.Base.PipeBinds; | ||
using System; | ||
using System.Management.Automation; | ||
|
||
namespace SharePointPnP.PowerShell.Commands.Admin | ||
|
@@ -12,8 +13,7 @@ namespace SharePointPnP.PowerShell.Commands.Admin | |
[CmdletHelp(@"Grant additional permissions to the permissions already in place to associate sites to Hub Sites for one or more specific users", | ||
Category = CmdletHelpCategory.TenantAdmin, | ||
SupportedPlatform = CmdletSupportedPlatform.Online)] | ||
[CmdletExample(Code = @"PS:> Grant-PnPHubSiteRights -Identity https://contoso.sharepoint.com/sites/hubsite -Principals ""[email protected]"",""[email protected]"" -Rights Join", Remarks = "This example shows how to grant rights to myuser and myotheruser to associate their sites with the provided Hub Site", SortOrder = 1)] | ||
[CmdletExample(Code = @"PS:> Grant-PnPHubSiteRights -Identity https://contoso.sharepoint.com/sites/hubsite -Principals ""[email protected]"" -Rights None", Remarks = "This example shows how to revoke rights from myuser to associate their sites with the provided Hub Site", SortOrder = 2)] | ||
[CmdletExample(Code = @"PS:> Grant-PnPHubSiteRights -Identity https://contoso.sharepoint.com/sites/hubsite -Principals ""[email protected]"",""[email protected]""", Remarks = "This example shows how to grant rights to myuser and myotheruser to associate their sites with the provided Hub Site", SortOrder = 1)] | ||
public class GrantHubSiteRights : PnPAdminCmdlet | ||
{ | ||
[Parameter(Position = 0, ValueFromPipeline = true, Mandatory = true, HelpMessage = "The Hub Site to set the permissions on to associate another site with this Hub Site")] | ||
|
@@ -23,12 +23,34 @@ public class GrantHubSiteRights : PnPAdminCmdlet | |
[Parameter(Mandatory = true, HelpMessage = "One or more usernames that will be given or revoked the permission to associate a site with this Hub Site. It does not replace permissions given out before but adds to the already existing permissions.")] | ||
public string[] Principals { get; set; } | ||
|
||
[Parameter(Mandatory = true, HelpMessage = "Provide Join to give permissions to associate a site with this Hub Site or use None to revoke the permissions for the user(s) specified with the Principals argument")] | ||
public SPOHubSiteUserRights Rights { get; set; } | ||
[Parameter(Mandatory = false, HelpMessage = "Provide Join to give permissions to associate a site with this Hub Site or use None to revoke the permissions for the user(s) specified with the Principals argument")] | ||
[Obsolete("Use Revoke-PnPHubSiteRights to revoke rights and Grant-PnPHubSiteRights without the -Rights parameter to grant rights")] | ||
public SPOHubSiteUserRights Rights { get; set; } = SPOHubSiteUserRights.Join; | ||
|
||
protected override void ExecuteCmdlet() | ||
{ | ||
base.Tenant.GrantHubSiteRights(Identity.Url ?? Identity.GetHubSite(Tenant).SiteUrl, Principals, Rights); | ||
if (MyInvocation.BoundParameters.ContainsKey("Rights")) | ||
{ | ||
#pragma warning disable CS0618 // Type or member is obsolete | ||
switch (Rights) | ||
{ | ||
case SPOHubSiteUserRights.Join: | ||
{ | ||
base.Tenant.GrantHubSiteRights(Identity.Url ?? Identity.GetHubSite(Tenant).SiteUrl, Principals, SPOHubSiteUserRights.Join); | ||
break; | ||
} | ||
case SPOHubSiteUserRights.None: | ||
{ | ||
base.Tenant.RevokeHubSiteRights(Identity.Url ?? Identity.GetHubSite(Tenant).SiteUrl, Principals); | ||
break; | ||
} | ||
} | ||
} | ||
#pragma warning restore CS0618 // Type or member is obsolete | ||
else | ||
{ | ||
base.Tenant.GrantHubSiteRights(Identity.Url ?? Identity.GetHubSite(Tenant).SiteUrl, Principals, SPOHubSiteUserRights.Join); | ||
} | ||
ClientContext.ExecuteQueryRetry(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#if !ONPREMISES | ||
using Microsoft.Online.SharePoint.TenantAdministration; | ||
using Microsoft.SharePoint.Client; | ||
using SharePointPnP.PowerShell.CmdletHelpAttributes; | ||
using SharePointPnP.PowerShell.Commands.Base; | ||
using SharePointPnP.PowerShell.Commands.Base.PipeBinds; | ||
using System; | ||
using System.Management.Automation; | ||
|
||
namespace SharePointPnP.PowerShell.Commands.Admin | ||
{ | ||
[Cmdlet(VerbsSecurity.Revoke, "PnPHubSiteRights")] | ||
[CmdletHelp(@"Revoke permissions to the permissions already in place to associate sites to Hub Sites for one or more specific users", | ||
Category = CmdletHelpCategory.TenantAdmin, | ||
SupportedPlatform = CmdletSupportedPlatform.Online)] | ||
[CmdletExample(Code = @"PS:> Revoke-PnPHubSiteRights -Identity https://contoso.sharepoint.com/sites/hubsite -Principals ""[email protected]"",""[email protected]""", Remarks = "This example shows how to revoke the rights of myuser and myotheruser to associate their sites with the provided Hub Site", SortOrder = 1)] | ||
public class RevokeHubSiteRights : PnPAdminCmdlet | ||
{ | ||
[Parameter(Position = 0, ValueFromPipeline = true, Mandatory = true, HelpMessage = "The Hub Site to revoke the permissions on to associate another site with this Hub Site")] | ||
[Alias("HubSite")] | ||
public HubSitePipeBind Identity { get; set; } | ||
|
||
[Parameter(Mandatory = true, HelpMessage = "One or more usernames that will be revoked the permission to associate a site with this Hub Site.")] | ||
public string[] Principals { get; set; } | ||
|
||
protected override void ExecuteCmdlet() | ||
{ | ||
base.Tenant.RevokeHubSiteRights(Identity.Url ?? Identity.GetHubSite(Tenant).SiteUrl, Principals); | ||
ClientContext.ExecuteQueryRetry(); | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.