Skip to content
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
13 changes: 12 additions & 1 deletion src/Teams/beta/custom/GetMgBetaChatRscConfiguration_Get.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ protected override void ProcessRecord()
{
await ((Microsoft.Graph.Beta.PowerShell.Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Microsoft.Graph.Beta.PowerShell.Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }

MGTeamsInternalPermissionGrantPolicyCollection permissionGrantPolicyCollection =
await this.Client.GetPermissionGrantPolicies(selectQuery: "id, resourceScopeType", eventListener: this, sender: this.Pipeline);

WriteVerbose($"Fetched permission grant policies for tenant.");

if (((Microsoft.Graph.Beta.PowerShell.Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }

// Get Teams App Settings
Models.IMicrosoftGraphTeamsAppSettings teamsAppSettings = await this.Client.GetTeamsAppSettings(this, Pipeline);

Expand All @@ -253,7 +260,11 @@ protected override void ProcessRecord()

RscConfigurationSynthesizer rscConfigurationConverter = new RscConfigurationSynthesizer();
Models.IMicrosoftGraphRscConfiguration microsoftGraphRscConfiguration =
rscConfigurationConverter.ConvertToChatRscConfiguration(teamsAppSettings, authorizationPolicy, this);
rscConfigurationConverter.ConvertToChatRscConfiguration(
permissionGrantPolicyCollection: permissionGrantPolicyCollection,
teamsAppSettings: teamsAppSettings,
authorizationPolicy: authorizationPolicy,
eventListener: this);

WriteObject(microsoftGraphRscConfiguration);

Expand Down
12 changes: 10 additions & 2 deletions src/Teams/beta/custom/GetMgBetaTeamRscConfiguration_Get.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ protected override void ProcessRecord()
{
await ((Microsoft.Graph.Beta.PowerShell.Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Microsoft.Graph.Beta.PowerShell.Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }

MGTeamsInternalPermissionGrantPolicyCollection permissionGrantPolicyCollection =
await this.Client.GetPermissionGrantPolicies(selectQuery: "id, resourceScopeType", eventListener: this, sender: this.Pipeline);

WriteVerbose($"Fetched permission grant policies for tenant.");

// Get Group consent settings
MGTeamsInternalTenantConsentSettingsCollection tenantConsentSettingCollection = await this.Client.GetTenantConsentSettings(this, Pipeline);

Expand All @@ -252,8 +257,11 @@ protected override void ProcessRecord()
if (((Microsoft.Graph.Beta.PowerShell.Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }

RscConfigurationSynthesizer rscConfigurationConverter = new RscConfigurationSynthesizer();
Models.IMicrosoftGraphRscConfiguration microsoftGraphRscConfiguration =
rscConfigurationConverter.ConvertToTeamRscConfiguration(tenantConsentSettingCollection, authorizationPolicy, this);
Models.IMicrosoftGraphRscConfiguration microsoftGraphRscConfiguration = rscConfigurationConverter.ConvertToTeamRscConfiguration(
permissionGrantPolicyCollection,
tenantConsentSettingCollection,
authorizationPolicy,
this);

WriteObject(microsoftGraphRscConfiguration);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System.Text;

namespace Microsoft.Graph.Beta.PowerShell.TeamsInternal.Requests
{
/// <summary>
/// Request to get all permission grant policies in the tenant.
/// </summary>
internal class GetPermissionGrantPolicyCollectionRequest : TeamsHttpRequest
{
/// <summary>
/// Select query.
/// </summary>
private readonly string selectQuery;

/// <summary>
/// Initializes a new instance of the <see cref="GetPermissionGrantPolicyCollectionRequest"/> class.
/// </summary>
/// <param name="servicePrincipalId">The service principal Id.</param>
internal GetPermissionGrantPolicyCollectionRequest(string selectQuery)
{
this.selectQuery = selectQuery;
}

/// <summary>
/// Gets the Http method for the request.
/// </summary>
/// <returns>The http method.</returns>
protected override System.Net.Http.HttpMethod GetHttpMethod()
{
return Runtime.Method.Get;
}

/// <summary>
/// Gets the base url for the request.
/// </summary>
/// <returns>string containing the base url.</returns>
protected override string GetBaseUrl()
{
StringBuilder sb = new StringBuilder();
sb.Append("https://graph.microsoft.com/beta/policies/permissiongrantpolicies");
if (this.selectQuery != null)
{
sb.Append($"?$select={this.selectQuery}");
}

return sb.ToString();
}

/// <summary>
/// Gets the body of the request as a string.
/// </summary>
/// <returns>The body.</returns>
protected override string GetBodyAsString()
{
return null;
}
}
}
12 changes: 11 additions & 1 deletion src/Teams/beta/custom/MicrosoftGraphRscConfigurationState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ public enum MicrosoftGraphRscConfigurationState
/// <summary>
/// Enabled for all apps.
/// </summary>
EnabledForAllApps
EnabledForAllApps,

/// <summary>
/// Enabled for selected group of users.
/// </summary>
EnabledForSelectedGroupOfUsers,

/// <summary>
/// Custom configuration not understood by the sdk.
/// </summary>
Custom
}
}
Loading