-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #3554 update windows preflight check for user in required groups
remove the username from Get-LocalGroupMember cmdlet and get the list of users belonging to group and perform string comparison to determine if current user is part of the group this should work around the need to supply the username with or without the domain part depending on whether the machine was currently domain joined
- Loading branch information
Showing
2 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package preflight | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestUserInMemberList(t *testing.T) { | ||
members := `DESKTOP-R05QDNL\someUser1 | ||
DESKTOP-R05QDNL\someUser2 | ||
NT AUTHORITY\INTERACTIVE | ||
DESKTOP-G7H96M0\crc` | ||
|
||
tests := []struct { | ||
username string | ||
expected bool | ||
}{ | ||
{`some`, false}, | ||
{`DESKTOP-G7H96M0\someUser1`, false}, | ||
{`DESK`, false}, | ||
{`someUser2`, true}, | ||
{`crc`, true}, | ||
} | ||
|
||
for _, tt := range tests { | ||
assert.Equal(t, tt.expected, usernameInMembersList(tt.username, members)) | ||
} | ||
} |