Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlDatabaseObjectPermission: Fixing issue with INSERT permissions #2007

Merged
merged 18 commits into from
May 12, 2024
Merged

SqlDatabaseObjectPermission: Fixing issue with INSERT permissions #2007

merged 18 commits into from
May 12, 2024

Conversation

markaugust
Copy link
Contributor

@markaugust markaugust commented May 2, 2024

Pull Request (PR) description

This Pull Request (PR) fixes the following issues

Adding a foreach loop when checking object permissions to avoid issues with INSERT permissions

Task list

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (if applicable).
  • Resource documentation updated in the resource's README.md.
  • Resource parameter descriptions updated in schema.mof.
  • Comment-based help updated, including parameter descriptions.
  • Localization strings updated.
  • Examples updated.
  • Unit tests updated. See DSC Community Testing Guidelines.
  • Integration tests updated (where possible). See DSC Community Testing Guidelines.
  • Code changes adheres to DSC Community Style Guidelines.

This change is Reviewable

@markaugust markaugust marked this pull request as ready for review May 2, 2024 19:43
@markaugust markaugust requested review from johlju and a team as code owners May 2, 2024 19:43
Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94%. Comparing base (a5c29fe) to head (d926778).

Additional details and impacted files

Impacted file tree graph

@@         Coverage Diff          @@
##           main   #2007   +/-   ##
====================================
  Coverage    94%     94%           
====================================
  Files        94      94           
  Lines      7919    7920    +1     
====================================
+ Hits       7489    7490    +1     
  Misses      430     430           
Flag Coverage Δ
unit 94% <100%> (+<1%) ⬆️
Files Coverage Δ
...ectPermission/DSC_SqlDatabaseObjectPermission.psm1 100% <100%> (ø)

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 3 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @markaugust)


tests/Unit/DSC_SqlDatabaseObjectPermission.Tests.ps1 line 160 at r2 (raw file):

            }

            Mock -CommandName Get-DatabaseObject -MockWith {

This mock should be updated to mimic the types that is returned when INSERT is used. Looks like IList in the issue? Then this test should fail without the suggested change, and tests should pass with the suggested change.
Do you have time to look into a changing the mock?

@johlju johlju added the waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. label May 5, 2024
@markaugust
Copy link
Contributor Author

@johlju I'm not familiar enough with Mocks and Unit test to know exactly what needs to be done here. Looking at the code block, I made some changes to the unit test, but let me know if that's not what you were meaning.

@markaugust markaugust marked this pull request as draft May 9, 2024 17:13
@markaugust markaugust marked this pull request as ready for review May 10, 2024 13:17
@markaugust markaugust requested a review from johlju May 10, 2024 21:10
@johlju johlju added needs review The pull request needs a code review. and removed waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. labels May 11, 2024
@johlju
Copy link
Member

johlju commented May 11, 2024

I will review this PR as soon as I have time. Will look over the changes to the test you made. Good work!

@johlju
Copy link
Member

johlju commented May 12, 2024

Unit tests looks okay, it correctly fails without the proposed change. I push a change to the integration test to try to mimic the scenario in the issue.

Copy link
Member

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @markaugust)

@johlju johlju merged commit d806199 into dsccommunity:main May 12, 2024
43 of 44 checks passed
@johlju johlju removed the needs review The pull request needs a code review. label May 12, 2024
@johlju
Copy link
Member

johlju commented May 12, 2024

@markaugust great work on this!

@markaugust markaugust deleted the sqldatabaseobjectpermission_fixing_insert branch May 13, 2024 13:27
@markaugust
Copy link
Contributor Author

Thank you @johlju . Out of curiosity, is there a timeline on when those fixes will get moved into a full release branch, rather than just in a preview branch?

@johlju
Copy link
Member

johlju commented May 16, 2024

Usually when we (community) feel there should be a new full release. I pushed a release tag now, so should release if pipeline don't fail 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants