From ab06985a65623b97d7646a6e68386744da9175c8 Mon Sep 17 00:00:00 2001 From: AMSoftwareNL Date: Sun, 7 Nov 2021 18:16:51 +0000 Subject: [PATCH] v2.2.0.0 --- .../AMSoftware.Crm.PowerShell.Commands.csproj | 60 ++++--- .../Content/GetContentAccessCommand.cs | 96 +++++++++++ .../HelpUrlConstants.cs | 151 ++++++++++------- .../Plugins/RegisterPluginStepCommand.cs | 8 +- .../Properties/AssemblyInfo.cs | 6 +- .../Security/AddRecordTeamUserCommand.cs | 62 +++++++ .../Security/GetPrincipalPrivilegesCommand.cs | 88 ++++++++++ .../GetPrincipalRolesCommand.cs | 2 +- .../GetRoleCommand.cs | 2 +- .../GetRolePrincipalsCommand.cs | 2 +- .../Security/GetRolePrivilegesCommand.cs | 123 ++++++++++++++ .../GetTeamCommand.cs | 2 +- .../Security/GetTeamTemplateCommand.cs | 120 +++++++++++++ .../GetTeamUsersCommand.cs | 2 +- .../GetUserCommand.cs | 2 +- .../GetUserTeamsCommand.cs | 2 +- .../Security/NewApplicationCommand.cs | 75 +++++++++ .../NewRoleCommand.cs | 9 +- .../NewTeamCommand.cs | 40 ++++- .../Security/NewTeamTemplateCommand.cs | 75 +++++++++ .../NewUserCommand.cs | 2 +- .../RemovePrincipalRolesCommand.cs | 2 +- .../Security/RemoveRecordTeamUserCommand.cs | 61 +++++++ .../RemoveRolePrincipalsCommand.cs | 2 +- .../Security/RemoveRolePrivilegeCommand.cs | 139 +++++++++++++++ .../Security/RemoveTeamCommand.cs | 47 ++++++ .../Security/RemoveTeamTemplateCommand.cs | 47 ++++++ .../RemoveTeamUsersCommand.cs | 2 +- .../RemoveUserParentCommand.cs | 2 +- .../RemoveUserTeamsCommand.cs | 2 +- .../SetOwnerCommand.cs | 2 +- .../SetPrincipalRolesCommand.cs | 2 +- .../Security/SetRoleCommand.cs | 73 ++++++++ .../SetRolePrincipalsCommand.cs | 2 +- .../Security/SetRolePrivilegeCommand.cs | 150 +++++++++++++++++ .../Security/SetTeamCommand.cs | 72 ++++++++ .../Security/SetTeamTemplateCommand.cs | 79 +++++++++ .../SetTeamUsersCommand.cs | 2 +- .../SetUserTeamsCommand.cs | 2 +- .../Security/TestUserPrivilegeCommand.cs | 144 ++++++++++++++++ .../SetSessionCommand.cs | 22 ++- .../UseImpersonatedUserCommand.cs | 50 ++++++ .../AMSoftware.Crm.PowerShell.Common.csproj | 2 +- .../Converters/EntityConverter.cs | 6 +- .../Helpers/SecurityManagementHelper.cs | 23 +++ .../Properties/AssemblyInfo.cs | 6 +- AMSoftware.Crm.PowerShell.Common/_enum.cs | 41 ++++- .../AMSoftware.Crm.Powershell.Format.ps1xml | 114 ++++++++++++- AMSoftware.Crm.PowerShell/AMSoftware.Crm.psd1 | Bin 6952 -> 6952 bytes AMSoftware.Crm.Powershell.sln | 5 + docker/Dockerfile | 3 +- docs/AMSoftware.Crm.md | 53 +++++- docs/Add-CrmRecordTeamUser.md | 88 ++++++++++ docs/Add-CrmRelationship.md | 2 +- docs/Export-CrmSolution.md | 2 +- docs/Get-CrmContentAccess.md | 94 +++++++++++ docs/Get-CrmDataProvider.md | 2 +- docs/Get-CrmEntityKey.md | 2 +- docs/Get-CrmEnvironmentVariable.md | 2 +- docs/Get-CrmEnvironmentVariableValue.md | 2 +- docs/Get-CrmPrincipalPrivileges.md | 60 +++++++ docs/Get-CrmRolePrivileges.md | 119 +++++++++++++ docs/Get-CrmSPDocumentLocation.md | 2 +- docs/Get-CrmTeam.md | 2 +- docs/Get-CrmTeamTemplate.md | 158 ++++++++++++++++++ docs/Invoke-CrmRequest.md | 3 +- docs/Invoke-CrmWebApiRequest.md | 2 +- docs/New-CrmApplication.md | 102 +++++++++++ docs/New-CrmEnvironmentVariable.md | 2 +- docs/New-CrmRole.md | 19 ++- docs/New-CrmTeam.md | 43 ++++- docs/New-CrmTeamTemplate.md | 119 +++++++++++++ docs/Register-CrmDataProvider.md | 2 +- docs/Register-CrmPluginStep.md | 4 +- docs/Register-CrmWebhook.md | 2 +- docs/Remove-CrmEnvironmentVariable.md | 2 +- docs/Remove-CrmEnvironmentVariableValue.md | 2 +- docs/Remove-CrmPrincipalRoles.md | 2 +- docs/Remove-CrmRecordTeamUser.md | 87 ++++++++++ docs/Remove-CrmRolePrincipals.md | 2 +- docs/Remove-CrmRolePrivilege.md | 127 ++++++++++++++ docs/Remove-CrmTeam.md | 71 ++++++++ docs/Remove-CrmTeamTemplate.md | 71 ++++++++ docs/Remove-CrmTeamUsers.md | 2 +- docs/Remove-CrmUserTeams.md | 2 +- docs/Set-CrmDataProvider.md | 2 +- docs/Set-CrmEnvironmentVariable.md | 2 +- docs/Set-CrmRole.md | 103 ++++++++++++ docs/Set-CrmRolePrivilege.md | 129 ++++++++++++++ docs/Set-CrmSession.md | 20 ++- docs/Set-CrmTeam.md | 118 +++++++++++++ docs/Set-CrmTeamTemplate.md | 134 +++++++++++++++ docs/Start-CrmBatch.md | 2 +- docs/Stop-CrmBatch.md | 2 +- docs/Submit-CrmBatch.md | 8 +- docs/Test-CrmUserPrivilege.md | 111 ++++++++++++ docs/Unregister-CrmDataProvider.md | 2 +- docs/Use-CrmImpersonatedUser.md | 56 +++++++ docs/_config.yml | 1 - docs/index.md | 53 +++++- 100 files changed, 3869 insertions(+), 161 deletions(-) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Content/GetContentAccessCommand.cs create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/AddRecordTeamUserCommand.cs create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/GetPrincipalPrivilegesCommand.cs rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/GetPrincipalRolesCommand.cs (97%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/GetRoleCommand.cs (98%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/GetRolePrincipalsCommand.cs (97%) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/GetRolePrivilegesCommand.cs rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/GetTeamCommand.cs (98%) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/GetTeamTemplateCommand.cs rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/GetTeamUsersCommand.cs (96%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/GetUserCommand.cs (98%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/GetUserTeamsCommand.cs (96%) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/NewApplicationCommand.cs rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/NewRoleCommand.cs (82%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/NewTeamCommand.cs (62%) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/NewTeamTemplateCommand.cs rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/NewUserCommand.cs (98%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/RemovePrincipalRolesCommand.cs (98%) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/RemoveRecordTeamUserCommand.cs rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/RemoveRolePrincipalsCommand.cs (99%) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/RemoveRolePrivilegeCommand.cs create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamCommand.cs create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamTemplateCommand.cs rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/RemoveTeamUsersCommand.cs (97%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/RemoveUserParentCommand.cs (97%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/RemoveUserTeamsCommand.cs (97%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/SetOwnerCommand.cs (98%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/SetPrincipalRolesCommand.cs (98%) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/SetRoleCommand.cs rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/SetRolePrincipalsCommand.cs (98%) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/SetRolePrivilegeCommand.cs create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/SetTeamCommand.cs create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/SetTeamTemplateCommand.cs rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/SetTeamUsersCommand.cs (97%) rename AMSoftware.Crm.PowerShell.Commands/{Administration => Security}/SetUserTeamsCommand.cs (98%) create mode 100644 AMSoftware.Crm.PowerShell.Commands/Security/TestUserPrivilegeCommand.cs create mode 100644 AMSoftware.Crm.PowerShell.Commands/UseImpersonatedUserCommand.cs create mode 100644 docs/Add-CrmRecordTeamUser.md create mode 100644 docs/Get-CrmContentAccess.md create mode 100644 docs/Get-CrmPrincipalPrivileges.md create mode 100644 docs/Get-CrmRolePrivileges.md create mode 100644 docs/Get-CrmTeamTemplate.md create mode 100644 docs/New-CrmApplication.md create mode 100644 docs/New-CrmTeamTemplate.md create mode 100644 docs/Remove-CrmRecordTeamUser.md create mode 100644 docs/Remove-CrmRolePrivilege.md create mode 100644 docs/Remove-CrmTeam.md create mode 100644 docs/Remove-CrmTeamTemplate.md create mode 100644 docs/Set-CrmRole.md create mode 100644 docs/Set-CrmRolePrivilege.md create mode 100644 docs/Set-CrmTeam.md create mode 100644 docs/Set-CrmTeamTemplate.md create mode 100644 docs/Test-CrmUserPrivilege.md create mode 100644 docs/Use-CrmImpersonatedUser.md delete mode 100644 docs/_config.yml diff --git a/AMSoftware.Crm.PowerShell.Commands/AMSoftware.Crm.PowerShell.Commands.csproj b/AMSoftware.Crm.PowerShell.Commands/AMSoftware.Crm.PowerShell.Commands.csproj index 1cfacae..6b4ed37 100644 --- a/AMSoftware.Crm.PowerShell.Commands/AMSoftware.Crm.PowerShell.Commands.csproj +++ b/AMSoftware.Crm.PowerShell.Commands/AMSoftware.Crm.PowerShell.Commands.csproj @@ -76,36 +76,52 @@ + + + + + + + + + + + + + + + + - + - - - - + + + + - - - - + + + + - - - - - - - - - - + + + + + + + + + + Code - + @@ -191,6 +207,7 @@ + @@ -206,12 +223,13 @@ - 9.1.0.79 + 9.1.0.92 1.1.0 + copy "$(SolutionDir)AMSoftware.Crm.PowerShell\*.*" "$(TargetDir)" /Y diff --git a/AMSoftware.Crm.PowerShell.Commands/Content/GetContentAccessCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Content/GetContentAccessCommand.cs new file mode 100644 index 0000000..4d70cd3 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Content/GetContentAccessCommand.cs @@ -0,0 +1,96 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common; +using AMSoftware.Crm.PowerShell.Common.ArgumentCompleters; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Crm.Sdk.Messages; +using Microsoft.Xrm.Sdk; +using System; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Content +{ + [Cmdlet(VerbsCommon.Get, "CrmContentAccess", HelpUri = HelpUrlConstants.GetContentAccessHelpUrl, DefaultParameterSetName = GetContentAccessByInputObjectParameterSet)] + [OutputType(typeof(PrincipalAccess))] + public sealed class GetContentAccessCommand : CrmOrganizationCmdlet + { + private const string GetContentAccessParameterSet = "GetContentAccess"; + private const string GetContentAccessByInputObjectParameterSet = "GetContentAccessByInputObject"; + + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 1, ParameterSetName = GetContentAccessByInputObjectParameterSet, ValueFromPipeline = true)] + [Alias("Record")] + [ValidateNotNullOrEmpty] + public Entity InputObject { get; set; } + + [Parameter(Mandatory = true, Position = 1, ParameterSetName = GetContentAccessParameterSet)] + [Alias("LogicalName")] + [ArgumentCompleter(typeof(EntityArgumentCompleter))] + [ValidateNotNullOrEmpty] + public string Entity { get; set; } + + [Parameter(Mandatory = true, Position = 2, ParameterSetName = GetContentAccessParameterSet)] + [ValidateNotNullOrEmpty] + public Guid Id { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + EntityReference target = null; + + switch (this.ParameterSetName) + { + case GetContentAccessParameterSet: + target = new EntityReference(Entity, Id); + break; + case GetContentAccessByInputObjectParameterSet: + target = InputObject.ToEntityReference(); + break; + default: + break; + } + + OrganizationResponse response = _repository.Execute("RetrieveSharedPrincipalsAndAccess", new System.Collections.Hashtable() { + { "Target", target } + }); + + if (response != null && response.Results != null && response.Results.ContainsKey("PrincipalAccesses") && response["PrincipalAccesses"] != null) + { + PrincipalAccess[] principalAccesses = (PrincipalAccess[])response["PrincipalAccesses"]; + + foreach (var principalAccess in principalAccesses) + { + var o = new PSObject(principalAccess); + o.Properties.Add(new PSNoteProperty("RecordLogicalName", target.LogicalName)); + o.Properties.Add(new PSNoteProperty("RecordId", target.Id)); + o.Properties.Add(new PSNoteProperty("PrincipalLogicalName", principalAccess.Principal.LogicalName)); + o.Properties.Add(new PSNoteProperty("PrincipalId", principalAccess.Principal.Id)); + o.Properties.Add(new PSNoteProperty("AccessRight", (CrmAccessRight)principalAccess.AccessMask)); + + o.Properties.Remove("ExtensionData"); + o.Properties.Remove("AccessMask"); + o.Properties.Remove("Principal"); + + WriteObject(o, false); + } + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/HelpUrlConstants.cs b/AMSoftware.Crm.PowerShell.Commands/HelpUrlConstants.cs index 11d355c..f2cf8da 100644 --- a/AMSoftware.Crm.PowerShell.Commands/HelpUrlConstants.cs +++ b/AMSoftware.Crm.PowerShell.Commands/HelpUrlConstants.cs @@ -19,138 +19,169 @@ namespace AMSoftware.Crm.PowerShell.Commands { internal static class HelpUrlConstants { - public const string UseLanguageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Use-CrmLanguage.md"; public const string ConnectOrganizationHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Connect-CrmOrganization.md"; + public const string UseLanguageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Use-CrmLanguage.md"; + public const string UseImpersonatedUserHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Use-CrmImpersonatedUser.md"; + public const string SetSessionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmSession.md"; + public const string AddAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmAttribute.md"; public const string AddBigIntAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmBigIntAttribute.md"; public const string AddBooleanAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmBooleanAttribute.md"; public const string AddDateTimeAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmDateTimeAttribute.md"; public const string AddDecimalAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmDecimalAttribute.md"; public const string AddDoubleAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmDoubleAttribute.md"; - public const string AddEntityKeyHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmEntityKey.md"; public const string AddImageAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmImageAttribute.md"; public const string AddIntegerAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmIntegerAttribute.md"; public const string AddMemoAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmMemoAttribute.md"; public const string AddMoneyAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmMoneyAttribute.md"; public const string AddOptionSetAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmOptionSetAttribute.md"; - public const string AddRelationshipHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmRelationship.md"; public const string AddStringAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmStringAttribute.md"; public const string GetAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmAttribute.md"; - public const string GetEntityHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEntity.md"; - public const string GetEntityKeyHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEntityKey.md"; - public const string GetOptionSetHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmOptionSet.md"; - public const string GetRelationshipHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmRelationship.md"; - public const string NewEntityHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmEntity.md"; - public const string NewOptionSetHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmOptionSet.md"; - public const string NewOptionSetValueHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmOptionSetValue.md"; public const string RemoveAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmAttribute.md"; - public const string RemoveEntityHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmEntity.md"; - public const string RemoveEntityKeyHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmEntityKey.md"; - public const string RemoveOptionSetHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmOptionSet.md"; - public const string RemoveOptionSetValueHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmOptionSetValue.md"; - public const string RemoveRelationshipHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmRelationship.md"; public const string SetAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmAttribute.md"; public const string SetBigIntAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmBigIntAttribute.md"; public const string SetBooleanAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmBooleanAttribute.md"; public const string SetDateTimeAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmDateTimeAttribute.md"; public const string SetDecimalAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmDecimalAttribute.md"; public const string SetDoubleAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmDoubleAttribute.md"; - public const string SetEntityHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmEntity.md"; public const string SetImageAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmImageAttribute.md"; public const string SetIntegerAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmIntegerAttribute.md"; public const string SetMemoAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmMemoAttribute.md"; public const string SetMoneyAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmMoneyAttribute.md"; - public const string SetOptionSetHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmOptionSet.md"; public const string SetOptionSetAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmOptionSetAttribute.md"; - public const string SetOptionSetValueHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmOptionSetValue.md"; + public const string SetStringAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmStringAttribute.md"; + + public const string AddEntityKeyHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmEntityKey.md"; + public const string GetEntityKeyHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEntityKey.md"; + public const string RemoveEntityKeyHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmEntityKey.md"; + + public const string AddRelationshipHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmRelationship.md"; + public const string GetRelationshipHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmRelationship.md"; + public const string RemoveRelationshipHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmRelationship.md"; public const string SetRelationshipHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmRelationship.md"; public const string SetRelationshipCascadeConfigHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmRelationshipCascadeConfig.md"; - public const string SetStringAttributeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmStringAttribute.md"; + + public const string GetEntityHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEntity.md"; + public const string NewEntityHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmEntity.md"; + public const string RemoveEntityHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmEntity.md"; + public const string SetEntityHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmEntity.md"; + + public const string GetOptionSetHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmOptionSet.md"; + public const string NewOptionSetHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmOptionSet.md"; + public const string NewOptionSetValueHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmOptionSetValue.md"; + public const string RemoveOptionSetHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmOptionSet.md"; + public const string RemoveOptionSetValueHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmOptionSetValue.md"; + public const string SetOptionSetHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmOptionSet.md"; + public const string SetOptionSetValueHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmOptionSetValue.md"; public const string AddContentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmContent.md"; public const string GetContentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmContent.md"; + public const string GetContentAccessHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmContentAccess.md"; public const string JoinContentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Join-CrmContent.md"; public const string RemoveContentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmContent.md"; public const string SetContentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmContent.md"; public const string SplitContentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Split-CrmContent.md"; + public const string StartBatchHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Start-CrmBatch.md"; public const string StopBatchHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Stop-CrmBatch.md"; public const string SubmitBatchHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Submit-CrmBatch.md"; - public const string AddLanguageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmLanguage.md"; - public const string ExportTranslationHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Export-CrmTranslation.md"; - public const string GetBusinessUnitHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmBusinessUnit.md"; - public const string GetLanguageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmLanguage.md"; + public const string AddRecordTeamUserHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-RecordTeamUser.md"; public const string GetPrincipalRolesHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmPrincipalRoles.md"; - public const string GetProcessHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmProcess.md"; public const string GetRoleHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmRole.md"; public const string GetRolePrincipalsHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmRolePrincipals.md"; public const string GetTeamHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmTeam.md"; + public const string GetTeamTemplateHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmTeamTemplate.md"; public const string GetTeamUsersHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmTeamUsers.md"; public const string GetUserHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmUser.md"; public const string GetUserTeamsHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmUserTeams.md"; - public const string ImportTranslationHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Import-CrmTranslation.md"; - public const string InvokeRequestHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Invoke-CrmRequest.md"; - public const string InvokeWebApiRequestHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Invoke-CrmWebApiRequest.md"; - public const string NewBusinessUnitHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmBusinessUnit.md"; + public const string NewApplicationHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmApplication.md"; public const string NewRoleHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmRole.md"; public const string NewTeamHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmTeam.md"; + public const string NewTeamTemplateHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmTeamTemplate.md"; public const string NewUserHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmUser.md"; - public const string RemoveLanguageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmLanguage.md"; + public const string RemoveRecordTeamUserHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-RecordTeamUser.md"; public const string RemoveUserParentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmUserParent.md"; - + public const string RemoveTeamHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmTeam.md"; + public const string RemoveTeamTemplateHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmTeamTemplate.md"; public const string RemovePrincipalRolesHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmPrincipalRoles.md"; public const string RemoveRolePrincipalsHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmRolePrincipals.md"; public const string RemoveTeamUsersHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmTeamUsers.md"; public const string RemoveUserTeamsHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmUserTeams.md"; - public const string SetOwnerHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmOwner.md"; public const string SetPrincipalRolesHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmPrincipalRoles.md"; + public const string SetRoleHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmRole.md"; public const string SetRolePrincipalsHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmRolePrincipals.md"; + public const string SetTeamHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmTeam.md"; + public const string SetTeamTemplateHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmTeamTemplate.md"; public const string SetTeamUsersHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmTeamUsers.md"; public const string SetUserTeamsHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmUserTeams.md"; + + public const string GetPrincipalPrivilegesHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmPrincipalPrivileges.md"; + public const string GetRolePrivilegesHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmRolePrivileges.md"; + public const string RemoveRolePrivilegeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmRolePrivileges.md"; + public const string SetRolePrivilegesHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmRolePrivileges.md"; + public const string TestUserPrivilegeHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Test-CrmUserPrivilege.md"; + + + public const string AddLanguageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmLanguage.md"; + public const string GetLanguageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmLanguage.md"; + public const string RemoveLanguageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmLanguage.md"; + public const string ExportTranslationHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Export-CrmTranslation.md"; + public const string ImportTranslationHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Import-CrmTranslation.md"; + public const string GetSPDocumentLocationHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmSPDocumentLocation.md"; + public const string InvokeRequestHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Invoke-CrmRequest.md"; + public const string InvokeWebApiRequestHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Invoke-CrmWebApiRequest.md"; + public const string GetBusinessUnitHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmBusinessUnit.md"; + public const string NewBusinessUnitHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmBusinessUnit.md"; + + public const string GetProcessHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmProcess.md"; public const string StartProcessHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Start-CrmProcess.md"; public const string StopProcessHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Stop-CrmProcess.md"; - public const string AddSolutionComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmSolutionComponent.md"; - public const string ExportSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Export-CrmSolution.md"; - public const string ExportWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Export-CrmWebresource.md"; - public const string GetPublisherHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmPublisher.md"; - public const string GetSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmSolution.md"; - public const string GetSolutionComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmSolutionComponent.md"; - public const string GetWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmWebresource.md"; - public const string ImportSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Import-CrmSolution.md"; - public const string ImportWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Import-CrmWebresource.md"; - public const string NewPublisherHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmPublisher.md"; - public const string NewSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmSolution.md"; - public const string NewWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmWebresource.md"; - public const string PublishComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Publish-CrmComponent.md"; - public const string RemoveSolutionComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmSolutionComponent.md"; - public const string RemoveWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmWebresource.md"; - public const string SetWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmWebresource.md"; - public const string TestSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Test-CrmSolution.md"; - public const string TestSolutionComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Test-CrmSolutionComponent.md"; - public const string UseSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Use-CrmSolution.md"; + + public const string DisablePluginStepHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Disable-CrmPluginStep.md"; + public const string EnablePluginStepHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Enable-CrmPluginStep.md"; public const string GetPluginAssemblyHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmPluginAssembly.md"; public const string GetPluginHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmPlugin.md"; public const string GetPluginStepHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmPluginStep.md"; public const string GetPluginStepImageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmPluginStepImage.md"; - public const string GetServiceEndpointHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmServiceEndpoint.md"; public const string RegisterPluginHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmPlugin.md"; - public const string SetPluginHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmPlugin.md"; - public const string RegisterServiceEndpointHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmServiceEndpoint.md"; - public const string RegisterWebhookHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmWebhook.md"; public const string RegisterPluginStepHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmPluginStep.md"; - public const string SetPluginStepHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmPluginStep.md"; public const string RegisterPluginStepImageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmPluginStepImage.md"; + public const string SetPluginHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmPlugin.md"; + public const string SetPluginStepHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmPluginStep.md"; public const string SetPluginStepImageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmPluginStepImage.md"; public const string UnregisterPluginAssemblyHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Unregister-CrmPluginAssembly.md"; - public const string UnregisterServiceEndpointHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Unregister-CrmServiceEndpoint.md"; public const string UnregisterPluginHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Unregister-CrmPlugin.md"; public const string UnregisterPluginStepHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Unregister-CrmPluginStep.md"; public const string UnregisterPluginStepImageHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Unregister-CrmPluginStepImage.md"; - public const string EnablePluginStepHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Enable-CrmPluginStep.md"; - public const string DisablePluginStepHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Disable-CrmPluginStep.md"; - public const string GetSPDocumentLocationHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmSPDocumentLocation.md"; + + public const string GetServiceEndpointHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmServiceEndpoint.md"; + public const string RegisterServiceEndpointHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmServiceEndpoint.md"; + public const string RegisterWebhookHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmWebhook.md"; + public const string UnregisterServiceEndpointHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Unregister-CrmServiceEndpoint.md"; + + public const string ExportWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Export-CrmWebresource.md"; + public const string GetWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmWebresource.md"; + public const string ImportWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Import-CrmWebresource.md"; + public const string NewWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmWebresource.md"; + public const string RemoveWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmWebresource.md"; + public const string SetWebresourceHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmWebresource.md"; + + public const string GetPublisherHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmPublisher.md"; + public const string NewPublisherHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmPublisher.md"; + + public const string AddSolutionComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmSolutionComponent.md"; + public const string ExportSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Export-CrmSolution.md"; + public const string GetSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmSolution.md"; + public const string GetSolutionComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmSolutionComponent.md"; + public const string ImportSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Import-CrmSolution.md"; + public const string NewSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmSolution.md"; + public const string PublishComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Publish-CrmComponent.md"; + public const string RemoveSolutionComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmSolutionComponent.md"; + public const string TestSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Test-CrmSolution.md"; + public const string TestSolutionComponentHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Test-CrmSolutionComponent.md"; + public const string UseSolutionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Use-CrmSolution.md"; public const string GetEnvironmentVariableHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEnvironmentVariable.md"; public const string GetEnvironmentVariableValueHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEnvironmentVariableValue.md"; @@ -163,7 +194,5 @@ internal static class HelpUrlConstants public const string RegisterDataProviderHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmDataProvider.md"; public const string UnregisterDataProviderHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Unregister-CrmDataProvider.md"; public const string SetDataProviderHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmDataProvider.md"; - - public const string SetSessionHelpUrl = "https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmSession.md"; } } diff --git a/AMSoftware.Crm.PowerShell.Commands/Plugins/RegisterPluginStepCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Plugins/RegisterPluginStepCommand.cs index 74a878f..d3dd06a 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Plugins/RegisterPluginStepCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Plugins/RegisterPluginStepCommand.cs @@ -72,8 +72,9 @@ public sealed class RegisterPluginStepCommand : CrmOrganizationCmdlet [ValidateNotNull] public CrmPluginStepMode Mode { get; set; } - [Parameter(Mandatory = true)] + [Parameter] [ValidateNotNull] + [PSDefaultValue(Value = CrmPluginStepDeployment.Both)] public CrmPluginStepDeployment Deployment { get; set; } [Parameter] @@ -105,6 +106,11 @@ protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); + if (!this.MyInvocation.BoundParameters.ContainsKey(nameof(Deployment))) + { + Deployment = CrmPluginStepDeployment.Both; + } + if (Mode == CrmPluginStepMode.Asynchronous && Stage != CrmPluginStepStage.PostOperation) { throw new Exception("Asynchronous Execution Mode requires registration in one of the Post Stages. Please change the Mode or the Stage."); diff --git a/AMSoftware.Crm.PowerShell.Commands/Properties/AssemblyInfo.cs b/AMSoftware.Crm.PowerShell.Commands/Properties/AssemblyInfo.cs index 1c3f743..c006049 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Properties/AssemblyInfo.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Properties/AssemblyInfo.cs @@ -48,6 +48,6 @@ You should have received a copy of the GNU Affero General Public License // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.1.1.0")] -[assembly: AssemblyVersion("2.1.1.0")] -[assembly: AssemblyFileVersion("2.1.1.1")] +// [assembly: AssemblyVersion("2.2.0.0")] +[assembly: AssemblyVersion("2.2.0.0")] +[assembly: AssemblyFileVersion("2.2.0.0")] diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/AddRecordTeamUserCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/AddRecordTeamUserCommand.cs new file mode 100644 index 0000000..99096a6 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/AddRecordTeamUserCommand.cs @@ -0,0 +1,62 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using System; +using System.Collections; +using System.Management.Automation; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Xrm.Sdk; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Add, "CrmRecordTeamUser", HelpUri = HelpUrlConstants.AddRecordTeamUserHelpUrl)] + [OutputType(typeof(OrganizationResponse))] + + public sealed class AddRecordTeamUserCommand : CrmOrganizationCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 1)] + [ValidateNotNullOrEmpty] + public Guid User { get; set; } + + [Parameter(Mandatory = true, Position = 2)] + [ValidateNotNullOrEmpty] + public Guid TeamTemplate { get; set; } + + [Parameter(Mandatory = true, ValueFromPipeline = true, ValueFromRemainingArguments = true)] + [ValidateNotNullOrEmpty] + public EntityReference[] Record { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + foreach (var item in Record) + { + Hashtable requestParameters = new Hashtable() + { + { "Record ", item }, + { "SystemUserId", User }, + { "TeamTemplateId", TeamTemplate } + }; + + WriteObject(_repository.ExecuteRequest("AddUserToRecordTeamRequest", requestParameters)); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/GetPrincipalPrivilegesCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetPrincipalPrivilegesCommand.cs new file mode 100644 index 0000000..2ebaf3c --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetPrincipalPrivilegesCommand.cs @@ -0,0 +1,88 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Crm.Sdk.Messages; +using Microsoft.Xrm.Sdk; +using Microsoft.Xrm.Sdk.Query; +using System; +using System.Linq; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Get, "CrmPrincipalPrivileges", HelpUri = HelpUrlConstants.GetPrincipalPrivilegesHelpUrl)] + [OutputType(typeof(Entity))] + public sealed class GetPrincipalPrivilegesCommand : CrmOrganizationCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)] + [Alias("User", "Team")] + [ValidateNotNullOrEmpty] + public Entity InputObject { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + var allPrivileges = _repository.Get( + new QueryExpression("privilege") + { + ColumnSet = new ColumnSet(true) + }); + + + RolePrivilege[] principalPrivileges = null; + + if (InputObject.LogicalName.Equals("systemuser", StringComparison.InvariantCultureIgnoreCase)) + { + // For Users + principalPrivileges = GetUserOrTeamsPrivileges("RetrieveUserPrivileges", "UserId", InputObject.Id); + } else if (InputObject.LogicalName.Equals("team", StringComparison.InvariantCultureIgnoreCase)) + { + // For Teams + principalPrivileges = GetUserOrTeamsPrivileges("RetrieveTeamPrivileges", "TeamId", InputObject.Id); + } else + { + return; + } + + var principalOutput = from principalPrivilege in principalPrivileges + join privilege in allPrivileges + on principalPrivilege.PrivilegeId equals privilege.Id + select privilege; + WriteObject(principalOutput, true); + } + + private RolePrivilege[] GetUserOrTeamsPrivileges(string requestName, string keyName, Guid principalId) + { + OrganizationResponse responseForPrincipal = + _repository.Execute(requestName, new System.Collections.Hashtable() + { + { keyName, principalId } + }); + + if (responseForPrincipal.Results != null && responseForPrincipal.Results.ContainsKey("RolePrivileges") && responseForPrincipal["RolePrivileges"] != null) + { + return (RolePrivilege[])responseForPrincipal["RolePrivileges"]; + } + + return new RolePrivilege[] { }; + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/GetPrincipalRolesCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetPrincipalRolesCommand.cs similarity index 97% rename from AMSoftware.Crm.PowerShell.Commands/Administration/GetPrincipalRolesCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/GetPrincipalRolesCommand.cs index ae45f2e..ff78d31 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/GetPrincipalRolesCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetPrincipalRolesCommand.cs @@ -24,7 +24,7 @@ You should have received a copy of the GNU Affero General Public License using Microsoft.Xrm.Sdk; using System.Collections.Generic; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Get, "CrmPrincipalRoles", HelpUri = HelpUrlConstants.GetPrincipalRolesHelpUrl)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/GetRoleCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetRoleCommand.cs similarity index 98% rename from AMSoftware.Crm.PowerShell.Commands/Administration/GetRoleCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/GetRoleCommand.cs index 8ea1947..f1503e3 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/GetRoleCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetRoleCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Get, "CrmRole", HelpUri = HelpUrlConstants.GetRoleHelpUrl, SupportsPaging = true, DefaultParameterSetName = GetAllRolesParameterSet)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/GetRolePrincipalsCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetRolePrincipalsCommand.cs similarity index 97% rename from AMSoftware.Crm.PowerShell.Commands/Administration/GetRolePrincipalsCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/GetRolePrincipalsCommand.cs index 1ad3251..df2195d 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/GetRolePrincipalsCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetRolePrincipalsCommand.cs @@ -24,7 +24,7 @@ You should have received a copy of the GNU Affero General Public License using Microsoft.Xrm.Sdk; using System.Collections.Generic; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Get, "CrmRolePrincipals", HelpUri = HelpUrlConstants.GetRolePrincipalsHelpUrl)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/GetRolePrivilegesCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetRolePrivilegesCommand.cs new file mode 100644 index 0000000..b9392fe --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetRolePrivilegesCommand.cs @@ -0,0 +1,123 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Crm.Sdk.Messages; +using Microsoft.Xrm.Sdk; +using Microsoft.Xrm.Sdk.Query; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Get, "CrmRolePrivileges", HelpUri = HelpUrlConstants.GetRolePrivilegesHelpUrl)] + [OutputType(typeof(Entity))] + public sealed class GetRolePrivilegesCommand : CrmOrganizationCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + private IEnumerable _allPrivileges; + private IEnumerable _entityPriviligeIds; + + [Parameter(Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [Alias("Id")] + [ValidateNotNullOrEmpty] + public Guid Role { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + [SupportsWildcards] + public string Include { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + [SupportsWildcards] + public string Exclude { get; set; } + + [Parameter] + public SwitchParameter EntityPrivilegesOnly { get; set; } + + [Parameter] + public SwitchParameter OtherPrivilegesOnly { get; set; } + + protected override void BeginProcessing() + { + base.BeginProcessing(); + + _allPrivileges = _repository.Get( + new QueryExpression("privilege") + { + ColumnSet = new ColumnSet(true) + }).ToList(); + + _entityPriviligeIds = _repository.Get( + new QueryExpression("privilegeobjecttypecodes") + { + ColumnSet = new ColumnSet("privilegeid"), + Criteria = { + Conditions = { + //new ConditionExpression("objecttypecode", ConditionOperator.ContainValues), + new ConditionExpression("objecttypecode", ConditionOperator.NotEqual, "none") + } + } + }).Select(etn => etn.GetAttributeValue("privilegeid").Id).ToList(); + } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + OrganizationResponse response = _repository.Execute("RetrieveRolePrivilegesRole", new System.Collections.Hashtable() { + { "RoleId", Role } + }); + + if (response.Results != null && response.Results.ContainsKey("RolePrivileges") && response["RolePrivileges"] != null) + { + RolePrivilege[] rolePrivileges = (RolePrivilege[])response["RolePrivileges"]; + + var output = from rolePrivilege in rolePrivileges + join privilege in _allPrivileges + on rolePrivilege.PrivilegeId equals privilege.Id + select privilege; + + if (!string.IsNullOrWhiteSpace(Include)) + { + WildcardPattern includePattern = new WildcardPattern(Include, WildcardOptions.IgnoreCase); + output = output.Where(a => includePattern.IsMatch(a.GetAttributeValue("name"))); + } + if (!string.IsNullOrWhiteSpace(Exclude)) + { + WildcardPattern excludePattern = new WildcardPattern(Exclude, WildcardOptions.IgnoreCase); + output = output.Where(a => !(excludePattern.IsMatch(a.GetAttributeValue("name")))); + } + + if (EntityPrivilegesOnly.ToBool()) + { + output = output.Where(o => _entityPriviligeIds.Contains(o.Id)); + } + if (OtherPrivilegesOnly.ToBool()) + { + output = output.Where(o => !_entityPriviligeIds.Contains(o.Id)); + } + + WriteObject(output, true); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/GetTeamCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetTeamCommand.cs similarity index 98% rename from AMSoftware.Crm.PowerShell.Commands/Administration/GetTeamCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/GetTeamCommand.cs index db46d9f..2c6066e 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/GetTeamCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetTeamCommand.cs @@ -23,7 +23,7 @@ You should have received a copy of the GNU Affero General Public License using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Get, "CrmTeam", HelpUri = HelpUrlConstants.GetTeamHelpUrl, SupportsPaging = true, DefaultParameterSetName = GetAllTeamsParameterSet)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/GetTeamTemplateCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetTeamTemplateCommand.cs new file mode 100644 index 0000000..0de3ca0 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetTeamTemplateCommand.cs @@ -0,0 +1,120 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using System; +using System.Linq; +using System.Management.Automation; +using AMSoftware.Crm.PowerShell.Common; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Xrm.Sdk; +using Microsoft.Xrm.Sdk.Query; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Get, "CrmTeamTemplate", HelpUri = HelpUrlConstants.GetTeamTemplateHelpUrl, SupportsPaging = true, DefaultParameterSetName = GetAllTeamTemplatesParameterSet)] + [OutputType(typeof(Entity))] + public sealed class GetTeamTemplateCommand : CrmOrganizationCmdlet + { + private const string GetAllTeamTemplatesParameterSet = "GetAllTeamTemplates"; + private const string GetTeamTemplateByIdParameterSet = "GetTeamTemplateById"; + + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 0, ParameterSetName = GetTeamTemplateByIdParameterSet, ValueFromPipeline = true)] + [ValidateNotNull] + public Guid[] Id { get; set; } + + [Parameter(Position = 0, ParameterSetName = GetAllTeamTemplatesParameterSet)] + [Alias("Include")] + [ValidateNotNullOrEmpty] + [SupportsWildcards] + public string Name { get; set; } + + [Parameter(ParameterSetName = GetAllTeamTemplatesParameterSet)] + [ValidateNotNullOrEmpty] + [SupportsWildcards] + public string Exclude { get; set; } + + [Parameter(ParameterSetName = GetAllTeamTemplatesParameterSet)] + [ValidateNotNull] + public int ObjectTypeCode { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + switch (this.ParameterSetName) + { + case GetAllTeamTemplatesParameterSet: + GetFilteredContent(); + break; + case GetTeamTemplateByIdParameterSet: + foreach (Guid id in Id) + { + WriteObject(_repository.Get("teamtemplate", id)); + } + break; + default: + break; + } + } + + private void GetFilteredContent() + { + QueryExpression advancedFilterQuery = BuildTeamTemplateByFilterQuery(); + + if (PagingParameters.IncludeTotalCount) + { + int count = _repository.GetRowCount(advancedFilterQuery, out double accuracy); + WriteObject(PagingParameters.NewTotalCount(Convert.ToUInt64(count), accuracy)); + } + + var result = _repository.Get(advancedFilterQuery, PagingParameters.First, PagingParameters.Skip); + if (!string.IsNullOrWhiteSpace(Name)) + { + WildcardPattern includePattern = new WildcardPattern(Name, WildcardOptions.IgnoreCase); + result = result.Where(a => includePattern.IsMatch(a.GetAttributeValue("teamtemplatename"))); + } + if (!string.IsNullOrWhiteSpace(Exclude)) + { + WildcardPattern excludePattern = new WildcardPattern(Exclude, WildcardOptions.IgnoreCase); + result = result.Where(a => !(excludePattern.IsMatch(a.GetAttributeValue("teamtemplatename")))); + } + + WriteObject(result, true); + } + + private QueryExpression BuildTeamTemplateByFilterQuery() + { + QueryExpression query = new QueryExpression("team") + { + ColumnSet = new ColumnSet(true), + Orders = + { + new OrderExpression("name", OrderType.Ascending) + } + }; + + if (this.MyInvocation.BoundParameters.ContainsKey(nameof(ObjectTypeCode))) + { + query.Criteria.AddCondition("objecttypecode", ConditionOperator.Equal, ObjectTypeCode); + } + + return query; + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/GetTeamUsersCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetTeamUsersCommand.cs similarity index 96% rename from AMSoftware.Crm.PowerShell.Commands/Administration/GetTeamUsersCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/GetTeamUsersCommand.cs index ddb4e20..6c34abc 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/GetTeamUsersCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetTeamUsersCommand.cs @@ -21,7 +21,7 @@ You should have received a copy of the GNU Affero General Public License using AMSoftware.Crm.PowerShell.Common.Repositories; using Microsoft.Xrm.Sdk; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Get, "CrmTeamUsers", HelpUri = HelpUrlConstants.GetTeamUsersHelpUrl)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/GetUserCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetUserCommand.cs similarity index 98% rename from AMSoftware.Crm.PowerShell.Commands/Administration/GetUserCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/GetUserCommand.cs index c6a069f..b23c74e 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/GetUserCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetUserCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Get, "CrmUser", HelpUri = HelpUrlConstants.GetUserHelpUrl, SupportsPaging = true, DefaultParameterSetName = GetAllUsersParameterSet)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/GetUserTeamsCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/GetUserTeamsCommand.cs similarity index 96% rename from AMSoftware.Crm.PowerShell.Commands/Administration/GetUserTeamsCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/GetUserTeamsCommand.cs index 2ef4a81..eff8bac 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/GetUserTeamsCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/GetUserTeamsCommand.cs @@ -21,7 +21,7 @@ You should have received a copy of the GNU Affero General Public License using AMSoftware.Crm.PowerShell.Common.Repositories; using Microsoft.Xrm.Sdk; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Get, "CrmUserTeams", HelpUri = HelpUrlConstants.GetUserTeamsHelpUrl)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/NewApplicationCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/NewApplicationCommand.cs new file mode 100644 index 0000000..4e3eca6 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/NewApplicationCommand.cs @@ -0,0 +1,75 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common.Helpers; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Xrm.Sdk; +using System; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.New, "CrmApplication", HelpUri = HelpUrlConstants.NewApplicationHelpUrl)] + [OutputType(typeof(Entity))] + public sealed class NewApplicationCommand : CrmOrganizationCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 0)] + [ValidateNotNullOrEmpty] + public Guid AppId { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + public Guid BusinessUnit { get; set; } + + [Parameter(ValueFromRemainingArguments = true)] + [ValidateNotNull] + public Guid[] Roles { get; set; } + + [Parameter] + public SwitchParameter PassThru { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + Guid[] roleIds = Roles; + Guid businessUnitId = this.MyInvocation.BoundParameters.ContainsKey(nameof(BusinessUnit)) ? BusinessUnit : SecurityManagementHelper.GetDefaultBusinessUnitId(_repository); + + Entity newUser = new Entity("systemuser") + { + Attributes = new AttributeCollection() + }; + newUser.Attributes.Add("applicationid", AppId); + newUser.Attributes.Add("businessunitid", new EntityReference("businessunit", businessUnitId)); + + Guid newUserId = _repository.Add(newUser); + + if (roleIds != null && roleIds.Length != 0) + { + SecurityManagementHelper.LinkPrincipalRoles(_repository, "systemuser", newUserId, "role", roleIds); + } + + if (PassThru) + { + WriteObject(_repository.Get("systemuser", newUserId)); + } + } + } + +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/NewRoleCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/NewRoleCommand.cs similarity index 82% rename from AMSoftware.Crm.PowerShell.Commands/Administration/NewRoleCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/NewRoleCommand.cs index 9fe8aa0..c759a7b 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/NewRoleCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/NewRoleCommand.cs @@ -17,11 +17,12 @@ You should have received a copy of the GNU Affero General Public License */ using System; using System.Management.Automation; +using AMSoftware.Crm.PowerShell.Common; using AMSoftware.Crm.PowerShell.Common.Helpers; using AMSoftware.Crm.PowerShell.Common.Repositories; using Microsoft.Xrm.Sdk; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.New, "CrmRole", HelpUri = HelpUrlConstants.NewRoleHelpUrl)] [OutputType(typeof(Entity))] @@ -37,6 +38,11 @@ public sealed class NewRoleCommand : CrmOrganizationCmdlet [ValidateNotNullOrEmpty] public Guid BusinessUnit { get; set; } + [Parameter] + [ValidateNotNullOrEmpty] + [PSDefaultValue(Value = CrmRoleInheritance.DirectUser)] + public CrmRoleInheritance Inheritance { get; set; } + [Parameter] public SwitchParameter PassThru { get; set; } @@ -52,6 +58,7 @@ protected override void ExecuteCmdlet() }; newRole.Attributes.Add("name", Name); newRole.Attributes.Add("businessunitid", new EntityReference("businessunit", businessUnitId)); + newRole.Attributes.Add("isinherited", this.MyInvocation.BoundParameters.ContainsKey(nameof(Inheritance)) ? new OptionSetValue((int)Inheritance) : new OptionSetValue((int)CrmRoleInheritance.DirectUser)); Guid newRoleId = _repository.Add(newRole); diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/NewTeamCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/NewTeamCommand.cs similarity index 62% rename from AMSoftware.Crm.PowerShell.Commands/Administration/NewTeamCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/NewTeamCommand.cs index 53c7a93..c9c8ceb 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/NewTeamCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/NewTeamCommand.cs @@ -22,12 +22,15 @@ You should have received a copy of the GNU Affero General Public License using System; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { - [Cmdlet(VerbsCommon.New, "CrmTeam", HelpUri = HelpUrlConstants.NewTeamHelpUrl)] + [Cmdlet(VerbsCommon.New, "CrmTeam", HelpUri = HelpUrlConstants.NewTeamHelpUrl, DefaultParameterSetName = NewTeamParameterSet)] [OutputType(typeof(Entity))] public sealed class NewTeamCommand : CrmOrganizationCmdlet { + private const string NewTeamParameterSet = "NewTeam"; + private const string NewAADTeamParameterSet = "NewAADTeam"; + private readonly ContentRepository _repository = new ContentRepository(); [Parameter(Mandatory = true, Position = 0)] @@ -50,7 +53,16 @@ public sealed class NewTeamCommand : CrmOrganizationCmdlet [ValidateNotNullOrEmpty] public string Description { get; set; } - [Parameter(ValueFromRemainingArguments = true)] + [Parameter(ParameterSetName = NewAADTeamParameterSet)] + [ValidateNotNullOrEmpty] + [PSDefaultValue(Value = CrmTeamMembershipType.MembersGuests)] + public CrmTeamMembershipType MembershipType { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = NewAADTeamParameterSet)] + [ValidateNotNullOrEmpty] + public Guid AADObjectId { get; set; } + + [Parameter(ValueFromRemainingArguments = true, ParameterSetName = NewTeamParameterSet)] [ValidateNotNull] public Guid[] Users { get; set; } @@ -63,6 +75,8 @@ protected override void ExecuteCmdlet() Guid businessUnitId = this.MyInvocation.BoundParameters.ContainsKey(nameof(BusinessUnit)) ? BusinessUnit : SecurityManagementHelper.GetDefaultBusinessUnitId(_repository); + if (!this.MyInvocation.BoundParameters.ContainsKey(nameof(MembershipType))) MembershipType = CrmTeamMembershipType.MembersGuests; + Entity newTeam = new Entity("team") { Attributes = new AttributeCollection() @@ -71,15 +85,31 @@ protected override void ExecuteCmdlet() newTeam.Attributes.Add("teamtype", new OptionSetValue((int)TeamType)); newTeam.Attributes.Add("administratorid", new EntityReference("systemuser", Administrator)); newTeam.Attributes.Add("businessunitid", new EntityReference("businessunit", businessUnitId)); - if (!string.IsNullOrWhiteSpace(Description)) { newTeam.Attributes.Add("description", Description); } + if (this.ParameterSetName == NewTeamParameterSet) + { + if (TeamType != CrmTeamType.Owner && TeamType != CrmTeamType.Access) + throw new ParameterBindingException("Invalid Team Type. Only Owner Team or Access Team allowed"); + + newTeam.Attributes.Add("membershiptype", new OptionSetValue((int)CrmTeamMembershipType.MembersGuests)); + } + + if (this.ParameterSetName == NewAADTeamParameterSet) + { + if (TeamType != CrmTeamType.AADOfficeGroup && TeamType != CrmTeamType.AADSecurityGroup) + throw new ParameterBindingException("Invalid Team Type. Only AAD Office Group or AAD Security Group allowed"); + + newTeam.Attributes.Add("azureactivedirectoryobjectid", AADObjectId); + newTeam.Attributes.Add("membershiptype", new OptionSetValue((int)MembershipType)); + } + Guid newTeamId = _repository.Add(newTeam); - if (Users != null && Users.Length != 0) + if (this.ParameterSetName == NewTeamParameterSet && Users != null && Users.Length != 0) { SecurityManagementHelper.AddUsersToTeam(_repository, newTeamId, Users); } diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/NewTeamTemplateCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/NewTeamTemplateCommand.cs new file mode 100644 index 0000000..10e2e6a --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/NewTeamTemplateCommand.cs @@ -0,0 +1,75 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using System; +using System.Management.Automation; +using AMSoftware.Crm.PowerShell.Common; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Xrm.Sdk; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.New, "CrmTeamTemplate", HelpUri = HelpUrlConstants.NewTeamTemplateHelpUrl)] + [OutputType(typeof(Entity))] + public sealed class NewTeamTemplateCommand : CrmOrganizationCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 1)] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + public string Description { get; set; } + + [Parameter(Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + public int ObjectTypeCode { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNull] + public CrmAccessRight DefaultAccessRight { get; set; } + + [Parameter] + public SwitchParameter PassThru { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + Entity newTeamTemplate = new Entity("teamtemplate") + { + Attributes = new AttributeCollection() + }; + newTeamTemplate.Attributes.Add("teamtemplatename", Name); + newTeamTemplate.Attributes.Add("defaultaccessrightsmask", (int)DefaultAccessRight); + newTeamTemplate.Attributes.Add("objecttypecode", ObjectTypeCode); + if (!string.IsNullOrWhiteSpace(Description)) + { + newTeamTemplate.Attributes.Add("description", Description); + } + + Guid newTeamTemplateId = _repository.Add(newTeamTemplate); + + if (PassThru) + { + WriteObject(_repository.Get("teamtemplate", newTeamTemplateId)); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/NewUserCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/NewUserCommand.cs similarity index 98% rename from AMSoftware.Crm.PowerShell.Commands/Administration/NewUserCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/NewUserCommand.cs index 9f92cc0..96641f5 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/NewUserCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/NewUserCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using System; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.New, "CrmUser", HelpUri = HelpUrlConstants.NewUserHelpUrl)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/RemovePrincipalRolesCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/RemovePrincipalRolesCommand.cs similarity index 98% rename from AMSoftware.Crm.PowerShell.Commands/Administration/RemovePrincipalRolesCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/RemovePrincipalRolesCommand.cs index 37db67e..64978a1 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/RemovePrincipalRolesCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/RemovePrincipalRolesCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Remove, "CrmPrincipalRoles", HelpUri = HelpUrlConstants.RemovePrincipalRolesHelpUrl, DefaultParameterSetName = RemovePrincipalRolesSelectedParameterSet)] public sealed class RemovePrincipalRolesCommand : CrmOrganizationCmdlet diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/RemoveRecordTeamUserCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveRecordTeamUserCommand.cs new file mode 100644 index 0000000..dc32756 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveRecordTeamUserCommand.cs @@ -0,0 +1,61 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using System; +using System.Collections; +using System.Management.Automation; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Xrm.Sdk; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Remove, "CrmRecordTeamUser", HelpUri = HelpUrlConstants.RemoveRecordTeamUserHelpUrl)] + [OutputType(typeof(OrganizationResponse))] + public sealed class RemoveRecordTeamUserCommand : CrmOrganizationCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 1)] + [ValidateNotNullOrEmpty] + public Guid User { get; set; } + + [Parameter(Mandatory = true, Position = 2)] + [ValidateNotNullOrEmpty] + public Guid TeamTemplate { get; set; } + + [Parameter(Mandatory = true, ValueFromPipeline = true, ValueFromRemainingArguments = true)] + [ValidateNotNullOrEmpty] + public EntityReference[] Record { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + foreach (var item in Record) + { + Hashtable requestParameters = new Hashtable() + { + { "Record ", item }, + { "SystemUserId", User }, + { "TeamTemplateId", TeamTemplate } + }; + + WriteObject(_repository.ExecuteRequest("RemoveUserFromRecordTeamRequest", requestParameters)); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/RemoveRolePrincipalsCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveRolePrincipalsCommand.cs similarity index 99% rename from AMSoftware.Crm.PowerShell.Commands/Administration/RemoveRolePrincipalsCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/RemoveRolePrincipalsCommand.cs index 7708602..261c83e 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/RemoveRolePrincipalsCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveRolePrincipalsCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Remove, "CrmRolePrincipals", HelpUri = HelpUrlConstants.RemoveRolePrincipalsHelpUrl, DefaultParameterSetName = RemoveRolePrincipalsSelectedParameterSet)] public sealed class RemoveRolePrincipalsCommand : CrmOrganizationCmdlet diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/RemoveRolePrivilegeCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveRolePrivilegeCommand.cs new file mode 100644 index 0000000..e35735c --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveRolePrivilegeCommand.cs @@ -0,0 +1,139 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common; +using AMSoftware.Crm.PowerShell.Common.ArgumentCompleters; +using AMSoftware.Crm.PowerShell.Common.Helpers; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Xrm.Sdk; +using Microsoft.Xrm.Sdk.Query; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Remove, "CrmRolePrivilege", HelpUri = HelpUrlConstants.RemoveRolePrivilegeHelpUrl, DefaultParameterSetName = RemoveRolePrivilegeForEntityParameterSet)] + public sealed class RemoveRolePrivilegeCommand : CrmOrganizationConfirmActionCmdlet + { + private const string RemoveRolePrivilegeForEntityParameterSet = "RemoveRolePrivilegeForEntity"; + private const string RemoveRolePrivilegesByNameParameterSet = "RemoveRolePrivilegesByName"; + + private readonly ContentRepository _repository = new ContentRepository(); + + private Dictionary _privilegeNames; + + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [Alias("Id")] + [ValidateNotNullOrEmpty] + public Guid[] Role { get; set; } + + [Parameter(Mandatory = true, ValueFromRemainingArguments = true, ParameterSetName = RemoveRolePrivilegesByNameParameterSet)] + [ValidateNotNullOrEmpty] + public string[] PrivilegeName { get; set; } + + [Parameter(Mandatory = true, Position = 1, ParameterSetName = RemoveRolePrivilegeForEntityParameterSet)] + [Alias("LogicalName")] + [ArgumentCompleter(typeof(EntityArgumentCompleter))] + [ValidateNotNullOrEmpty] + public string EntityLogicalName { get; set; } + + [Parameter(Mandatory = true, Position = 2, ParameterSetName = RemoveRolePrivilegeForEntityParameterSet)] + [ValidateNotNullOrEmpty] + public CrmAccessRight AccessRight { get; set; } + + protected override void BeginProcessing() + { + base.BeginProcessing(); + + _privilegeNames = _repository.Get( + new QueryExpression("privilege") + { + ColumnSet = new ColumnSet("privilegeid", "name") + }) + .Select(p => new { Id = p.Id, Name = p.GetAttributeValue("name") }) + .ToDictionary(k => k.Name, v => v.Id); + } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + switch (this.ParameterSetName) + { + case RemoveRolePrivilegeForEntityParameterSet: + RemovePrivilegesForEntity(); + break; + case RemoveRolePrivilegesByNameParameterSet: + RemovePrivilegesByName(); + break; + default: + break; + } + } + + private void RemovePrivilegesByName() + { + foreach (Guid roleId in Role) + { + foreach (string privilegeName in PrivilegeName) + { + if (_privilegeNames.ContainsKey(privilegeName)) + { + ExecuteAction($"{privilegeName}", "Remove", () => + { + _repository.Execute("RemovePrivilegeRole", new System.Collections.Hashtable() + { + { "RoleId", roleId }, + { "PrivilegeId", _privilegeNames[privilegeName] } + }); + }); + } + } + } + } + + private void RemovePrivilegesForEntity() + { + foreach (Guid roleId in Role) + { + IEnumerable entityPrivileges = + SecurityManagementHelper.GetEntityPrivileges(_repository, EntityLogicalName) + .Where(e => { + CrmAccessRight privilegeAccessRight = (CrmAccessRight)e.GetAttributeValue("accessright"); + return (AccessRight & privilegeAccessRight) == privilegeAccessRight; + }); + + if (entityPrivileges != null && entityPrivileges.Count() > 0) + { + foreach (var privilege in entityPrivileges) + { + ExecuteAction($"{privilege.GetAttributeValue("name")}", "Remove", () => + { + _repository.Execute("RemovePrivilegeRole", new System.Collections.Hashtable() + { + { "RoleId", roleId }, + { "PrivilegeId", privilege.Id } + }); + }); + } + } + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamCommand.cs new file mode 100644 index 0000000..0638de6 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamCommand.cs @@ -0,0 +1,47 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common.Repositories; +using System; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Remove, "CrmTeam", HelpUri = HelpUrlConstants.RemoveTeamHelpUrl)] + public sealed class RemoveTeamCommand : CrmOrganizationConfirmActionCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [Alias("Team")] + [ValidateNotNull] + public Guid[] Id { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + foreach (Guid id in Id) + { + ExecuteAction(id.ToString(), "Remove", () => + { + _repository.Delete("team", id); + }); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamTemplateCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamTemplateCommand.cs new file mode 100644 index 0000000..b99cf15 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamTemplateCommand.cs @@ -0,0 +1,47 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common.Repositories; +using System; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Remove, "CrmTeamTemplate", HelpUri = HelpUrlConstants.RemoveTeamTemplateHelpUrl)] + public sealed class RemoveTeamTemplateCommand : CrmOrganizationConfirmActionCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [Alias("TeamTemplate")] + [ValidateNotNull] + public Guid[] Id { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + foreach (Guid id in Id) + { + ExecuteAction(id.ToString(), "Remove", () => + { + _repository.Delete("teamtemplate", id); + }); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/RemoveTeamUsersCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamUsersCommand.cs similarity index 97% rename from AMSoftware.Crm.PowerShell.Commands/Administration/RemoveTeamUsersCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamUsersCommand.cs index 927728c..d0e3dbc 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/RemoveTeamUsersCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveTeamUsersCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Remove, "CrmTeamUsers", HelpUri = HelpUrlConstants.RemoveTeamUsersHelpUrl, DefaultParameterSetName = RemoveTeamUsersSelectedParameterSet)] public sealed class RemoveTeamUsersCommand : CrmOrganizationCmdlet diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/RemoveUserParentCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveUserParentCommand.cs similarity index 97% rename from AMSoftware.Crm.PowerShell.Commands/Administration/RemoveUserParentCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/RemoveUserParentCommand.cs index a97df1d..a71f5a8 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/RemoveUserParentCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveUserParentCommand.cs @@ -20,7 +20,7 @@ You should have received a copy of the GNU Affero General Public License using AMSoftware.Crm.PowerShell.Common.Repositories; using Microsoft.Xrm.Sdk; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Remove, "CrmUserParent", HelpUri = HelpUrlConstants.RemoveUserParentHelpUrl, SupportsShouldProcess = true)] public sealed class RemoveUserParentCommand : CrmOrganizationActionCmdlet diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/RemoveUserTeamsCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveUserTeamsCommand.cs similarity index 97% rename from AMSoftware.Crm.PowerShell.Commands/Administration/RemoveUserTeamsCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/RemoveUserTeamsCommand.cs index bff0968..6285344 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/RemoveUserTeamsCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/RemoveUserTeamsCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Remove, "CrmUserTeams", HelpUri = HelpUrlConstants.RemoveUserTeamsHelpUrl, DefaultParameterSetName = RemoveUserTeamsSelectedParameterSet)] public sealed class RemoveUserTeamsCommand : CrmOrganizationCmdlet diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/SetOwnerCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/SetOwnerCommand.cs similarity index 98% rename from AMSoftware.Crm.PowerShell.Commands/Administration/SetOwnerCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/SetOwnerCommand.cs index c62fe54..29850cb 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/SetOwnerCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/SetOwnerCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using AMSoftware.Crm.PowerShell.Common.Repositories; using Microsoft.Xrm.Sdk; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Set, "CrmOwner", HelpUri = HelpUrlConstants.SetOwnerHelpUrl, DefaultParameterSetName = AssignOwnerRecordParameterSet)] public sealed class SetOwnerCommand : CrmOrganizationCmdlet diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/SetPrincipalRolesCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/SetPrincipalRolesCommand.cs similarity index 98% rename from AMSoftware.Crm.PowerShell.Commands/Administration/SetPrincipalRolesCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/SetPrincipalRolesCommand.cs index 7177998..2dc2865 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/SetPrincipalRolesCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/SetPrincipalRolesCommand.cs @@ -23,7 +23,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Set, "CrmPrincipalRoles", HelpUri = HelpUrlConstants.SetPrincipalRolesHelpUrl)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/SetRoleCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/SetRoleCommand.cs new file mode 100644 index 0000000..fbc4d5d --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/SetRoleCommand.cs @@ -0,0 +1,73 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Xrm.Sdk; +using System; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Set, "CrmRole", HelpUri = HelpUrlConstants.SetRoleHelpUrl)] + [OutputType(typeof(Entity))] + public sealed class SetRoleCommand : CrmOrganizationCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + [Alias("Role")] + public Guid Id { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + [PSDefaultValue(Value = CrmRoleInheritance.DirectUser)] + public CrmRoleInheritance Inheritance { get; set; } + + [Parameter] + public SwitchParameter PassThru { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + Entity baseRole = _repository.Get("role", Id); + + if (this.MyInvocation.BoundParameters.ContainsKey(nameof(Name))) + { + baseRole.Attributes["name"] = Name; + } + + if (this.MyInvocation.BoundParameters.ContainsKey(nameof(Inheritance))) + { + baseRole.Attributes["isinherited"] = new OptionSetValue((int)Inheritance); + } + + _repository.Update(baseRole); + + if (PassThru) + { + WriteObject(_repository.Get("role", Id)); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/SetRolePrincipalsCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/SetRolePrincipalsCommand.cs similarity index 98% rename from AMSoftware.Crm.PowerShell.Commands/Administration/SetRolePrincipalsCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/SetRolePrincipalsCommand.cs index ab561a5..5bc4c18 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/SetRolePrincipalsCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/SetRolePrincipalsCommand.cs @@ -23,7 +23,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Set, "CrmRolePrincipals", HelpUri = HelpUrlConstants.SetRolePrincipalsHelpUrl)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/SetRolePrivilegeCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/SetRolePrivilegeCommand.cs new file mode 100644 index 0000000..6fc0fdd --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/SetRolePrivilegeCommand.cs @@ -0,0 +1,150 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common; +using AMSoftware.Crm.PowerShell.Common.ArgumentCompleters; +using AMSoftware.Crm.PowerShell.Common.Helpers; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Crm.Sdk.Messages; +using Microsoft.Xrm.Sdk; +using Microsoft.Xrm.Sdk.Query; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Set, "CrmRolePrivilege", HelpUri = HelpUrlConstants.SetRolePrivilegesHelpUrl, DefaultParameterSetName = SetRolePrivilegeForEntityParameterSet)] + [OutputType(typeof(Entity))] + public sealed class SetRolePrivilegeCommand : CrmOrganizationCmdlet + { + private const string SetRolePrivilegeForEntityParameterSet = "SetRolePrivilegeForEntity"; + private const string SetRolePrivilegesByNameParameterSet = "SetRolePrivilegesByName"; + + private readonly ContentRepository _repository = new ContentRepository(); + + private Dictionary _privilegeNames; + + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [Alias("Id")] + [ValidateNotNullOrEmpty] + public Guid[] Role { get; set; } + + [Parameter(Mandatory = true, ValueFromRemainingArguments = true, ParameterSetName = SetRolePrivilegesByNameParameterSet)] + [ValidateNotNullOrEmpty] + public string[] PrivilegeName { get; set; } + + [Parameter(Mandatory = true, Position = 1, ParameterSetName = SetRolePrivilegeForEntityParameterSet)] + [Alias("LogicalName")] + [ArgumentCompleter(typeof(EntityArgumentCompleter))] + [ValidateNotNullOrEmpty] + public string EntityLogicalName { get; set; } + + [Parameter(Mandatory = true, Position = 2, ParameterSetName = SetRolePrivilegeForEntityParameterSet)] + [ValidateNotNullOrEmpty] + public CrmAccessRight AccessRight { get; set; } + + [Parameter(Mandatory = true, Position = 3)] + [ValidateNotNullOrEmpty] + public CrmAccessScope Scope { get; set; } + + protected override void BeginProcessing() + { + base.BeginProcessing(); + + _privilegeNames = _repository.Get( + new QueryExpression("privilege") + { + ColumnSet = new ColumnSet("privilegeid", "name") + }) + .Select(p => new { Id = p.Id, Name = p.GetAttributeValue("name") }) + .ToDictionary(k => k.Name, v => v.Id); + } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + switch (this.ParameterSetName) + { + case SetRolePrivilegeForEntityParameterSet: + SetPrivilegeForEntity(); + break; + case SetRolePrivilegesByNameParameterSet: + SetPrivilegesByName(); + break; + default: + break; + } + } + + private void SetPrivilegesByName() + { + foreach (Guid roleId in Role) + { + // List of Priviliges to set on Role + var privileges = from selectedPrivilegeName in PrivilegeName + join privilege in _privilegeNames + on selectedPrivilegeName equals privilege.Key + select new RolePrivilege((int)Scope, privilege.Value); + + if (privileges.Count() == 0) + { + WriteWarningWithTimestamp("No matching Privileges found"); + } + else + { + _repository.Execute("AddPrivilegesRole", new System.Collections.Hashtable() + { + { "RoleId", roleId }, + { "Privileges", privileges.ToArray() } + }); + } + } + } + + private void SetPrivilegeForEntity() + { + foreach (Guid roleId in Role) + { + IEnumerable entityPrivileges = + SecurityManagementHelper.GetEntityPrivileges(_repository, EntityLogicalName) + .Where(e => + { + CrmAccessRight privilegeAccessRight = (CrmAccessRight)e.GetAttributeValue("accessright"); + return (AccessRight & privilegeAccessRight) == privilegeAccessRight; + }); + + if (entityPrivileges != null && entityPrivileges.Count() > 0) + { + var privileges = entityPrivileges.Select(p => new RolePrivilege((int)Scope, p.Id)); + + _repository.Execute("AddPrivilegesRole", new System.Collections.Hashtable() + { + { "RoleId", roleId }, + { "Privileges", privileges.ToArray() } + }); + } + else + { + WriteWarningWithTimestamp($"No Privileges found for '{EntityLogicalName}' with '{AccessRight}'"); + } + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/SetTeamCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/SetTeamCommand.cs new file mode 100644 index 0000000..3650fa1 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/SetTeamCommand.cs @@ -0,0 +1,72 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Xrm.Sdk; +using System; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Set, "CrmTeam", HelpUri = HelpUrlConstants.SetTeamHelpUrl)] + [OutputType(typeof(Entity))] + public sealed class SetTeamCommand : CrmOrganizationCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public Guid Id { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + public Guid Administrator { get; set; } + + [Parameter] + public string Description { get; set; } + + [Parameter] + public SwitchParameter PassThru { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + Entity updateTeam = _repository.Get("team", Id); + + updateTeam.Attributes["name"] = this.MyInvocation.BoundParameters.ContainsKey(nameof(Name)) ? Name : updateTeam.Attributes["name"]; + updateTeam.Attributes["administratorid"] = this.MyInvocation.BoundParameters.ContainsKey(nameof(Administrator)) ? Administrator : updateTeam.Attributes["administratorid"]; + + if (this.MyInvocation.BoundParameters.ContainsKey(nameof(Description))) + { + if (updateTeam.Attributes.ContainsKey("description")) updateTeam.Attributes["description"] = Description; + else updateTeam.Attributes.Add("description", Description); + } + + _repository.Update(updateTeam); + + if (PassThru) + { + WriteObject(_repository.Get("team", Id)); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/SetTeamTemplateCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/SetTeamTemplateCommand.cs new file mode 100644 index 0000000..2e176d4 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/SetTeamTemplateCommand.cs @@ -0,0 +1,79 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using System; +using System.Management.Automation; +using AMSoftware.Crm.PowerShell.Common; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Xrm.Sdk; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsCommon.Set, "CrmTeamTemplate", HelpUri = HelpUrlConstants.SetTeamTemplateHelpUrl)] + [OutputType(typeof(Entity))] + public sealed class SetCrmTeamTemplateCommand : CrmOrganizationCmdlet + { + private readonly ContentRepository _repository = new ContentRepository(); + + [Parameter(Mandatory = true, Position = 1)] + [ValidateNotNullOrEmpty] + public Guid Id { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter] + [ValidateNotNullOrEmpty] + public string Description { get; set; } + + [Parameter] + [ValidateNotNull] + public int ObjectTypeCode { get; set; } + + [Parameter] + [ValidateNotNull] + public CrmAccessRight DefaultAccessRight { get; set; } + + [Parameter] + public SwitchParameter PassThru { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + Entity updateTeamTemplate = _repository.Get("teamtemplate", Id); + + updateTeamTemplate.Attributes["teamtemplatename"] = this.MyInvocation.BoundParameters.ContainsKey(nameof(Name)) ? Name : updateTeamTemplate.Attributes["teamtemplatename"]; + updateTeamTemplate.Attributes["objecttypecode"] = this.MyInvocation.BoundParameters.ContainsKey(nameof(ObjectTypeCode)) ? ObjectTypeCode : updateTeamTemplate.Attributes["objecttypecode"]; + updateTeamTemplate.Attributes["defaultaccessrightsmask"] = this.MyInvocation.BoundParameters.ContainsKey(nameof(DefaultAccessRight)) ? DefaultAccessRight : updateTeamTemplate.Attributes["defaultaccessrightsmask"]; + + if (this.MyInvocation.BoundParameters.ContainsKey(nameof(Description))) + { + if (updateTeamTemplate.Attributes.ContainsKey("description")) updateTeamTemplate.Attributes["description"] = Description; + else updateTeamTemplate.Attributes.Add("description", Description); + } + + _repository.Update(updateTeamTemplate); + + if (PassThru) + { + WriteObject(_repository.Get("teamtemplate", Id)); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/SetTeamUsersCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/SetTeamUsersCommand.cs similarity index 97% rename from AMSoftware.Crm.PowerShell.Commands/Administration/SetTeamUsersCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/SetTeamUsersCommand.cs index 965131b..dd0fe93 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/SetTeamUsersCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/SetTeamUsersCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Set, "CrmTeamUsers", HelpUri = HelpUrlConstants.SetTeamUsersHelpUrl)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Administration/SetUserTeamsCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/SetUserTeamsCommand.cs similarity index 98% rename from AMSoftware.Crm.PowerShell.Commands/Administration/SetUserTeamsCommand.cs rename to AMSoftware.Crm.PowerShell.Commands/Security/SetUserTeamsCommand.cs index bba65fc..b928c1d 100644 --- a/AMSoftware.Crm.PowerShell.Commands/Administration/SetUserTeamsCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/Security/SetUserTeamsCommand.cs @@ -22,7 +22,7 @@ You should have received a copy of the GNU Affero General Public License using System.Linq; using System.Management.Automation; -namespace AMSoftware.Crm.PowerShell.Commands.Administration +namespace AMSoftware.Crm.PowerShell.Commands.Security { [Cmdlet(VerbsCommon.Set, "CrmUserTeams", HelpUri = HelpUrlConstants.SetUserTeamsHelpUrl)] [OutputType(typeof(Entity))] diff --git a/AMSoftware.Crm.PowerShell.Commands/Security/TestUserPrivilegeCommand.cs b/AMSoftware.Crm.PowerShell.Commands/Security/TestUserPrivilegeCommand.cs new file mode 100644 index 0000000..8da7473 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/Security/TestUserPrivilegeCommand.cs @@ -0,0 +1,144 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using AMSoftware.Crm.PowerShell.Common; +using AMSoftware.Crm.PowerShell.Common.ArgumentCompleters; +using AMSoftware.Crm.PowerShell.Common.Helpers; +using AMSoftware.Crm.PowerShell.Common.Repositories; +using Microsoft.Crm.Sdk.Messages; +using Microsoft.Xrm.Sdk; +using Microsoft.Xrm.Sdk.Query; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace AMSoftware.Crm.PowerShell.Commands.Security +{ + [Cmdlet(VerbsDiagnostic.Test, "CrmUserPrivilege", HelpUri = HelpUrlConstants.TestUserPrivilegeHelpUrl)] + [OutputType(typeof(bool))] + public sealed class TestUserPrivilegeCommand : CrmOrganizationCmdlet + { + private const string TestUserPrivilegeForEntityParameterSet = "TestUserPrivilegeForEntity"; + private const string TestUserPrivilegesByNameParameterSet = "TestUserPrivilegesByName"; + + private readonly ContentRepository _repository = new ContentRepository(); + + private IEnumerable _allPrivileges; + + [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] + [Alias("Id")] + [ValidateNotNullOrEmpty] + public Guid User { get; set; } + + [Parameter(Mandatory = true, Position = 1, ParameterSetName = TestUserPrivilegesByNameParameterSet)] + [ValidateNotNullOrEmpty] + public string PrivilegeName { get; set; } + + [Parameter(Mandatory = true, Position = 1, ParameterSetName = TestUserPrivilegeForEntityParameterSet)] + [Alias("LogicalName")] + [ArgumentCompleter(typeof(EntityArgumentCompleter))] + [ValidateNotNullOrEmpty] + public string EntityLogicalName { get; set; } + + [Parameter(Mandatory = true, Position = 2, ParameterSetName = TestUserPrivilegeForEntityParameterSet)] + [ValidateNotNullOrEmpty] + public CrmAccessRight AccessRight { get; set; } + + protected override void BeginProcessing() + { + base.BeginProcessing(); + + _allPrivileges = _repository.Get( + new QueryExpression("privilege") + { + ColumnSet = new ColumnSet(true) + }); + } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + switch (this.ParameterSetName) + { + case TestUserPrivilegeForEntityParameterSet: + TestPrivilegeForEntity(); + break; + case TestUserPrivilegesByNameParameterSet: + TestPrivilegesByName(); + break; + default: + break; + } + } + + private void TestPrivilegeForEntity() + { + IEnumerable entityPrivileges = + SecurityManagementHelper.GetEntityPrivileges(_repository, EntityLogicalName) + .Where(e => + { + CrmAccessRight privilegeAccessRight = (CrmAccessRight)e.GetAttributeValue("accessright"); + return (AccessRight & privilegeAccessRight) == privilegeAccessRight; + }); + + if (entityPrivileges != null && entityPrivileges.Count() > 0) + { + foreach (var entityPrivilege in entityPrivileges) + { + OrganizationResponse response = _repository.Execute("RetrieveUserPrivilegeByPrivilegeName", new System.Collections.Hashtable() { + { "UserId", User }, + { "PrivilegeName", entityPrivilege.GetAttributeValue("name") } + }); + + if (response.Results != null && response.Results.ContainsKey("RolePrivileges") && response["RolePrivileges"] != null) + { + RolePrivilege[] rolePrivileges = (RolePrivilege[])response["RolePrivileges"]; + WriteObject(rolePrivileges.Length > 0, false); + } + else + { + WriteObject(false, false); + } + } + } + else + { + WriteObject(false, false); + } + } + + private void TestPrivilegesByName() + { + OrganizationResponse response = _repository.Execute("RetrieveUserPrivilegeByPrivilegeName", new System.Collections.Hashtable() { + { "UserId", User }, + { "PrivilegeName", PrivilegeName } + }); + + if (response.Results != null && response.Results.ContainsKey("RolePrivileges") && response["RolePrivileges"] != null) + { + RolePrivilege[] rolePrivileges = (RolePrivilege[])response["RolePrivileges"]; + WriteObject(rolePrivileges.Length > 0, false); + } + else + { + WriteObject(false, false); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Commands/SetSessionCommand.cs b/AMSoftware.Crm.PowerShell.Commands/SetSessionCommand.cs index 8b4c769..413d713 100644 --- a/AMSoftware.Crm.PowerShell.Commands/SetSessionCommand.cs +++ b/AMSoftware.Crm.PowerShell.Commands/SetSessionCommand.cs @@ -15,7 +15,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -using AMSoftware.Crm.PowerShell.Commands.Helpers; using AMSoftware.Crm.PowerShell.Common; using AMSoftware.Crm.PowerShell.Common.Helpers; using AMSoftware.Crm.PowerShell.Common.Repositories; @@ -28,17 +27,17 @@ namespace AMSoftware.Crm.PowerShell.Commands public sealed class SetSessionCommand : CrmOrganizationCmdlet { [Parameter] - [ValidateNotNullOrEmpty] public int Language { get; set; } [Parameter] - [ValidateNotNullOrEmpty] public Guid Solution { get; set; } [Parameter] - [ValidateNotNullOrEmpty] public bool UseMetadataCache { get; set; } + [Parameter] + public Guid ImpersonatedUserId { get; set; } + protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); @@ -71,6 +70,21 @@ protected override void ExecuteCmdlet() } } } + + if (this.MyInvocation.BoundParameters.ContainsKey(nameof(ImpersonatedUserId))) + { + if (ImpersonatedUserId == Guid.Empty) + { + CrmContext.Session.Client.CallerId = Guid.Empty; + CrmContext.Session.Client.CallerAADObjectId = null; + } + else + { + ContentRepository repository = new ContentRepository(); + CrmContext.Session.Client.CallerId = ImpersonatedUserId; + CrmContext.Session.Client.CallerAADObjectId = repository.Get("systemuser", ImpersonatedUserId).GetAttributeValue("azureactivedirectoryobjectid"); + } + } } } } diff --git a/AMSoftware.Crm.PowerShell.Commands/UseImpersonatedUserCommand.cs b/AMSoftware.Crm.PowerShell.Commands/UseImpersonatedUserCommand.cs new file mode 100644 index 0000000..a512d62 --- /dev/null +++ b/AMSoftware.Crm.PowerShell.Commands/UseImpersonatedUserCommand.cs @@ -0,0 +1,50 @@ +/* +CRM PowerShell Library +Copyright (C) 2017 Arjan Meskers / AMSoftware + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +using System; +using System.Management.Automation; +using AMSoftware.Crm.PowerShell.Common; +using AMSoftware.Crm.PowerShell.Common.Repositories; + +namespace AMSoftware.Crm.PowerShell.Commands +{ + [Cmdlet(VerbsOther.Use, "CrmImpersonatedUser", HelpUri = HelpUrlConstants.UseImpersonatedUserHelpUrl)] + public sealed class UseImpersonatedUserCommand : CrmOrganizationCmdlet + { + [Parameter(Position = 1, ValueFromPipeline = true)] + [ValidateNotNull] + [Alias("UserId")] + public Guid ImpersonatedUserId { get; set; } + + protected override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + if (ImpersonatedUserId == Guid.Empty) + { + CrmContext.Session.Client.CallerId = Guid.Empty; + CrmContext.Session.Client.CallerAADObjectId = null; + } + else + { + ContentRepository repository = new ContentRepository(); + CrmContext.Session.Client.CallerId = ImpersonatedUserId; + CrmContext.Session.Client.CallerAADObjectId = repository.Get("systemuser", ImpersonatedUserId).GetAttributeValue("azureactivedirectoryobjectid"); + } + } + } +} diff --git a/AMSoftware.Crm.PowerShell.Common/AMSoftware.Crm.PowerShell.Common.csproj b/AMSoftware.Crm.PowerShell.Common/AMSoftware.Crm.PowerShell.Common.csproj index 0220745..35f8c37 100644 --- a/AMSoftware.Crm.PowerShell.Common/AMSoftware.Crm.PowerShell.Common.csproj +++ b/AMSoftware.Crm.PowerShell.Common/AMSoftware.Crm.PowerShell.Common.csproj @@ -126,7 +126,7 @@ - 9.1.0.79 + 9.1.0.92 1.1.0 diff --git a/AMSoftware.Crm.PowerShell.Common/Converters/EntityConverter.cs b/AMSoftware.Crm.PowerShell.Common/Converters/EntityConverter.cs index 13bebfb..0e638b8 100644 --- a/AMSoftware.Crm.PowerShell.Common/Converters/EntityConverter.cs +++ b/AMSoftware.Crm.PowerShell.Common/Converters/EntityConverter.cs @@ -31,6 +31,7 @@ public override bool CanConvertFrom(object sourceValue, Type destinationType) public override bool CanConvertTo(object sourceValue, Type destinationType) { if (destinationType == typeof(Guid)) return true; + if (destinationType == typeof(EntityReference)) return true; return false; } @@ -41,9 +42,10 @@ public override object ConvertFrom(object sourceValue, Type destinationType, IFo public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) { - if (sourceValue != null && sourceValue is Entity entityValue && destinationType == typeof(Guid)) + if (sourceValue != null && sourceValue is Entity entityValue) { - return entityValue.Id; + if (destinationType == typeof(Guid)) return entityValue.Id; + if (destinationType == typeof(EntityReference)) return entityValue.ToEntityReference(); } if (sourceValue != null && sourceValue is EntityReference entityReferenceValue && destinationType == typeof(Guid)) diff --git a/AMSoftware.Crm.PowerShell.Common/Helpers/SecurityManagementHelper.cs b/AMSoftware.Crm.PowerShell.Common/Helpers/SecurityManagementHelper.cs index 674c134..ce7475d 100644 --- a/AMSoftware.Crm.PowerShell.Common/Helpers/SecurityManagementHelper.cs +++ b/AMSoftware.Crm.PowerShell.Common/Helpers/SecurityManagementHelper.cs @@ -242,5 +242,28 @@ public static Guid GetDefaultBusinessUnitId(ContentRepository repository) return entities.First().Id; } } + + public static IEnumerable GetEntityPrivileges(ContentRepository repository, string logicalName) + { + QueryExpression query = new QueryExpression("privilege") + { + ColumnSet = new ColumnSet("privilegeid", "name", "accessright"), + LinkEntities = + { + new LinkEntity("privilege", "privilegeobjecttypecodes", "privilegeid", "privilegeid", JoinOperator.Inner) + { + LinkCriteria = + { + Conditions = + { + new ConditionExpression("objecttypecode", ConditionOperator.Equal, logicalName) + } + } + } + } + }; + + return repository.Get(query).AsEnumerable(); + } } } diff --git a/AMSoftware.Crm.PowerShell.Common/Properties/AssemblyInfo.cs b/AMSoftware.Crm.PowerShell.Common/Properties/AssemblyInfo.cs index a90564d..31b17cf 100644 --- a/AMSoftware.Crm.PowerShell.Common/Properties/AssemblyInfo.cs +++ b/AMSoftware.Crm.PowerShell.Common/Properties/AssemblyInfo.cs @@ -48,7 +48,7 @@ You should have received a copy of the GNU Affero General Public License // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("2.1.1.0")] -[assembly: AssemblyVersion("2.1.1.0")] -[assembly: AssemblyFileVersion("2.1.1.1")] +// [assembly: AssemblyVersion("2.2.0.0")] +[assembly: AssemblyVersion("2.2.0.0")] +[assembly: AssemblyFileVersion("2.2.0.0")] [assembly: InternalsVisibleTo("AMSoftware.Crm.PowerShell.Commands, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c30788ed73a5fb135b7df52d4705f403e21d843dcb5fd5f608903a156250bb607a2b8ff29d29514ea79e5246ca0bde2b529d0b31824f3e9a012ee6af9e8af8c6f96d1bf99e8590fd04d5979ecf532661fe45c698fb7e4f1ef465a1059645d0c2ac65a04c59bfb726907aee6af26ae4a9daf98b0775d228d9fdb9cce37526c6ad")] diff --git a/AMSoftware.Crm.PowerShell.Common/_enum.cs b/AMSoftware.Crm.PowerShell.Common/_enum.cs index 1ff11fc..4f050e1 100644 --- a/AMSoftware.Crm.PowerShell.Common/_enum.cs +++ b/AMSoftware.Crm.PowerShell.Common/_enum.cs @@ -168,7 +168,17 @@ public enum CrmPrincipalType public enum CrmTeamType { Owner = 0, - Access + Access, + AADSecurityGroup, + AADOfficeGroup + } + + public enum CrmTeamMembershipType + { + MembersGuests = 0, + Members = 1, + Owners = 2, + Guests = 3 } public enum CrmPluginStepMode @@ -274,4 +284,33 @@ public enum CrmEnvironmentVariableType JSON = 100000003, DataSource = 100000004 } + + [Flags] + public enum CrmAccessRight + { + None = 0, + Read = 1, + Write = 2, + Append = 4, + AppendTo = 16, + Create = 32, + Assign = 524288, + Delete = 65536, + Share = 262144 + } + + public enum CrmAccessScope + { + None = -1, + User = 0, + BusinessUnit = 1, + ChildBusinessUnit = 2, + Organization = 3 + } + + public enum CrmRoleInheritance + { + TeamOnly = 0, + DirectUser = 1 + } } diff --git a/AMSoftware.Crm.PowerShell/AMSoftware.Crm.Powershell.Format.ps1xml b/AMSoftware.Crm.PowerShell/AMSoftware.Crm.Powershell.Format.ps1xml index 35409f9..7893a23 100644 --- a/AMSoftware.Crm.PowerShell/AMSoftware.Crm.Powershell.Format.ps1xml +++ b/AMSoftware.Crm.PowerShell/AMSoftware.Crm.Powershell.Format.ps1xml @@ -626,6 +626,48 @@ along with this program. If not, see .--> + + Microsoft.Xrm.Sdk.Entity+TeamTemplate + + Microsoft.Xrm.Sdk.Entity+teamtemplate + + + + + 36 + + + 21 + + + + 10 + + + + 21 + + + + + + + Id + + + Name + + + objecttypecode + + + objecttypecode_FormattedValue + + + + + + Microsoft.Xrm.Sdk.Entity+Solution @@ -753,7 +795,7 @@ along with this program. If not, see .--> dependencytype_FormattedValue - + @@ -1090,6 +1132,76 @@ along with this program. If not, see .--> + + Microsoft.Xrm.Sdk.Entity+Privilege + + Microsoft.Xrm.Sdk.Entity+privilege + + + + + 36 + + + 25 + + + + 36 + + + + + + + Id + + + Name + + + ([AMSoftware.Crm.PowerShell.Common.CrmAccessRight]$_.accessright).ToString() + + + + + + + + Microsoft.Crm.Sdk.Messages.PrincipalAccess + + Microsoft.Crm.Sdk.Messages.PrincipalAccess + + + + + 25 + + + 36 + + + + 36 + + + + + + + PrincipalLogicalName + + + PrincipalId + + + $_.AccessRight.ToString() + + + + + + diff --git a/AMSoftware.Crm.PowerShell/AMSoftware.Crm.psd1 b/AMSoftware.Crm.PowerShell/AMSoftware.Crm.psd1 index a1ef60265fdd5b16aae852143b73f3a1275d92e9..efbba806cecd4c44f891fbe1a249cb492ac4382c 100644 GIT binary patch delta 21 bcmZ2sw!&;f02`yx=0LV~K_GQg+@Bc$P+11R delta 21 bcmZ2sw!&;f02`y>=0LV~K_GQg+@Bc$P(}v6 diff --git a/AMSoftware.Crm.Powershell.sln b/AMSoftware.Crm.Powershell.sln index 9a8379f..d71da6b 100644 --- a/AMSoftware.Crm.Powershell.sln +++ b/AMSoftware.Crm.Powershell.sln @@ -21,6 +21,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AMSoftware.Crm.PowerShell", AMSoftware.Crm.PowerShell\AMSoftware.Crm.psd1 = AMSoftware.Crm.PowerShell\AMSoftware.Crm.psd1 EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{A269025B-369C-4DC1-893E-7931E661793B}" + ProjectSection(SolutionItems) = preProject + docker\Dockerfile = docker\Dockerfile + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/docker/Dockerfile b/docker/Dockerfile index d45c953..68b070a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -28,6 +28,7 @@ RUN "pac install latest" SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; $verbosePreference='Continue';"] USER ContainerAdministrator +ENV MODULEVERSION=$VERSION RUN ` # Install-Module uses the NuGet Package provider. Must be the first action ` Install-PackageProvider -Name 'NuGet' -MinimumVersion '2.8.5.201' -Force; ` @@ -44,7 +45,7 @@ RUN ` Install-Module -Name 'Microsoft.PowerApps.Checker.PowerShell' -Repository 'PSGallery' -Force -SkipPublisherCheck; ` # Install AMSoftware.Crm Powershell module ` # https://www.powershellgallery.com/packages/AMSoftware.Crm ` - Install-Module -Name 'AMSoftware.Crm' -Repository 'PSGallery' -RequiredVersion '$VERSION' -Force -SkipPublisherCheck; ` + Install-Module -Name 'AMSoftware.Crm' -Repository 'PSGallery' -RequiredVersion "$env:MODULEVERSION" -Force -SkipPublisherCheck; ` # Restore Powershell Gallery repository to default (untrusted) ` Set-PSRepository -Name 'PSGallery' -InstallationPolicy Untrusted; diff --git a/docs/AMSoftware.Crm.md b/docs/AMSoftware.Crm.md index 098d4b0..b75e73d 100644 --- a/docs/AMSoftware.Crm.md +++ b/docs/AMSoftware.Crm.md @@ -2,7 +2,7 @@ Module Name: AMSoftware.Crm Module Guid: 1e7f1ebc-e035-4d73-86af-3c07a6a85260 Download Help Link: -Help Version: 2.1.0.0 +Help Version: 2.2.0.0 Locale: en-us --- @@ -53,6 +53,9 @@ Add an attribute of type Money. ### [Add-CrmOptionSetAttribute](Add-CrmOptionSetAttribute.md) Add an attribute of type OptionSet. +### [Add-CrmRecordTeamUser](Add-CrmRecordTeamUser.md) +Add a user to the Team for a record + ### [Add-CrmRelationship](Add-CrmRelationship.md) Add a relationship. @@ -89,6 +92,9 @@ Get a Business Unit. ### [Get-CrmContent](Get-CrmContent.md) Retrieve data records from an entity. +### [Get-CrmContentAccess](Get-CrmContentAccess.md) +Retrieve all security principals (users or teams) that have access to, and access rights for, the specified record. + ### [Get-CrmDataProvider](Get-CrmDataProvider.md) Get a registered data provider. @@ -122,6 +128,9 @@ Get SDK Message Processing Step. ### [Get-CrmPluginStepImage](Get-CrmPluginStepImage.md) Get SDK Message Processing Step Image. +### [Get-CrmPrincipalPrivileges](Get-CrmPrincipalPrivileges.md) +Retrieve the privileges a system user (user) or team has through roles in the specified business unit. + ### [Get-CrmPrincipalRoles](Get-CrmPrincipalRoles.md) Get the roles related to a user or team. @@ -140,6 +149,9 @@ Get role from the connected organization. ### [Get-CrmRolePrincipals](Get-CrmRolePrincipals.md) Get the users and teams assigned to a role. +### [Get-CrmRolePrivileges](Get-CrmRolePrivileges.md) +Retrieve the privileges that are assigned to the specified role. + ### [Get-CrmServiceEndpoint](Get-CrmServiceEndpoint.md) Get a registered serviceendpoint. @@ -155,6 +167,9 @@ Retrieve SharePoint Document locations ### [Get-CrmTeam](Get-CrmTeam.md) Get team from the connected organization. +### [Get-CrmTeamTemplate](Get-CrmTeamTemplate.md) +Get team template from the connected organization. + ### [Get-CrmTeamUsers](Get-CrmTeamUsers.md) Get the users assinged to a team. @@ -185,6 +200,9 @@ Invoke the WebAPI ### [Join-CrmContent](Join-CrmContent.md) Associate one record with another. +### [New-CrmApplication](New-CrmApplication.md) +Register a new Application User (S2S) with Dataverse + ### [New-CrmBusinessUnit](New-CrmBusinessUnit.md) Add a new business unit. @@ -212,6 +230,9 @@ Add new customizations solution. ### [New-CrmTeam](New-CrmTeam.md) Add a new team. +### [New-CrmTeamTemplate](New-CrmTeamTemplate.md) +Team template for an entity enabled for automatically created access teams + ### [New-CrmUser](New-CrmUser.md) Add a new user. @@ -269,15 +290,27 @@ Remove a value from a global optionset or picklist attribute. ### [Remove-CrmPrincipalRoles](Remove-CrmPrincipalRoles.md) Remove the roles for a user or team. +### [Remove-CrmRecordTeamUser](Remove-CrmRecordTeamUser.md) +Remove a user from the Team for a record + ### [Remove-CrmRelationship](Remove-CrmRelationship.md) Remove a relationship. ### [Remove-CrmRolePrincipals](Remove-CrmRolePrincipals.md) Remove the teams or users assigned to a role. +### [Remove-CrmRolePrivilege](Remove-CrmRolePrivilege.md) +Remove a privilege from an existing role + ### [Remove-CrmSolutionComponent](Remove-CrmSolutionComponent.md) Remove a component from a customization solution. +### [Remove-CrmTeam](Remove-CrmTeam.md) +Remove a Team + +### [Remove-CrmTeamTemplate](Remove-CrmTeamTemplate.md) +Remove a Team Template + ### [Remove-CrmTeamUsers](Remove-CrmTeamUsers.md) Remove users from a team. @@ -362,15 +395,27 @@ Update a relationship. ### [Set-CrmRelationshipCascadeConfig](Set-CrmRelationshipCascadeConfig.md) Set the cascading behavior for a relationship. +### [Set-CrmRole](Set-CrmRole.md) +Update a Security Role + ### [Set-CrmRolePrincipals](Set-CrmRolePrincipals.md) Set the teams or users assigned to a role. +### [Set-CrmRolePrivilege](Set-CrmRolePrivilege.md) +Add a set of existing privileges to an existing role. + ### [Set-CrmSession](Set-CrmSession.md) Set properties on the active session ### [Set-CrmStringAttribute](Set-CrmStringAttribute.md) Update an attribute of type String. +### [Set-CrmTeam](Set-CrmTeam.md) +Update a Team + +### [Set-CrmTeamTemplate](Set-CrmTeamTemplate.md) +Update a Team Template + ### [Set-CrmTeamUsers](Set-CrmTeamUsers.md) Set the users who are members of team. @@ -404,6 +449,9 @@ Validate a customization solution. ### [Test-CrmSolutionComponent](Test-CrmSolutionComponent.md) Validate a component in a solution. +### [Test-CrmUserPrivilege](Test-CrmUserPrivilege.md) +Retrieves the list of privileges for a system user (user) from all direct roles associated with the system user and from all indirect roles associated with teams in which the system user is a member + ### [Unregister-CrmDataProvider](Unregister-CrmDataProvider.md) Remove a registered Data Provider @@ -422,6 +470,9 @@ Unregister SDK Message Processing Step Image. ### [Unregister-CrmServiceEndpoint](Unregister-CrmServiceEndpoint.md) Unregister a serviceendpoint. +### [Use-CrmImpersonatedUser](Use-CrmImpersonatedUser.md) +Set the user to impersonate in the session context. All following request will be impersonated. + ### [Use-CrmLanguage](Use-CrmLanguage.md) Set the active language to use in the PowerShell session. diff --git a/docs/Add-CrmRecordTeamUser.md b/docs/Add-CrmRecordTeamUser.md new file mode 100644 index 0000000..6b03448 --- /dev/null +++ b/docs/Add-CrmRecordTeamUser.md @@ -0,0 +1,88 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-RecordTeamUser.md +schema: 2.0.0 +--- + +# Add-CrmRecordTeamUser + +## SYNOPSIS +Add a user to the Team for a record + +## SYNTAX + +``` +Add-CrmRecordTeamUser [-User] [-TeamTemplate] -Record [] +``` + +## DESCRIPTION +Add a user to the Team for a record + +## EXAMPLES + +## PARAMETERS + +### -Record +A Dataverse table record. Accepts input from the pipeline. + +```yaml +Type: Microsoft.Xrm.Sdk.EntityReference[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -TeamTemplate +Id of the Team Template to use. + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -User +The Id of the User to add + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Xrm.Sdk.EntityReference[] + +## OUTPUTS + +### Microsoft.Xrm.Sdk.OrganizationResponse + +## NOTES + +## RELATED LINKS + +[Add-RecordTeamUser](Add-RecordTeamUser.md) + +[AddUserToRecordTeamRequest Class](https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.addusertorecordteamrequest) diff --git a/docs/Add-CrmRelationship.md b/docs/Add-CrmRelationship.md index 4225d3d..7858a0c 100644 --- a/docs/Add-CrmRelationship.md +++ b/docs/Add-CrmRelationship.md @@ -275,5 +275,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmRelationship.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Add-CrmRelationship.md) +[Add-CrmRelationship](Add-CrmRelationship.md) diff --git a/docs/Export-CrmSolution.md b/docs/Export-CrmSolution.md index e915a71..d0676ef 100644 --- a/docs/Export-CrmSolution.md +++ b/docs/Export-CrmSolution.md @@ -241,7 +241,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Export-CrmSolution.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Export-CrmSolution.md) +[Export-CrmSolution](Export-CrmSolution.md) [Get-CrmSolution](Get-CrmSolution.md) diff --git a/docs/Get-CrmContentAccess.md b/docs/Get-CrmContentAccess.md new file mode 100644 index 0000000..32ff451 --- /dev/null +++ b/docs/Get-CrmContentAccess.md @@ -0,0 +1,94 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmContentAccess.md +schema: 2.0.0 +--- + +# Get-CrmContentAccess + +## SYNOPSIS +Retrieve all security principals (users or teams) that have access to, and access rights for, the specified record. + +## SYNTAX + +### GetContentAccessByInputObject (Default) +``` +Get-CrmContentAccess [-InputObject] [] +``` + +### GetContentAccess +``` +Get-CrmContentAccess [-Entity] [-Id] [] +``` + +## DESCRIPTION +Retrieve all security principals (users or teams) that have access to, and access rights for, the specified record. + +## EXAMPLES + +## PARAMETERS + +### -Entity +Entity LogicalName of the record to get the principals for. + +```yaml +Type: System.String +Parameter Sets: GetContentAccess +Aliases: LogicalName + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +Id of the record to get the principals for. + +```yaml +Type: System.Guid +Parameter Sets: GetContentAccess +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Record to get the principals for. + +```yaml +Type: Microsoft.Xrm.Sdk.Entity +Parameter Sets: GetContentAccessByInputObject +Aliases: Record + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Xrm.Sdk.Entity + +## OUTPUTS + +### Microsoft.Crm.Sdk.Messages.PrincipalAccess + +## NOTES + +## RELATED LINKS + +[Get-CrmContentAccess](Get-CrmContentAccess.md) + +[RetrieveSharedPrincipalsAndAccess Request](https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.retrievesharedprincipalsandaccessrequest) diff --git a/docs/Get-CrmDataProvider.md b/docs/Get-CrmDataProvider.md index 09479b8..6f519ee 100644 --- a/docs/Get-CrmDataProvider.md +++ b/docs/Get-CrmDataProvider.md @@ -139,5 +139,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmDataProvider.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmDataProvider.md) +[Get-CrmDataProvider](Get-CrmDataProvider.md) diff --git a/docs/Get-CrmEntityKey.md b/docs/Get-CrmEntityKey.md index ad86f58..786227c 100644 --- a/docs/Get-CrmEntityKey.md +++ b/docs/Get-CrmEntityKey.md @@ -139,5 +139,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEntityKey.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEntityKey.md) +[Get-CrmEntityKey](Get-CrmEntityKey.md) diff --git a/docs/Get-CrmEnvironmentVariable.md b/docs/Get-CrmEnvironmentVariable.md index 81dab9a..6049560 100644 --- a/docs/Get-CrmEnvironmentVariable.md +++ b/docs/Get-CrmEnvironmentVariable.md @@ -171,5 +171,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEnvironmentVariable.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEnvironmentVariable.md) +[Get-CrmEnvironmentVariable](Get-CrmEnvironmentVariable.md) diff --git a/docs/Get-CrmEnvironmentVariableValue.md b/docs/Get-CrmEnvironmentVariableValue.md index 97ee2e5..1195cc0 100644 --- a/docs/Get-CrmEnvironmentVariableValue.md +++ b/docs/Get-CrmEnvironmentVariableValue.md @@ -53,5 +53,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEnvironmentVariableValue.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmEnvironmentVariableValue.md) +[Get-CrmEnvironmentVariableValue](Get-CrmEnvironmentVariableValue.md) diff --git a/docs/Get-CrmPrincipalPrivileges.md b/docs/Get-CrmPrincipalPrivileges.md new file mode 100644 index 0000000..a38d5cb --- /dev/null +++ b/docs/Get-CrmPrincipalPrivileges.md @@ -0,0 +1,60 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmPrincipalPrivileges.md +schema: 2.0.0 +--- + +# Get-CrmPrincipalPrivileges + +## SYNOPSIS +Retrieve the privileges a system user (user) or team has through roles in the specified business unit. + +## SYNTAX + +``` +Get-CrmPrincipalPrivileges [-InputObject] [] +``` + +## DESCRIPTION +Retrieve the privileges a system user (user) or team has through roles in the specified business unit. + +## EXAMPLES + +## PARAMETERS + +### -InputObject +Team or System User record to get privilges for. + +```yaml +Type: Microsoft.Xrm.Sdk.Entity +Parameter Sets: (All) +Aliases: User, Team + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Xrm.Sdk.Entity + +## OUTPUTS + +### Microsoft.Xrm.Sdk.Entity + +## NOTES + +## RELATED LINKS + +[Get-CrmPrincipalPrivileges](Get-CrmPrincipalPrivileges.md) + +[RetrieveUserPrivileges Request](https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.retrieveuserprivilegesrequest) + +[RetrieveTeamPrivilegesRequest](https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.retrieveteamprivilegesrequest) \ No newline at end of file diff --git a/docs/Get-CrmRolePrivileges.md b/docs/Get-CrmRolePrivileges.md new file mode 100644 index 0000000..aa7aa38 --- /dev/null +++ b/docs/Get-CrmRolePrivileges.md @@ -0,0 +1,119 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmRolePrivileges.md +schema: 2.0.0 +--- + +# Get-CrmRolePrivileges + +## SYNOPSIS +Retrieve the privileges that are assigned to the specified role. + +## SYNTAX + +``` +Get-CrmRolePrivileges [[-Role] ] [-Include ] [-Exclude ] [-EntityPrivilegesOnly] + [-OtherPrivilegesOnly] [] +``` + +## DESCRIPTION +Retrieve the privileges that are assigned to the specified role. + +## EXAMPLES + +## PARAMETERS + +### -EntityPrivilegesOnly +Only retrieve the priviliges linked to Entities. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Exclude +Priviliges - based on name - to exclude in the result. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: True +``` + +### -Include +Priviliges - based on name - to include in the result. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: True +``` + +### -OtherPrivilegesOnly +Only retrieve the priviliges not linked to Entities. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Role +The security role to retrieve the privileges for. + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: Id + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid + +## OUTPUTS + +### Microsoft.Xrm.Sdk.Entity + +## NOTES + +## RELATED LINKS + +[Get-CrmRolePrivileges](Get-CrmRolePrivileges.md) + +[RetrieveRolePrivilegesRole Request](https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.retrieveroleprivilegesrolerequest) \ No newline at end of file diff --git a/docs/Get-CrmSPDocumentLocation.md b/docs/Get-CrmSPDocumentLocation.md index c73cb17..8e4da92 100644 --- a/docs/Get-CrmSPDocumentLocation.md +++ b/docs/Get-CrmSPDocumentLocation.md @@ -89,5 +89,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmSPDocumentLocation.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmSPDocumentLocation.md) +[Get-CrmSPDocumentLocation](Get-CrmSPDocumentLocation.md) diff --git a/docs/Get-CrmTeam.md b/docs/Get-CrmTeam.md index e14c1d5..5e39d82 100644 --- a/docs/Get-CrmTeam.md +++ b/docs/Get-CrmTeam.md @@ -119,7 +119,7 @@ The type of team to retrieve. If not provide all types of teams will be returned Type: AMSoftware.Crm.PowerShell.Common.CrmTeamType Parameter Sets: GetAllTeams Aliases: -Accepted values: Owner, Access +Accepted values: Owner, Access, AADSecurityGroup, AADOfficeGroup Required: False Position: Named diff --git a/docs/Get-CrmTeamTemplate.md b/docs/Get-CrmTeamTemplate.md new file mode 100644 index 0000000..f9b5091 --- /dev/null +++ b/docs/Get-CrmTeamTemplate.md @@ -0,0 +1,158 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Get-CrmTeamTemplate.md +schema: 2.0.0 +--- + +# Get-CrmTeamTemplate + +## SYNOPSIS +Get team template from the connected organization. + +## SYNTAX + +### GetAllTeamTemplates (Default) +``` +Get-CrmTeamTemplate [[-Name] ] [-Exclude ] [-ObjectTypeCode ] [-IncludeTotalCount] + [-Skip ] [-First ] [] +``` + +### GetTeamTemplateById +``` +Get-CrmTeamTemplate [-Id] [-IncludeTotalCount] [-Skip ] [-First ] [] +``` + +## DESCRIPTION +Get team template from the connected organization. + +## EXAMPLES + +## PARAMETERS + +### -Exclude +Exclude team templates whose name matches the provided pattern. + +```yaml +Type: System.String +Parameter Sets: GetAllTeamTemplates +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: True +``` + +### -Id +The id of the team template to retrieve. + +```yaml +Type: System.Guid[] +Parameter Sets: GetTeamTemplateById +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Include team templates whose name matches the provided pattern. + +```yaml +Type: System.String +Parameter Sets: GetAllTeamTemplates +Aliases: Include + +Required: False +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: True +``` + +### -ObjectTypeCode +The ObjectTypeCode of the entity the team template is connected to. + +```yaml +Type: System.Int32 +Parameter Sets: GetAllTeamTemplates +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IncludeTotalCount +Reports the total number of objects in the data set (an integer) followed by the selected objects. +If the cmdlet cannot determine the total count, it displays "Unknown total count." The integer has an Accuracy property that indicates the reliability of the total count value. +The value of Accuracy ranges from 0.0 to 1.0 where 0.0 means that the cmdlet could not count the objects, 1.0 means that the count is exact, and a value between 0.0 and 1.0 indicates an increasingly reliable estimate. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Skip +Ignores the specified number of objects and then gets the remaining objects. +Enter the number of objects to skip. + +```yaml +Type: System.UInt64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -First +Gets only the specified number of objects. +Enter the number of objects to get. + +```yaml +Type: System.UInt64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid[] + +## OUTPUTS + +### Microsoft.Xrm.Sdk.Entity + +## NOTES + +## RELATED LINKS + +[Get-CrmTeamTemplate](Get-CrmTeamTemplate.md) + diff --git a/docs/Invoke-CrmRequest.md b/docs/Invoke-CrmRequest.md index be3aaae..36f5ebb 100644 --- a/docs/Invoke-CrmRequest.md +++ b/docs/Invoke-CrmRequest.md @@ -85,7 +85,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### System.Object +### Microsoft.Xrm.Sdk.OrganizationResponse + ## NOTES ## RELATED LINKS diff --git a/docs/Invoke-CrmWebApiRequest.md b/docs/Invoke-CrmWebApiRequest.md index 75be389..32f2662 100644 --- a/docs/Invoke-CrmWebApiRequest.md +++ b/docs/Invoke-CrmWebApiRequest.md @@ -122,5 +122,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Invoke-CrmWebApiRequest.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Invoke-CrmWebApiRequest.md) +[Invoke-CrmWebApiRequest](Invoke-CrmWebApiRequest.md) diff --git a/docs/New-CrmApplication.md b/docs/New-CrmApplication.md new file mode 100644 index 0000000..5ff8847 --- /dev/null +++ b/docs/New-CrmApplication.md @@ -0,0 +1,102 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Invoke-CrmNewApplication.md +schema: 2.0.0 +--- + +# New-CrmApplication + +## SYNOPSIS +Register a new Application User (S2S) with Dataverse + +## SYNTAX + +``` +New-CrmApplication [-AppId] [-BusinessUnit ] [-Roles ] [-PassThru] [] +``` + +## DESCRIPTION +Register a new Application User (S2S) with Dataverse + +## EXAMPLES + +## PARAMETERS + +### -AppId +The AppId/ClientId in Azure AD of the Application to add + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BusinessUnit +Business Unit the Application User is added to + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns an object that represents the User. By default, this cmdlet does not generate any output. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Roles +The Security Role to assign to the new Application User + +```yaml +Type: System.Guid[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid[] + +## OUTPUTS + +### Microsoft.Xrm.Sdk.Entity + +## NOTES + +## RELATED LINKS + +[New-CrmApplication](New-CrmApplication.md) + diff --git a/docs/New-CrmEnvironmentVariable.md b/docs/New-CrmEnvironmentVariable.md index ed032c7..42e016b 100644 --- a/docs/New-CrmEnvironmentVariable.md +++ b/docs/New-CrmEnvironmentVariable.md @@ -146,5 +146,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmEnvironmentVariable.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmEnvironmentVariable.md) +[New-CrmEnvironmentVariable](New-CrmEnvironmentVariable.md) diff --git a/docs/New-CrmRole.md b/docs/New-CrmRole.md index 4531c05..999f867 100644 --- a/docs/New-CrmRole.md +++ b/docs/New-CrmRole.md @@ -13,7 +13,8 @@ Add a new role. ## SYNTAX ``` -New-CrmRole [-Name] [-BusinessUnit ] [-PassThru] [] +New-CrmRole [-Name] [-BusinessUnit ] [-Inheritance ] [-PassThru] + [] ``` ## DESCRIPTION @@ -38,6 +39,22 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +### -Inheritance +Is Role inherited by users from team membership, if role associated with team. + +```yaml +Type: AMSoftware.Crm.PowerShell.Common.CrmRoleInheritance +Parameter Sets: (All) +Aliases: +Accepted values: TeamOnly, DirectUser + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Name The name for the role. diff --git a/docs/New-CrmTeam.md b/docs/New-CrmTeam.md index 39b3a67..b783f04 100644 --- a/docs/New-CrmTeam.md +++ b/docs/New-CrmTeam.md @@ -12,11 +12,19 @@ Add a new team. ## SYNTAX +### NewTeam (Default) ``` New-CrmTeam [-Name] [-TeamType] [-Administrator] [-BusinessUnit ] [-Description ] [-Users ] [-PassThru] [] ``` +### NewAADTeam +``` +New-CrmTeam [-Name] [-TeamType] [-Administrator] [-BusinessUnit ] + [-Description ] [-MembershipType ] -AADObjectId [-PassThru] + [] +``` + ## DESCRIPTION Add a new team. @@ -24,6 +32,21 @@ Add a new team. ## PARAMETERS +### -AADObjectId +The Azure active directory object Id for a group. + +```yaml +Type: System.Guid +Parameter Sets: NewAADTeam +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Administrator The id of the user who administers the team. @@ -69,6 +92,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MembershipType +The team membership type. + +```yaml +Type: AMSoftware.Crm.PowerShell.Common.CrmTeamMembershipType +Parameter Sets: NewAADTeam +Aliases: +Accepted values: MembersGuests, Members, Owners, Guests + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Name The name for the team. @@ -106,7 +145,7 @@ The team of team to create. Type: AMSoftware.Crm.PowerShell.Common.CrmTeamType Parameter Sets: (All) Aliases: -Accepted values: Owner, Access +Accepted values: Owner, Access, AADSecurityGroup, AADOfficeGroup Required: True Position: 1 @@ -120,7 +159,7 @@ The id of users who will be members of the team. ```yaml Type: System.Guid[] -Parameter Sets: (All) +Parameter Sets: NewTeam Aliases: Required: False diff --git a/docs/New-CrmTeamTemplate.md b/docs/New-CrmTeamTemplate.md new file mode 100644 index 0000000..7643dc7 --- /dev/null +++ b/docs/New-CrmTeamTemplate.md @@ -0,0 +1,119 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/New-CrmTeamTemplate.md +schema: 2.0.0 +--- + +# New-CrmTeamTemplate + +## SYNOPSIS +Team template for an entity enabled for automatically created access teams + +## SYNTAX + +``` +New-CrmTeamTemplate [-Name] [-Description ] -ObjectTypeCode + -DefaultAccessRight [-PassThru] [] +``` + +## DESCRIPTION +Team template for an entity enabled for automatically created access teams + +## EXAMPLES + +## PARAMETERS + +### -DefaultAccessRight +Default access rights mask for the access teams associated with entity instances + +```yaml +Type: AMSoftware.Crm.PowerShell.Common.CrmAccessRight +Parameter Sets: (All) +Aliases: +Accepted values: None, Read, Write, Append, AppendTo, Create, Delete, Share, Assign + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Description +The description for the Etam Template + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The Name of the Team Template + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ObjectTypeCode +Object type code of entity which is enabled for access teams + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -PassThru +Return the created Team Template + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Int32 + +## OUTPUTS + +### Microsoft.Xrm.Sdk.Entity + +## NOTES + +## RELATED LINKS + +[New-CrmTeamTemplate](New-CrmTeamTemplate.md) + diff --git a/docs/Register-CrmDataProvider.md b/docs/Register-CrmDataProvider.md index 666a282..e09b8cb 100644 --- a/docs/Register-CrmDataProvider.md +++ b/docs/Register-CrmDataProvider.md @@ -190,5 +190,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmDataProvider.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmDataProvider.md) +[Register-CrmDataProvider](Register-CrmDataProvider.md) diff --git a/docs/Register-CrmPluginStep.md b/docs/Register-CrmPluginStep.md index 6dce267..f97a843 100644 --- a/docs/Register-CrmPluginStep.md +++ b/docs/Register-CrmPluginStep.md @@ -15,7 +15,7 @@ Register a SDK Message Processing Step. ``` Register-CrmPluginStep [-EventSource] [-Message] [[-PrimaryEntity] ] [-SecondaryEntity ] [-ExecutionOrder ] [-Name ] [-Description ] - -Stage -Mode -Deployment + -Stage -Mode [-Deployment ] [-DeleteAsyncOperation] [-UnsecureConfig ] [-SecureConfig ] [-User ] [-Attributes ] [-PassThru] [] ``` @@ -66,7 +66,7 @@ Parameter Sets: (All) Aliases: Accepted values: ServerOnly, OfflineOnly, Both -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False diff --git a/docs/Register-CrmWebhook.md b/docs/Register-CrmWebhook.md index 001406b..76c7670 100644 --- a/docs/Register-CrmWebhook.md +++ b/docs/Register-CrmWebhook.md @@ -157,5 +157,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmWebhook.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Register-CrmWebhook.md) +[Register-CrmWebhook](Register-CrmWebhook.md) diff --git a/docs/Remove-CrmEnvironmentVariable.md b/docs/Remove-CrmEnvironmentVariable.md index aa66d5c..d00ce74 100644 --- a/docs/Remove-CrmEnvironmentVariable.md +++ b/docs/Remove-CrmEnvironmentVariable.md @@ -67,5 +67,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmEnvironmentVariable.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmEnvironmentVariable.md) +[Remove-CrmEnvironmentVariable](Remove-CrmEnvironmentVariable.md) diff --git a/docs/Remove-CrmEnvironmentVariableValue.md b/docs/Remove-CrmEnvironmentVariableValue.md index f763916..3c39e2b 100644 --- a/docs/Remove-CrmEnvironmentVariableValue.md +++ b/docs/Remove-CrmEnvironmentVariableValue.md @@ -67,5 +67,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmEnvironmentVariableValue.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmEnvironmentVariableValue.md) +[Remove-CrmEnvironmentVariableValue](Remove-CrmEnvironmentVariableValue.md) diff --git a/docs/Remove-CrmPrincipalRoles.md b/docs/Remove-CrmPrincipalRoles.md index 28b5716..6e8ee66 100644 --- a/docs/Remove-CrmPrincipalRoles.md +++ b/docs/Remove-CrmPrincipalRoles.md @@ -105,5 +105,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmPrincipalRoles.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmPrincipalRoles.md) +[Remove-CrmPrincipalRoles](Remove-CrmPrincipalRoles.md) diff --git a/docs/Remove-CrmRecordTeamUser.md b/docs/Remove-CrmRecordTeamUser.md new file mode 100644 index 0000000..0ef5fa6 --- /dev/null +++ b/docs/Remove-CrmRecordTeamUser.md @@ -0,0 +1,87 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-RecordTeamUser.md +schema: 2.0.0 +--- + +# Remove-CrmRecordTeamUser + +## SYNOPSIS +Remove a user from the Team for a record + +## SYNTAX + +``` +Remove-CrmRecordTeamUser [-User] [-TeamTemplate] -Record [] +``` + +## DESCRIPTION +Remove a user from the Team for a record + +## EXAMPLES + +## PARAMETERS + +### -Record +A Dataverse table record. Accepts input from the pipeline. + +```yaml +Type: Microsoft.Xrm.Sdk.EntityReference[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -TeamTemplate +Id of the Team Template to use. + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -User +The Id of the User to remove + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Xrm.Sdk.EntityReference[] + +## OUTPUTS + +### Microsoft.Xrm.Sdk.OrganizationResponse + +## NOTES + +## RELATED LINKS + +[Remove-RecordTeamUser](Remove-RecordTeamUser.md) + diff --git a/docs/Remove-CrmRolePrincipals.md b/docs/Remove-CrmRolePrincipals.md index 427d3fe..e1100b2 100644 --- a/docs/Remove-CrmRolePrincipals.md +++ b/docs/Remove-CrmRolePrincipals.md @@ -118,5 +118,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmRolePrincipals.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmRolePrincipals.md) +[Remove-CrmRolePrincipals](Remove-CrmRolePrincipals.md) diff --git a/docs/Remove-CrmRolePrivilege.md b/docs/Remove-CrmRolePrivilege.md new file mode 100644 index 0000000..b90d1eb --- /dev/null +++ b/docs/Remove-CrmRolePrivilege.md @@ -0,0 +1,127 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmRolePrivileges.md +schema: 2.0.0 +--- + +# Remove-CrmRolePrivilege + +## SYNOPSIS +Remove a privilege from an existing role + +## SYNTAX + +### RemoveRolePrivilegeForEntity (Default) +``` +Remove-CrmRolePrivilege [-Role] [-EntityLogicalName] [-AccessRight] [-Force] + [] +``` + +### RemoveRolePrivilegesByName +``` +Remove-CrmRolePrivilege [-Role] -PrivilegeName [-Force] [] +``` + +## DESCRIPTION +Remove a privilege from an existing role + +## EXAMPLES + +## PARAMETERS + +### -AccessRight +The Access Right for the Privilege to remove + +```yaml +Type: AMSoftware.Crm.PowerShell.Common.CrmAccessRight +Parameter Sets: RemoveRolePrivilegeForEntity +Aliases: +Accepted values: None, Read, Write, Append, AppendTo, Create, Delete, Share, Assign + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EntityLogicalName +LogicalName of the Entity to remove the access for + +```yaml +Type: System.String +Parameter Sets: RemoveRolePrivilegeForEntity +Aliases: LogicalName + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Force +Execute the removal without confirmation + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivilegeName +Name of the Privilige to remove + +```yaml +Type: System.String[] +Parameter Sets: RemoveRolePrivilegesByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Role +The Role to remove to privilige from + +```yaml +Type: System.Guid[] +Parameter Sets: (All) +Aliases: Id + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid[] + +### System.String[] + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS + +[Remove-CrmRolePrivileges](Remove-CrmRolePrivileges.md) + +[RemovePrivilegeRole Request](https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.removeprivilegerolerequest) \ No newline at end of file diff --git a/docs/Remove-CrmTeam.md b/docs/Remove-CrmTeam.md new file mode 100644 index 0000000..6b58578 --- /dev/null +++ b/docs/Remove-CrmTeam.md @@ -0,0 +1,71 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmTeam.md +schema: 2.0.0 +--- + +# Remove-CrmTeam + +## SYNOPSIS +Remove a Team + +## SYNTAX + +``` +Remove-CrmTeam [-Id] [-Force] [] +``` + +## DESCRIPTION +Remove a Team + +## EXAMPLES + +## PARAMETERS + +### -Force +Remove the Team without confirmation + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +Id of the Team to remove + +```yaml +Type: System.Guid[] +Parameter Sets: (All) +Aliases: Team + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid[] + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS + +[Remove-CrmTeam](Remove-CrmTeam.md) + diff --git a/docs/Remove-CrmTeamTemplate.md b/docs/Remove-CrmTeamTemplate.md new file mode 100644 index 0000000..096cd0d --- /dev/null +++ b/docs/Remove-CrmTeamTemplate.md @@ -0,0 +1,71 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmTeamTemplate.md +schema: 2.0.0 +--- + +# Remove-CrmTeamTemplate + +## SYNOPSIS +Remove a Team Template + +## SYNTAX + +``` +Remove-CrmTeamTemplate [-Id] [-Force] [] +``` + +## DESCRIPTION +Remove a Team Template + +## EXAMPLES + +## PARAMETERS + +### -Force +Remove the Team Template without confirmation + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +Id of the Team Template to remove + +```yaml +Type: System.Guid[] +Parameter Sets: (All) +Aliases: TeamTemplate + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid[] + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS + +[Remove-CrmTeamTemplate](Remove-CrmTeamTemplate.md) + diff --git a/docs/Remove-CrmTeamUsers.md b/docs/Remove-CrmTeamUsers.md index 1f7b14d..c1d75a4 100644 --- a/docs/Remove-CrmTeamUsers.md +++ b/docs/Remove-CrmTeamUsers.md @@ -88,5 +88,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmTeamUsers.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmTeamUsers.md) +[Remove-CrmTeamUsers](Remove-CrmTeamUsers.md) diff --git a/docs/Remove-CrmUserTeams.md b/docs/Remove-CrmUserTeams.md index 8b542f9..7353937 100644 --- a/docs/Remove-CrmUserTeams.md +++ b/docs/Remove-CrmUserTeams.md @@ -88,5 +88,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmUserTeams.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Remove-CrmUserTeams.md) +[Remove-CrmUserTeams](Remove-CrmUserTeams.md) diff --git a/docs/Set-CrmDataProvider.md b/docs/Set-CrmDataProvider.md index 043b519..a4dbede 100644 --- a/docs/Set-CrmDataProvider.md +++ b/docs/Set-CrmDataProvider.md @@ -159,5 +159,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmDataProvider.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmDataProvider.md) +[Set-CrmDataProvider](Set-CrmDataProvider.md) diff --git a/docs/Set-CrmEnvironmentVariable.md b/docs/Set-CrmEnvironmentVariable.md index 1bbf30e..2ed7f16 100644 --- a/docs/Set-CrmEnvironmentVariable.md +++ b/docs/Set-CrmEnvironmentVariable.md @@ -129,5 +129,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmEnvironmentVariable.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmEnvironmentVariable.md) +[Set-CrmEnvironmentVariable](Set-CrmEnvironmentVariable.md) diff --git a/docs/Set-CrmRole.md b/docs/Set-CrmRole.md new file mode 100644 index 0000000..13487b4 --- /dev/null +++ b/docs/Set-CrmRole.md @@ -0,0 +1,103 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmRole.md +schema: 2.0.0 +--- + +# Set-CrmRole + +## SYNOPSIS +Update a Security Role + +## SYNTAX + +``` +Set-CrmRole [-Id] [-Name ] [-Inheritance ] [-PassThru] [] +``` + +## DESCRIPTION +Update a Security Role + +## EXAMPLES + +## PARAMETERS + +### -Id +Id of the Role to update + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: Role + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -Inheritance +Is Role inherited by users from team membership, if role associated with team. + +```yaml +Type: AMSoftware.Crm.PowerShell.Common.CrmRoleInheritance +Parameter Sets: (All) +Aliases: +Accepted values: TeamOnly, DirectUser + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name for the role. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns an object that represents the Role. By default, this cmdlet does not generate any output. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid + +## OUTPUTS + +### Microsoft.Xrm.Sdk.Entity + +## NOTES + +## RELATED LINKS + +[Set-CrmRole](Set-CrmRole.md) + diff --git a/docs/Set-CrmRolePrivilege.md b/docs/Set-CrmRolePrivilege.md new file mode 100644 index 0000000..5dbf63a --- /dev/null +++ b/docs/Set-CrmRolePrivilege.md @@ -0,0 +1,129 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmRolePrivileges.md +schema: 2.0.0 +--- + +# Set-CrmRolePrivilege + +## SYNOPSIS +Add a set of existing privileges to an existing role. + +## SYNTAX + +### SetRolePrivilegeForEntity (Default) +``` +Set-CrmRolePrivilege [-Role] [-EntityLogicalName] [-AccessRight] + [-Scope] [] +``` + +### SetRolePrivilegesByName +``` +Set-CrmRolePrivilege [-Role] -PrivilegeName [-Scope] [] +``` + +## DESCRIPTION +Add a set of existing privileges to an existing role. + +## EXAMPLES + +## PARAMETERS + +### -AccessRight +The Access Right mask to set + +```yaml +Type: AMSoftware.Crm.PowerShell.Common.CrmAccessRight +Parameter Sets: SetRolePrivilegeForEntity +Aliases: +Accepted values: None, Read, Write, Append, AppendTo, Create, Delete, Share, Assign + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EntityLogicalName +The LogicalName of the Entity to set Privileges for + +```yaml +Type: System.String +Parameter Sets: SetRolePrivilegeForEntity +Aliases: LogicalName + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivilegeName +Name of the Privilege to set + +```yaml +Type: System.String[] +Parameter Sets: SetRolePrivilegesByName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Role +The Security Role to Add to Privilege to + +```yaml +Type: System.Guid[] +Parameter Sets: (All) +Aliases: Id + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -Scope +The scope the Privilege applies to + +```yaml +Type: AMSoftware.Crm.PowerShell.Common.CrmAccessScope +Parameter Sets: (All) +Aliases: +Accepted values: User, BusinessUnit, ChildBusinessUnit, Organization, None + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid[] + +### System.String[] + +## OUTPUTS + +### Microsoft.Xrm.Sdk.Entity + +## NOTES + +## RELATED LINKS + +[Set-CrmRolePrivileges](Set-CrmRolePrivileges.md) + +[AddPrivilegesRole Request](https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.addprivilegesrolerequest) \ No newline at end of file diff --git a/docs/Set-CrmSession.md b/docs/Set-CrmSession.md index 97cc959..e1df31d 100644 --- a/docs/Set-CrmSession.md +++ b/docs/Set-CrmSession.md @@ -13,7 +13,8 @@ Set properties on the active session ## SYNTAX ``` -Set-CrmSession [-Language ] [-Solution ] [-UseMetadataCache ] [] +Set-CrmSession [-Language ] [-Solution ] [-UseMetadataCache ] + [-ImpersonatedUserId ] [] ``` ## DESCRIPTION @@ -23,6 +24,21 @@ Set properties on the active session ## PARAMETERS +### -ImpersonatedUserId +Id of the User to impersonate + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Language Set the active language for the session (0 = default organization language) @@ -82,5 +98,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmSession.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmSession.md) +[Set-CrmSession](Set-CrmSession.md) diff --git a/docs/Set-CrmTeam.md b/docs/Set-CrmTeam.md new file mode 100644 index 0000000..17e693a --- /dev/null +++ b/docs/Set-CrmTeam.md @@ -0,0 +1,118 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmTeam.md +schema: 2.0.0 +--- + +# Set-CrmTeam + +## SYNOPSIS +Update a Team + +## SYNTAX + +``` +Set-CrmTeam [-Id] [-Name ] [-Administrator ] [-Description ] [-PassThru] + [] +``` + +## DESCRIPTION +Update a Team + +## EXAMPLES + +## PARAMETERS + +### -Administrator +Id of the User that administers the Team + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Description +Description of the Team + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +The Id of the Team to update + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -Name +The new name for the Team + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns an object that represents the Team. By default, this cmdlet does not generate any output. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid + +## OUTPUTS + +### Microsoft.Xrm.Sdk.Entity + +## NOTES + +## RELATED LINKS + +[Set-CrmTeam](Set-CrmTeam.md) + diff --git a/docs/Set-CrmTeamTemplate.md b/docs/Set-CrmTeamTemplate.md new file mode 100644 index 0000000..cf971cb --- /dev/null +++ b/docs/Set-CrmTeamTemplate.md @@ -0,0 +1,134 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Set-CrmTeamTemplate.md +schema: 2.0.0 +--- + +# Set-CrmTeamTemplate + +## SYNOPSIS +Update a Team Template + +## SYNTAX + +``` +Set-CrmTeamTemplate [-Id] [-Name ] [-Description ] [-ObjectTypeCode ] + [-DefaultAccessRight ] [-PassThru] [] +``` + +## DESCRIPTION +Update a Team Template + +## EXAMPLES + +## PARAMETERS + +### -DefaultAccessRight +The Default Access Right for the Access Team based on the template + +```yaml +Type: AMSoftware.Crm.PowerShell.Common.CrmAccessRight +Parameter Sets: (All) +Aliases: +Accepted values: None, Read, Write, Append, AppendTo, Create, Delete, Share, Assign + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Description +Description of the Team Template + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Id +Id of the Team Template to update + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The new name for the Team Template + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ObjectTypeCode +The ObjectTypeCode of the Entity the Team Template is linked to + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns an object that represents the Team Template. By default, this cmdlet does not generate any output. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### Microsoft.Xrm.Sdk.Entity + +## NOTES + +## RELATED LINKS + +[Set-CrmTeamTemplate](Set-CrmTeamTemplate.md) + diff --git a/docs/Start-CrmBatch.md b/docs/Start-CrmBatch.md index 8fd10f9..cd1fde9 100644 --- a/docs/Start-CrmBatch.md +++ b/docs/Start-CrmBatch.md @@ -38,5 +38,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Start-CrmBatch.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Start-CrmBatch.md) +[Start-CrmBatch](Start-CrmBatch.md) diff --git a/docs/Stop-CrmBatch.md b/docs/Stop-CrmBatch.md index 532b0d2..934cbc6 100644 --- a/docs/Stop-CrmBatch.md +++ b/docs/Stop-CrmBatch.md @@ -52,5 +52,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Stop-CrmBatch.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Stop-CrmBatch.md) +[Stop-CrmBatch](Stop-CrmBatch.md) diff --git a/docs/Submit-CrmBatch.md b/docs/Submit-CrmBatch.md index c63f67f..884dfdc 100644 --- a/docs/Submit-CrmBatch.md +++ b/docs/Submit-CrmBatch.md @@ -61,7 +61,7 @@ Failure won't throw an exception. Check the results to determine if the batch su ## PARAMETERS ### -AsTransaction -{{ Fill AsTransaction Description }} +Execute all request in the Batch in a single transaction ```yaml Type: System.Management.Automation.SwitchParameter @@ -76,7 +76,7 @@ Accept wildcard characters: False ``` ### -ContinueOnError -{{ Fill ContinueOnError Description }} +On error the batch won't stop, but continues with the next request ```yaml Type: System.Management.Automation.SwitchParameter @@ -91,7 +91,7 @@ Accept wildcard characters: False ``` ### -ReturnResponses -{{ Fill ReturnResponses Description }} +Return the output of the requests in the batch ```yaml Type: System.Management.Automation.SwitchParameter @@ -122,5 +122,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Submit-CrmBatch.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Submit-CrmBatch.md) +[Submit-CrmBatch](Submit-CrmBatch.md) diff --git a/docs/Test-CrmUserPrivilege.md b/docs/Test-CrmUserPrivilege.md new file mode 100644 index 0000000..77d667b --- /dev/null +++ b/docs/Test-CrmUserPrivilege.md @@ -0,0 +1,111 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Test-CrmUserPrivilege.md +schema: 2.0.0 +--- + +# Test-CrmUserPrivilege + +## SYNOPSIS +Retrieves the list of privileges for a system user (user) from all direct roles associated with the system user and from all indirect roles associated with teams in which the system user is a member + +## SYNTAX + +### TestUserPrivilegesByName +``` +Test-CrmUserPrivilege [-User] [-PrivilegeName] [] +``` + +### TestUserPrivilegeForEntity +``` +Test-CrmUserPrivilege [-User] [-EntityLogicalName] [-AccessRight] + [] +``` + +## DESCRIPTION +Retrieves the list of privileges for a system user (user) from all direct roles associated with the system user and from all indirect roles associated with teams in which the system user is a member + +## EXAMPLES + +## PARAMETERS + +### -AccessRight +The Access Right mask to test for + +```yaml +Type: AMSoftware.Crm.PowerShell.Common.CrmAccessRight +Parameter Sets: TestUserPrivilegeForEntity +Aliases: +Accepted values: None, Read, Write, Append, AppendTo, Create, Delete, Share, Assign + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -EntityLogicalName +The LogicalName of the Entity to test the access for + +```yaml +Type: System.String +Parameter Sets: TestUserPrivilegeForEntity +Aliases: LogicalName + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivilegeName +The name of the Privilige to test for + +```yaml +Type: System.String +Parameter Sets: TestUserPrivilegesByName +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -User +The Id of the User to test access for + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: Id + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid + +## OUTPUTS + +### System.Boolean + +## NOTES + +## RELATED LINKS + +[Test-CrmUserPrivilege](Test-CrmUserPrivilege.md) + +[RetrieveUserPrivilegeByPrivilegeName Request](https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.retrieveuserprivilegebyprivilegenamerequest) \ No newline at end of file diff --git a/docs/Unregister-CrmDataProvider.md b/docs/Unregister-CrmDataProvider.md index 4334bc3..8610b4c 100644 --- a/docs/Unregister-CrmDataProvider.md +++ b/docs/Unregister-CrmDataProvider.md @@ -67,5 +67,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Unregister-CrmDataProvider.md](https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Unregister-CrmDataProvider.md) +[Unregister-CrmDataProvider](Unregister-CrmDataProvider.md) diff --git a/docs/Use-CrmImpersonatedUser.md b/docs/Use-CrmImpersonatedUser.md new file mode 100644 index 0000000..7e5aad7 --- /dev/null +++ b/docs/Use-CrmImpersonatedUser.md @@ -0,0 +1,56 @@ +--- +external help file: AMSoftware.Crm.PowerShell.Commands.dll-Help.xml +Module Name: AMSoftware.Crm +online version: https://github.com/AMSoftwareNL/crmpowershell/blob/master/docs/Use-CrmImpersonatedUser.md +schema: 2.0.0 +--- + +# Use-CrmImpersonatedUser + +## SYNOPSIS +Set the user to impersonate in the session context. All following request will be impersonated. + +## SYNTAX + +``` +Use-CrmImpersonatedUser [[-ImpersonatedUserId] ] [] +``` + +## DESCRIPTION +Set the user to impersonate in the session context. All following request will be impersonated. + +## EXAMPLES + +## PARAMETERS + +### -ImpersonatedUserId +The Id of the user to impersonate. When not supplied impersonation will stop. + +```yaml +Type: System.Guid +Parameter Sets: (All) +Aliases: UserId + +Required: False +Position: 1 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Guid + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS + +[Use-CrmImpersonatedUser](Use-CrmImpersonatedUser.md) + diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 259a24e..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-tactile \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 098d4b0..b75e73d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@ Module Name: AMSoftware.Crm Module Guid: 1e7f1ebc-e035-4d73-86af-3c07a6a85260 Download Help Link: -Help Version: 2.1.0.0 +Help Version: 2.2.0.0 Locale: en-us --- @@ -53,6 +53,9 @@ Add an attribute of type Money. ### [Add-CrmOptionSetAttribute](Add-CrmOptionSetAttribute.md) Add an attribute of type OptionSet. +### [Add-CrmRecordTeamUser](Add-CrmRecordTeamUser.md) +Add a user to the Team for a record + ### [Add-CrmRelationship](Add-CrmRelationship.md) Add a relationship. @@ -89,6 +92,9 @@ Get a Business Unit. ### [Get-CrmContent](Get-CrmContent.md) Retrieve data records from an entity. +### [Get-CrmContentAccess](Get-CrmContentAccess.md) +Retrieve all security principals (users or teams) that have access to, and access rights for, the specified record. + ### [Get-CrmDataProvider](Get-CrmDataProvider.md) Get a registered data provider. @@ -122,6 +128,9 @@ Get SDK Message Processing Step. ### [Get-CrmPluginStepImage](Get-CrmPluginStepImage.md) Get SDK Message Processing Step Image. +### [Get-CrmPrincipalPrivileges](Get-CrmPrincipalPrivileges.md) +Retrieve the privileges a system user (user) or team has through roles in the specified business unit. + ### [Get-CrmPrincipalRoles](Get-CrmPrincipalRoles.md) Get the roles related to a user or team. @@ -140,6 +149,9 @@ Get role from the connected organization. ### [Get-CrmRolePrincipals](Get-CrmRolePrincipals.md) Get the users and teams assigned to a role. +### [Get-CrmRolePrivileges](Get-CrmRolePrivileges.md) +Retrieve the privileges that are assigned to the specified role. + ### [Get-CrmServiceEndpoint](Get-CrmServiceEndpoint.md) Get a registered serviceendpoint. @@ -155,6 +167,9 @@ Retrieve SharePoint Document locations ### [Get-CrmTeam](Get-CrmTeam.md) Get team from the connected organization. +### [Get-CrmTeamTemplate](Get-CrmTeamTemplate.md) +Get team template from the connected organization. + ### [Get-CrmTeamUsers](Get-CrmTeamUsers.md) Get the users assinged to a team. @@ -185,6 +200,9 @@ Invoke the WebAPI ### [Join-CrmContent](Join-CrmContent.md) Associate one record with another. +### [New-CrmApplication](New-CrmApplication.md) +Register a new Application User (S2S) with Dataverse + ### [New-CrmBusinessUnit](New-CrmBusinessUnit.md) Add a new business unit. @@ -212,6 +230,9 @@ Add new customizations solution. ### [New-CrmTeam](New-CrmTeam.md) Add a new team. +### [New-CrmTeamTemplate](New-CrmTeamTemplate.md) +Team template for an entity enabled for automatically created access teams + ### [New-CrmUser](New-CrmUser.md) Add a new user. @@ -269,15 +290,27 @@ Remove a value from a global optionset or picklist attribute. ### [Remove-CrmPrincipalRoles](Remove-CrmPrincipalRoles.md) Remove the roles for a user or team. +### [Remove-CrmRecordTeamUser](Remove-CrmRecordTeamUser.md) +Remove a user from the Team for a record + ### [Remove-CrmRelationship](Remove-CrmRelationship.md) Remove a relationship. ### [Remove-CrmRolePrincipals](Remove-CrmRolePrincipals.md) Remove the teams or users assigned to a role. +### [Remove-CrmRolePrivilege](Remove-CrmRolePrivilege.md) +Remove a privilege from an existing role + ### [Remove-CrmSolutionComponent](Remove-CrmSolutionComponent.md) Remove a component from a customization solution. +### [Remove-CrmTeam](Remove-CrmTeam.md) +Remove a Team + +### [Remove-CrmTeamTemplate](Remove-CrmTeamTemplate.md) +Remove a Team Template + ### [Remove-CrmTeamUsers](Remove-CrmTeamUsers.md) Remove users from a team. @@ -362,15 +395,27 @@ Update a relationship. ### [Set-CrmRelationshipCascadeConfig](Set-CrmRelationshipCascadeConfig.md) Set the cascading behavior for a relationship. +### [Set-CrmRole](Set-CrmRole.md) +Update a Security Role + ### [Set-CrmRolePrincipals](Set-CrmRolePrincipals.md) Set the teams or users assigned to a role. +### [Set-CrmRolePrivilege](Set-CrmRolePrivilege.md) +Add a set of existing privileges to an existing role. + ### [Set-CrmSession](Set-CrmSession.md) Set properties on the active session ### [Set-CrmStringAttribute](Set-CrmStringAttribute.md) Update an attribute of type String. +### [Set-CrmTeam](Set-CrmTeam.md) +Update a Team + +### [Set-CrmTeamTemplate](Set-CrmTeamTemplate.md) +Update a Team Template + ### [Set-CrmTeamUsers](Set-CrmTeamUsers.md) Set the users who are members of team. @@ -404,6 +449,9 @@ Validate a customization solution. ### [Test-CrmSolutionComponent](Test-CrmSolutionComponent.md) Validate a component in a solution. +### [Test-CrmUserPrivilege](Test-CrmUserPrivilege.md) +Retrieves the list of privileges for a system user (user) from all direct roles associated with the system user and from all indirect roles associated with teams in which the system user is a member + ### [Unregister-CrmDataProvider](Unregister-CrmDataProvider.md) Remove a registered Data Provider @@ -422,6 +470,9 @@ Unregister SDK Message Processing Step Image. ### [Unregister-CrmServiceEndpoint](Unregister-CrmServiceEndpoint.md) Unregister a serviceendpoint. +### [Use-CrmImpersonatedUser](Use-CrmImpersonatedUser.md) +Set the user to impersonate in the session context. All following request will be impersonated. + ### [Use-CrmLanguage](Use-CrmLanguage.md) Set the active language to use in the PowerShell session.