aboutsummaryrefslogtreecommitdiff
path: root/src/test/burn
diff options
context:
space:
mode:
authorBevan Weiss <bevan.weiss@gmail.com>2024-07-06 21:03:57 +1000
committerRob Mensching <rob@firegiant.com>2025-02-11 23:14:49 -0800
commit644276562dcadd65fcb0e9a7c06c704cdda36423 (patch)
treef42af115bf5354d1c1691c44d517388f6c369b16 /src/test/burn
parent7b1bb025dea1d1e9e144cce0dcbba2d86f053b8f (diff)
downloadwix-644276562dcadd65fcb0e9a7c06c704cdda36423.tar.gz
wix-644276562dcadd65fcb0e9a7c06c704cdda36423.tar.bz2
wix-644276562dcadd65fcb0e9a7c06c704cdda36423.zip
Group Add/Remove working.
Local group membership Add/Remove working, however with BUILTIN local system groups .NET doesn't appear to locate them as either groups nor basic security Principals. Still needs work to fix the test for nested groups. Ideally with some way to test for domain groups. Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
Diffstat (limited to 'src/test/burn')
-rw-r--r--src/test/burn/WixTestTools/UserGroupVerifier.cs24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/test/burn/WixTestTools/UserGroupVerifier.cs b/src/test/burn/WixTestTools/UserGroupVerifier.cs
index 2f874057..52a1a6bf 100644
--- a/src/test/burn/WixTestTools/UserGroupVerifier.cs
+++ b/src/test/burn/WixTestTools/UserGroupVerifier.cs
@@ -151,7 +151,7 @@ namespace WixTestTools
151 /// <param name="groupNames">list of groups to check for membership</param> 151 /// <param name="groupNames">list of groups to check for membership</param>
152 private static void IsMemberOf(string domainName, string memberName, bool shouldBeMember, params string[] groupNames) 152 private static void IsMemberOf(string domainName, string memberName, bool shouldBeMember, params string[] groupNames)
153 { 153 {
154 GroupPrincipal group = GetGroup(domainName, memberName); 154 Principal group = GetPrincipal(domainName, memberName);
155 Assert.False(null == group, String.Format("Group '{0}' was not found under domain '{1}'.", memberName, domainName)); 155 Assert.False(null == group, String.Format("Group '{0}' was not found under domain '{1}'.", memberName, domainName));
156 156
157 bool missedAGroup = false; 157 bool missedAGroup = false;
@@ -186,11 +186,29 @@ namespace WixTestTools
186 { 186 {
187 if (String.IsNullOrEmpty(domainName)) 187 if (String.IsNullOrEmpty(domainName))
188 { 188 {
189 return GroupPrincipal.FindByIdentity(new PrincipalContext(ContextType.Machine), IdentityType.Name, groupName); 189 return GroupPrincipal.FindByIdentity(new PrincipalContext(ContextType.Machine), groupName);
190 } 190 }
191 else 191 else
192 { 192 {
193 return GroupPrincipal.FindByIdentity(new PrincipalContext(ContextType.Domain,domainName), IdentityType.Name, groupName); 193 return GroupPrincipal.FindByIdentity(new PrincipalContext(ContextType.Domain,domainName), groupName);
194 }
195 }
196
197 /// <summary>
198 /// Returns the Principal object for a given name
199 /// </summary>
200 /// <param name="domainName">Domain name to look under, if Empty the LocalMachine is assumed as the domain</param>
201 /// <param name="name"></param>
202 /// <returns>Principal Object if found, or null other wise</returns>
203 private static Principal GetPrincipal(string domainName, string name)
204 {
205 if (String.IsNullOrEmpty(domainName))
206 {
207 return Principal.FindByIdentity(new PrincipalContext(ContextType.Machine), name);
208 }
209 else
210 {
211 return Principal.FindByIdentity(new PrincipalContext(ContextType.Domain, domainName), name);
194 } 212 }
195 } 213 }
196 } 214 }