2 // System.Security.AccessControl.QualifiedAce implementation
5 // Dick Porter <dick@ximian.com>
6 // Atsushi Enomoto <atsushi@ximian.com>
9 // Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 namespace System.Security.AccessControl {
32 public abstract class QualifiedAce : KnownAce
34 private byte [] opaque;
36 internal QualifiedAce (AceType type, AceFlags flags,
43 internal QualifiedAce (byte[] binaryForm, int offset)
44 : base(binaryForm, offset)
48 public AceQualifier AceQualifier {
52 case AceType.AccessAllowed:
53 case AceType.AccessAllowedCallback:
54 case AceType.AccessAllowedCallbackObject:
55 case AceType.AccessAllowedCompound:
56 case AceType.AccessAllowedObject:
57 return AceQualifier.AccessAllowed;
59 case AceType.AccessDenied:
60 case AceType.AccessDeniedCallback:
61 case AceType.AccessDeniedCallbackObject:
62 case AceType.AccessDeniedObject:
63 return AceQualifier.AccessDenied;
65 case AceType.SystemAlarm:
66 case AceType.SystemAlarmCallback:
67 case AceType.SystemAlarmCallbackObject:
68 case AceType.SystemAlarmObject:
69 return AceQualifier.SystemAlarm;
71 case AceType.SystemAudit:
72 case AceType.SystemAuditCallback:
73 case AceType.SystemAuditCallbackObject:
74 case AceType.SystemAuditObject:
75 return AceQualifier.SystemAudit;
78 throw new ArgumentException("Unrecognised ACE type: " + AceType);
83 public bool IsCallback {
85 return AceType == AceType.AccessAllowedCallback
86 || AceType == AceType.AccessAllowedCallbackObject
87 || AceType == AceType.AccessDeniedCallback
88 || AceType == AceType.AccessDeniedCallbackObject
89 || AceType == AceType.SystemAlarmCallback
90 || AceType == AceType.SystemAlarmCallbackObject
91 || AceType == AceType.SystemAuditCallback
92 || AceType == AceType.SystemAuditCallbackObject;
96 public int OpaqueLength {
100 return opaque.Length;
104 public byte[] GetOpaque ()
108 return (byte []) opaque.Clone();
111 public void SetOpaque (byte[] opaque)
116 this.opaque = (byte []) opaque.Clone();