| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Util |
| 4 | { |
| 5 | using WixToolset.Data; |
| 6 | using WixToolset.Util.Symbols; |
| 7 | |
| 8 | public static partial class UtilSymbolDefinitions |
| 9 | { |
| 10 | public static readonly IntermediateSymbolDefinition SecureObjects = new IntermediateSymbolDefinition( |
| 11 | UtilSymbolDefinitionType.SecureObjects.ToString(), |
| 12 | new[] |
| 13 | { |
| 14 | new IntermediateFieldDefinition(nameof(SecureObjectsSymbolFields.SecureObject), IntermediateFieldType.String), |
| 15 | new IntermediateFieldDefinition(nameof(SecureObjectsSymbolFields.Table), IntermediateFieldType.String), |
| 16 | new IntermediateFieldDefinition(nameof(SecureObjectsSymbolFields.Domain), IntermediateFieldType.String), |
| 17 | new IntermediateFieldDefinition(nameof(SecureObjectsSymbolFields.User), IntermediateFieldType.String), |
| 18 | new IntermediateFieldDefinition(nameof(SecureObjectsSymbolFields.Attributes), IntermediateFieldType.Number), |
| 19 | new IntermediateFieldDefinition(nameof(SecureObjectsSymbolFields.Permission), IntermediateFieldType.Number), |
| 20 | new IntermediateFieldDefinition(nameof(SecureObjectsSymbolFields.ComponentRef), IntermediateFieldType.String), |
| 21 | }, |
| 22 | typeof(SecureObjectsSymbol)); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | namespace WixToolset.Util.Symbols |
| 27 | { |
| 28 | using System; |
| 29 | using WixToolset.Data; |
| 30 | |
| 31 | public enum SecureObjectsSymbolFields |
| 32 | { |
| 33 | SecureObject, |
| 34 | Table, |
| 35 | Domain, |
| 36 | User, |
| 37 | Attributes, |
| 38 | Permission, |
| 39 | ComponentRef, |
| 40 | } |
| 41 | |
| 42 | [Flags] |
| 43 | public enum WixPermissionExAttributes |
| 44 | { |
| 45 | None = 0x0, |
| 46 | Inheritable = 0x01 |
| 47 | } |
| 48 | |
| 49 | public class SecureObjectsSymbol : IntermediateSymbol |
| 50 | { |
| 51 | public SecureObjectsSymbol() : base(UtilSymbolDefinitions.SecureObjects, null, null) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | public SecureObjectsSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(UtilSymbolDefinitions.SecureObjects, sourceLineNumber, id) |
| 56 | { |
| 57 | } |
| 58 | |
| 59 | public IntermediateField this[SecureObjectsSymbolFields index] => this.Fields[(int)index]; |
| 60 | |
| 61 | public string SecureObject |
| 62 | { |
| 63 | get => this.Fields[(int)SecureObjectsSymbolFields.SecureObject].AsString(); |
| 64 | set => this.Set((int)SecureObjectsSymbolFields.SecureObject, value); |
| 65 | } |
| 66 | |
| 67 | public string Table |
| 68 | { |
| 69 | get => this.Fields[(int)SecureObjectsSymbolFields.Table].AsString(); |
| 70 | set => this.Set((int)SecureObjectsSymbolFields.Table, value); |
| 71 | } |
| 72 | |
| 73 | public string Domain |
| 74 | { |
| 75 | get => this.Fields[(int)SecureObjectsSymbolFields.Domain].AsString(); |
| 76 | set => this.Set((int)SecureObjectsSymbolFields.Domain, value); |
| 77 | } |
| 78 | |
| 79 | public string User |
| 80 | { |
| 81 | get => this.Fields[(int)SecureObjectsSymbolFields.User].AsString(); |
| 82 | set => this.Set((int)SecureObjectsSymbolFields.User, value); |
| 83 | } |
| 84 | |
| 85 | public WixPermissionExAttributes Attributes |
| 86 | { |
| 87 | get => (WixPermissionExAttributes)this.Fields[(int)SecureObjectsSymbolFields.Attributes].AsNumber(); |
| 88 | set => this.Set((int)SecureObjectsSymbolFields.Attributes, (int)value); |
| 89 | } |
| 90 | |
| 91 | public int? Permission |
| 92 | { |
| 93 | get => this.Fields[(int)SecureObjectsSymbolFields.Permission].AsNullableNumber(); |
| 94 | set => this.Set((int)SecureObjectsSymbolFields.Permission, value); |
| 95 | } |
| 96 | |
| 97 | public string ComponentRef |
| 98 | { |
| 99 | get => this.Fields[(int)SecureObjectsSymbolFields.ComponentRef].AsString(); |
| 100 | set => this.Set((int)SecureObjectsSymbolFields.ComponentRef, value); |
| 101 | } |
| 102 | } |
| 103 | } |