This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 659
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 #1549 from SharePoint/dev
May 2018 Release
- Loading branch information
Showing
39 changed files
with
999 additions
and
119 deletions.
There are no files selected for viewing
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
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
46 changes: 46 additions & 0 deletions
46
Commands/Apps/ApproveTenantServicePrincipalPermissionRequest.cs
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,46 @@ | ||
#if !ONPREMISES | ||
using Microsoft.Online.SharePoint.TenantAdministration.Internal; | ||
using Microsoft.SharePoint.Client; | ||
using SharePointPnP.PowerShell.CmdletHelpAttributes; | ||
using SharePointPnP.PowerShell.Commands.Base; | ||
using SharePointPnP.PowerShell.Commands.Base.PipeBinds; | ||
using SharePointPnP.PowerShell.Commands.Model; | ||
using System.Management.Automation; | ||
|
||
namespace SharePointPnP.PowerShell.Commands.Apps | ||
{ | ||
[Cmdlet(VerbsLifecycle.Approve, "PnPTenantServicePrincipalPermissionRequest")] | ||
[CmdletHelp(@"Approves a permission request for the current tenant's ""SharePoint Online Client"" service principal", | ||
DetailedDescription = @"Approves a permission request for the current tenant's ""SharePoint Online Client"" service principal | ||
The return value of a successful call is a permission grant object. | ||
To get the collection of permission grants for the ""SharePoint Online Client"" service principal, use the Get-PnPTenantServicePrincipalPermissionGrants command. | ||
Approving a permission request also removes that request from the list of permission requests.", | ||
SupportedPlatform = CmdletSupportedPlatform.Online, | ||
Category = CmdletHelpCategory.TenantAdmin)] | ||
public class ApproveTenantServicePrincipalPermissionRequests : PnPAdminCmdlet | ||
{ | ||
[Parameter(Mandatory = true)] | ||
public GuidPipeBind RequestId; | ||
|
||
[Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")] | ||
public SwitchParameter Force; | ||
|
||
protected override void ExecuteCmdlet() | ||
{ | ||
if (Force || ShouldContinue($"Approve request {RequestId.Id}?", "Continue")) | ||
{ | ||
var servicePrincipal = new SPOWebAppServicePrincipal(ClientContext); | ||
var request = servicePrincipal.PermissionRequests.GetById(RequestId.Id); | ||
var grant = request.Approve(); | ||
ClientContext.Load(grant); | ||
ClientContext.ExecuteQueryRetry(); | ||
WriteObject(new TenantServicePrincipalPermissionGrant(grant)); | ||
} | ||
} | ||
|
||
} | ||
} | ||
#endif |
39 changes: 39 additions & 0 deletions
39
Commands/Apps/DenyTenantServicePrincipalPermissionRequest.cs
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,39 @@ | ||
#if !ONPREMISES | ||
using Microsoft.Online.SharePoint.TenantAdministration.Internal; | ||
using Microsoft.SharePoint.Client; | ||
using SharePointPnP.PowerShell.CmdletHelpAttributes; | ||
using SharePointPnP.PowerShell.Commands.Base; | ||
using SharePointPnP.PowerShell.Commands.Base.PipeBinds; | ||
using System.Management.Automation; | ||
|
||
namespace SharePointPnP.PowerShell.Commands.Apps | ||
{ | ||
[Cmdlet(VerbsLifecycle.Deny, "PnPTenantServicePrincipalPermissionRequest")] | ||
[CmdletHelp(@"Denies a permission request for the current tenant's ""SharePoint Online Client"" service principal", | ||
DetailedDescription = @"Denies a permission request for the current tenant's ""SharePoint Online Client"" service principal | ||
Denying a permission request removes that request from the list of permission requests.", | ||
SupportedPlatform = CmdletSupportedPlatform.Online, | ||
Category = CmdletHelpCategory.TenantAdmin)] | ||
public class DenyTenantServicePrincipalPermissionRequests : PnPAdminCmdlet | ||
{ | ||
[Parameter(Mandatory = true)] | ||
public GuidPipeBind RequestId; | ||
|
||
[Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")] | ||
public SwitchParameter Force; | ||
|
||
protected override void ExecuteCmdlet() | ||
{ | ||
if (Force || ShouldContinue($"Deny request {RequestId.Id}?", "Continue")) | ||
{ | ||
var servicePrincipal = new SPOWebAppServicePrincipal(ClientContext); | ||
var request = servicePrincipal.PermissionRequests.GetById(RequestId.Id); | ||
request.Deny(); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#if !ONPREMISES | ||
using Microsoft.Online.SharePoint.TenantAdministration.Internal; | ||
using Microsoft.SharePoint.Client; | ||
using SharePointPnP.PowerShell.CmdletHelpAttributes; | ||
using SharePointPnP.PowerShell.Commands.Base; | ||
using System.Management.Automation; | ||
|
||
namespace SharePointPnP.PowerShell.Commands.Apps | ||
{ | ||
[Cmdlet(VerbsLifecycle.Disable, "PnPTenantServicePrincipal", ConfirmImpact = ConfirmImpact.High)] | ||
[CmdletHelp(@"Enables the current tenant's ""SharePoint Online Client"" service principal.", | ||
DetailedDescription = @"Enables the current tenant's ""SharePoint Online Client"" service principal.", | ||
SupportedPlatform = CmdletSupportedPlatform.Online, | ||
Category = CmdletHelpCategory.TenantAdmin)] | ||
public class DisableTenantServicePrincipal : PnPAdminCmdlet | ||
{ | ||
[Parameter(Mandatory = false, HelpMessage = "Specifying the Force parameter will skip the confirmation question.")] | ||
public SwitchParameter Force; | ||
|
||
protected override void ExecuteCmdlet() | ||
{ | ||
if (ShouldContinue("Do you want to disable the Tenant Service Principal?", "Continue?")) | ||
{ | ||
var servicePrincipal = new SPOWebAppServicePrincipal(ClientContext); | ||
servicePrincipal.AccountEnabled = false; | ||
servicePrincipal.Update(); | ||
ClientContext.Load(servicePrincipal); | ||
ClientContext.ExecuteQueryRetry(); | ||
WriteObject(servicePrincipal); | ||
} | ||
} | ||
} | ||
} | ||
#endif |
Oops, something went wrong.