Skip to content

Commit a2ec8dc

Browse files
authored
Set-SqlDscServerPermission: Refactor to set exact permission (#2361)
1 parent d621ea4 commit a2ec8dc

File tree

6 files changed

+1030
-851
lines changed

6 files changed

+1030
-851
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
### Added
99

10+
- `Set-SqlDscServerPermission`
11+
- Added integration tests for negative test scenarios including invalid
12+
permission names and non-existent principals.
1013
- `SqlPermission`
1114
- Added integration tests for server role permissions to complement the
1215
existing login permission tests.
@@ -38,6 +41,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3841
and server roles as principals.
3942
- Added a note in documentation clarifying that if a name exists as both
4043
a login and a server role, the login will take precedence.
44+
- BREAKING CHANGE: `Set-SqlDscServerPermission`
45+
- Completely refactored to set exact server permissions for a principal. The
46+
command now accepts Login or ServerRole objects (same as `Grant-SqlDscServerPermission`,
47+
`Deny-SqlDscServerPermission`, and `Revoke-SqlDscServerPermission`) and uses
48+
`-Grant`, `-GrantWithGrant`, and `-Deny` parameters to specify the exact
49+
permissions that should exist within each specified category. Within a
50+
specified category, any existing permissions not listed are revoked;
51+
categories not specified are left unchanged. The command internally uses
52+
`Get-SqlDscServerPermission`, `Grant-SqlDscServerPermission`,
53+
`Deny-SqlDscServerPermission`, and `Revoke-SqlDscServerPermission` to
54+
achieve this
55+
([issue #2159](https://github.com/dsccommunity/SqlServerDsc/issues/2159)).
4156
- Updated comment-based help `.INPUTS` and `.OUTPUTS` sections across all public
4257
commands and private functions to comply with DSC community style guidelines
4358
([issue #2103](https://github.com/dsccommunity/SqlServerDsc/issues/2103)).
@@ -47,6 +62,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4762

4863
### Fixed
4964

65+
- `Set-SqlDscServerPermission`
66+
- Fixed an issue where unspecified permission parameters would incorrectly
67+
revoke existing permissions. The command now only processes permission
68+
categories that are explicitly specified via parameters. For example,
69+
specifying only `-Grant @()` will now correctly revoke only Grant permissions
70+
while leaving GrantWithGrant and Deny permissions unchanged
71+
([issue #2159](https://github.com/dsccommunity/SqlServerDsc/issues/2159)).
5072
- `New-SqlDscDatabase`
5173
- Fixed parameter types for database-scoped configuration properties from
5274
`System.Boolean` to `Microsoft.SqlServer.Management.Smo.DatabaseScopedConfigurationOnOff`

0 commit comments

Comments
 (0)