aboutsummaryrefslogtreecommitdiff
path: root/src/test
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
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')
-rw-r--r--src/test/burn/WixTestTools/UserGroupVerifier.cs24
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs2
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs2
-rw-r--r--src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs6
-rw-r--r--src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs8
5 files changed, 29 insertions, 13 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 }
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs
index 29b908da..4e70717f 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductCommentFail/product_fail.wxs
@@ -8,7 +8,7 @@
8 </ComponentGroup> 8 </ComponentGroup>
9 9
10 <InstallExecuteSequence> 10 <InstallExecuteSequence>
11 <Custom Action="CaFail" After="Wix4ConfigureGroups_X86" /> 11 <Custom Action="CaFail" After="Wix6ConfigureGroups_X86" />
12 </InstallExecuteSequence> 12 </InstallExecuteSequence>
13 </Fragment> 13 </Fragment>
14 14
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs
index fb35bc1e..3013e5a0 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductFail/product_fail.wxs
@@ -11,7 +11,7 @@
11 <Property Id="TEMPUSERNAME" Secure="yes" /> 11 <Property Id="TEMPUSERNAME" Secure="yes" />
12 12
13 <InstallExecuteSequence> 13 <InstallExecuteSequence>
14 <Custom Action="CaFail" After="Wix4ConfigureGroups_X86" /> 14 <Custom Action="CaFail" After="Wix6ConfigureGroups_X86" />
15 </InstallExecuteSequence> 15 </InstallExecuteSequence>
16 </Fragment> 16 </Fragment>
17 17
diff --git a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs
index 191d605c..15328cb3 100644
--- a/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs
+++ b/src/test/msi/TestData/UtilExtensionGroupTests/ProductNestedGroups/product.wxs
@@ -12,11 +12,11 @@
12 </Fragment> 12 </Fragment>
13 13
14 <Fragment> 14 <Fragment>
15 <util:Group Id="ADMIN" Name="Administrators" > 15 <util:Group Id="AUTH_USERS" Name="Authenticated Users" >
16 <util:GroupRef Id="TEST_GROUP1" /> 16 <util:GroupRef Id="TEST_GROUP1" />
17 <util:GroupRef Id="TEST_GROUP2" /> 17 <util:GroupRef Id="TEST_GROUP2" />
18 </util:Group> 18 </util:Group>
19 <util:Group Id="POWER_USERS" Name="Power Users" > 19 <util:Group Id="EVERYONE" Name="Everyone" >
20 <util:GroupRef Id="TEST_GROUP1" /> 20 <util:GroupRef Id="TEST_GROUP1" />
21 </util:Group> 21 </util:Group>
22 22
@@ -26,8 +26,6 @@
26 <util:Group Id="TEST_GROUP1" Name="testName1" Comment="Group1" CreateGroup="yes" RemoveOnUninstall="yes" /> 26 <util:Group Id="TEST_GROUP1" Name="testName1" Comment="Group1" CreateGroup="yes" RemoveOnUninstall="yes" />
27 27
28 <util:Group Id="TEST_GROUP2" Name="testName2" Comment="Group2" RemoveOnUninstall="no" UpdateIfExists="yes" /> 28 <util:Group Id="TEST_GROUP2" Name="testName2" Comment="Group2" RemoveOnUninstall="no" UpdateIfExists="yes" />
29
30 <util:Group Id="TEST_GROUP3" Name="testName3" Comment="Group3" />
31 </Component> 29 </Component>
32 </Fragment> 30 </Fragment>
33</Wix> 31</Wix>
diff --git a/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs b/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs
index 796c4ecd..d7cf3168 100644
--- a/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs
+++ b/src/test/msi/WixToolsetTest.MsiE2E/UtilExtensionGroupTests.cs
@@ -256,11 +256,11 @@ namespace WixToolsetTest.MsiE2E
256 productNestedGroups.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); 256 productNestedGroups.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS);
257 257
258 // Verify group nested membership 258 // Verify group nested membership
259 UserGroupVerifier.VerifyIsMemberOf(String.Empty, "Administrators", new string[] { "testName1", "testName2" }); 259 UserGroupVerifier.VerifyIsMemberOf(String.Empty, "Authenticated Users", new string[] { "testName1", "testName2" });
260 UserGroupVerifier.VerifyIsMemberOf(String.Empty, "Power Users", new string[] { "testName1" }); 260 UserGroupVerifier.VerifyIsMemberOf(String.Empty, "Everyone", new string[] { "testName1" });
261 261
262 UserGroupVerifier.VerifyIsNotMemberOf(String.Empty, "Administrators", new string[] { "testName3" }); 262 UserGroupVerifier.VerifyIsNotMemberOf(String.Empty, "Authenticated Users", new string[] { "testName3" });
263 UserGroupVerifier.VerifyIsNotMemberOf(String.Empty, "Power Users", new string[] { "testName2", "testName3" }); 263 UserGroupVerifier.VerifyIsNotMemberOf(String.Empty, "Everyone", new string[] { "testName2", "testName3" });
264 264
265 // clean up 265 // clean up
266 UserGroupVerifier.DeleteLocalGroup("testName1"); 266 UserGroupVerifier.DeleteLocalGroup("testName1");