Skip to content

Commit

Permalink
SqlPermission: Permission parameter should be mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
Wahidalam committed Jul 4, 2022
1 parent c71947e commit 0738053
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
the maximum memory is not specified.
- In a certain scenario the maximum memory would be enforced even if it was
not specified in the configuration.
- SqlPermission
- The `Permission` parameter is now mandatory for all `*-TargetResource`
([issue #1761](https://github.com/dsccommunity/SqlServerDsc/issues/1761)).
- SqlWindowsFirewall
- Now the variables in `Get-TargetResource` are correctly initialized so
they pass the new unit test that use strict mode.
Expand Down
6 changes: 3 additions & 3 deletions source/DSCResources/DSC_SqlPermission/DSC_SqlPermission.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Get-TargetResource
[System.String]
$Principal,

[Parameter()]
[Parameter(Mandatory = $true)]
[ValidateSet('ConnectSql', 'AlterAnyAvailabilityGroup', 'ViewServerState', 'AlterAnyEndPoint')]
[System.String[]]
$Permission
Expand Down Expand Up @@ -140,7 +140,7 @@ function Set-TargetResource
[System.String]
$Principal,

[Parameter()]
[Parameter(Mandatory = $true)]
[ValidateSet('ConnectSql', 'AlterAnyAvailabilityGroup', 'ViewServerState', 'AlterAnyEndPoint')]
[System.String[]]
$Permission
Expand Down Expand Up @@ -238,7 +238,7 @@ function Test-TargetResource
[System.String]
$Principal,

[Parameter()]
[Parameter(Mandatory = $true)]
[ValidateSet('ConnectSql', 'AlterAnyAvailabilityGroup', 'ViewServerState', 'AlterAnyEndPoint')]
[System.String[]]
$Permission
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ class DSC_SqlPermission : OMI_BaseResource
[Write, Description("The host name of the _SQL Server_ to be configured. Default value is the current computer name.")] String ServerName;
[Write, Description("If the permission should be present or absent. Default value is `'Present'`."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Key, Description("The login to which permission will be set.")] String Principal;
[Write, Description("The permission to set for the login."), ValueMap{"ConnectSql","AlterAnyAvailabilityGroup","ViewServerState","AlterAnyEndPoint"}, Values{"ConnectSql","AlterAnyAvailabilityGroup","ViewServerState","AlterAnyEndPoint"}] String Permission[];
[Required, Description("The permission to set for the login."), ValueMap{"ConnectSql","AlterAnyAvailabilityGroup","ViewServerState","AlterAnyEndPoint"}, Values{"ConnectSql","AlterAnyAvailabilityGroup","ViewServerState","AlterAnyEndPoint"}] String Permission[];
};

0 comments on commit 0738053

Please sign in to comment.