2008-07-13 Nestor Salceda <nestor.salceda@gmail.com>
[mono.git] / mcs / class / corlib / System.Security.AccessControl / CommonAcl.cs
index 48454e10707cf4725328020e31ae583d3f688da3..76a544800e87c100cabc5ce8ea4c0fa856353716 100644 (file)
@@ -1,10 +1,11 @@
 //
 // System.Security.AccessControl.CommonAcl implementation
 //
-// Author:
+// Authors:
 //     Dick Porter  <dick@ximian.com>
+//     Atsushi Enomoto  <atsushi@ximian.com>
 //
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -28,6 +29,7 @@
 
 #if NET_2_0
 
+using System.Collections.Generic;
 using System.Security.Principal;
 
 namespace System.Security.AccessControl {
@@ -36,69 +38,77 @@ namespace System.Security.AccessControl {
         */
        public abstract class CommonAcl : GenericAcl
        {
-               public override sealed int BinaryLength
+               const int default_capacity = 10; // FIXME: not verified
+
+               internal CommonAcl (bool isContainer, bool isDS, byte revision)
+                       : this (isContainer, isDS, revision, default_capacity)
                {
-                       get {
-                               throw new NotImplementedException ();
-                       }
                }
 
-               public override sealed int Count
+               internal CommonAcl (bool isContainer, bool isDS, byte revision, int capacity)
                {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+                       this.is_container = isContainer;
+                       this.is_ds = isDS;
+                       this.revision = revision;
+                       list = new List<GenericAce> (capacity);
                }
-               
-               public bool IsCanonical
+
+               bool is_container, is_ds;
+               byte revision;
+               List<GenericAce> list;
+
+               [MonoTODO]
+               public override sealed int BinaryLength
                {
                        get {
                                throw new NotImplementedException ();
                        }
                }
 
-               public bool IsContainer
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+               public override sealed int Count {
+                       get { return list.Count; }
                }
-               
-               public bool IsDS
+
+               [MonoTODO]
+               public bool IsCanonical
                {
                        get {
                                throw new NotImplementedException ();
                        }
                }
+
+               public bool IsContainer {
+                       get { return is_container; }
+               }
                
+               public bool IsDS {
+                       get { return is_ds; }
+               }
+
                public override sealed GenericAce this[int index]
                {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-                       set {
-                               throw new NotImplementedException ();
-                       }
+                       get { return list [index]; }
+                       set { list [index] = value; }
                }
                
-               public override sealed byte Revision
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
+               public override sealed byte Revision {
+                       get { return revision; }
                }
                
+               [MonoTODO]
                public override sealed void GetBinaryForm (byte[] binaryForm,
                                                           int offset)
                {
                        throw new NotImplementedException ();
                }
                
+               [MonoTODO]
                public void Purge (SecurityIdentifier sid)
                {
                        throw new NotImplementedException ();
                }
 
+               [MonoTODO]
                public void RemoveInheritedAces ()
                {
                        throw new NotImplementedException ();