Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
KoenZomers committed Oct 11, 2024
1 parent b803fe2 commit 9625fdb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fix `Add-PnPDataRowsToSiteTemplate` setting keyColumn to null when not passed. [#4325](https://github.com/pnp/powershell/pull/4325)
- Fix `Connect-PnPOnline` not working correctly when `-DeviceLogin` and `-LaunchBrowser` both are specified. It used to open it in a popup. Now it correctly launches the browser. [#4325](https://github.com/pnp/powershell/pull/4345)
- `Export-PnPUserInfo`, `Export-PnPUserProfile` and `Remove-PnPUserProfile` cmdlets now work properly with proper `-Connection` parameter if specified. [#4389](https://github.com/pnp/powershell/pull/4389)

- Fixed `Get-PnPAzureADAppSitePermission`, `Grant-PnPAzureADAppSitePermission` and `Revoke-PnPAzureADAppSitePermission` cmdlets throwing an error when the site URL is not specified and the app registration used only having Graph permissions

### Removed

- Removed `Publish-PnPCompanyApp` cmdlet as it was not supported anymore. [#4387](https://github.com/pnp/powershell/pull/4387)
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/Apps/GetAzureADAppSitePermission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace PnP.PowerShell.Commands.Apps
{
[Cmdlet(VerbsCommon.Get, "PnPAzureADAppSitePermission", DefaultParameterSetName = ParameterSet_ALL)]
[RequiredApiApplicationPermissions("graph/Sites.FullControl.All")]
[RequiredApiDelegatedOrApplicationPermissions("graph/Sites.FullControl.All")]
[Alias("Get-PnPEntraIDAppSitePermission")]
public class GetPnPAzureADAppSitePermission : PnPGraphCmdlet
{
Expand Down Expand Up @@ -41,7 +41,7 @@ protected override void ExecuteCmdlet()
}
else
{
siteId = PnPContext.Site.Id;
siteId = new SitePipeBind(Connection.Url).GetSiteIdThroughGraph(Connection, AccessToken);
}

if (siteId != Guid.Empty)
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/Apps/GrantAzureADAppSitePermission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace PnP.PowerShell.Commands.Apps
{
[Cmdlet(VerbsSecurity.Grant, "PnPAzureADAppSitePermission")]
[RequiredApiApplicationPermissions("graph/Sites.FullControl.All")]
[RequiredApiDelegatedOrApplicationPermissions("graph/Sites.FullControl.All")]
[Alias("Grant-PnPEntraIDAppSitePermission")]
[OutputType(typeof(AzureADAppPermissionInternal))]
public class GrantPnPAzureADAppSitePermission : PnPGraphCmdlet
Expand Down Expand Up @@ -44,7 +44,7 @@ protected override void ExecuteCmdlet()
else
{
WriteVerbose($"No specific site passed in through -{nameof(Site)}, taking the currently connected to site");
siteId = PnPContext.Site.Id;
siteId = new SitePipeBind(Connection.Url).GetSiteIdThroughGraph(Connection, AccessToken);
WriteVerbose($"Currently connected to site has Id {siteId}");
}

Expand Down
6 changes: 3 additions & 3 deletions src/Commands/Apps/RevokeAzureADAppSitePermission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace PnP.PowerShell.Commands.Apps
{
[Cmdlet(VerbsSecurity.Revoke, "PnPAzureADAppSitePermission")]
[RequiredApiApplicationPermissions("graph/Sites.FullControl.All")]
[RequiredApiDelegatedOrApplicationPermissions("graph/Sites.FullControl.All")]
[Alias("Revoke-PnPEntraIDAppSitePermission")]
public class RevokePnPAzureADAppSitePermission : PnPGraphCmdlet
{
Expand All @@ -31,14 +31,14 @@ protected override void ExecuteCmdlet()
}
else
{
siteId = PnPContext.Site.Id;
siteId = new SitePipeBind(Connection.Url).GetSiteIdThroughGraph(Connection, AccessToken);
}

if (siteId != Guid.Empty)
{
if (Force || ShouldContinue("Are you sure you want to revoke the permissions?", string.Empty))
{
var results = PnP.PowerShell.Commands.Utilities.REST.RestHelper.Delete(Connection.HttpClient, $"https://{Connection.GraphEndPoint}/v1.0/sites/{siteId}/permissions/{PermissionId}", AccessToken);
var results = Utilities.REST.RestHelper.Delete(Connection.HttpClient, $"https://{Connection.GraphEndPoint}/v1.0/sites/{siteId}/permissions/{PermissionId}", AccessToken);
}
}
}
Expand Down

0 comments on commit 9625fdb

Please sign in to comment.