Closed michaeltlombardi closed 8 years ago
It's a bit goofy, adding these tests, since it required adding a type into the public function. I reduced the surface area by chopping out all of the references I found to modifying the user rights assignments, leaving the ability only to retrieve them, never to modify them via tests.
VSCode can only do code folding via indentation so it looks a mess. I can refactor to use a separate private file if you want.
If it isn't a function a user would include in their tests, it should probably be in Private, but I think this is another very useful addition.
I don't think users would access the functions or type directly; if they were going to do so, they'd probably want the full script/module and be able to set user rights as well as retrieve them.
Refactoring this to point to a private file containing the functions and type would definitely make UserRightsAssignment.ps1
cleaner to read at the minor expense of having to include an additional private file for one test.
Other tests (AuditPolicy
and Volume
) currently have private functions included inside them to make the expression itself less convoluted.
@cdhunt: Refactored to use private functions/cleaner coding.
@cdhunt: Is anything further required to get this merged?
No, I can merge it, however, I'm still looking at issues in some other areas before I publish a new version.
No worries - anything I can help with?
Test-RunAsAdmin
, closes Ticketmaster/poshspec#37Test-RunAsAdmin
private function.Get-AccountsWithUserRight
andGet-UserRightsGrantedToAccount
as well as the private type PS_LSA into a file in the private folder of the project, making UserRightsAssignment more readable/maintainable.