protected void RemovePermissionAccess(ResourcePermissionBaseEntry entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }
            if (entry.PermissionAccessPath.Length != this.TagNames.Length)
            {
                throw new InvalidOperationException(SR.GetString("PermissionNumberOfElements"));
            }
            Hashtable rootTable = this.rootTable;

            string[] permissionAccessPath = entry.PermissionAccessPath;
            for (int i = 0; i < permissionAccessPath.Length; i++)
            {
                if ((rootTable == null) || !rootTable.ContainsKey(permissionAccessPath[i]))
                {
                    throw new InvalidOperationException(SR.GetString("PermissionItemDoesntExist"));
                }
                Hashtable hashtable2 = rootTable;
                if (i < (permissionAccessPath.Length - 1))
                {
                    rootTable = (Hashtable)rootTable[permissionAccessPath[i]];
                    if (rootTable.Count == 1)
                    {
                        hashtable2.Remove(permissionAccessPath[i]);
                    }
                }
                else
                {
                    rootTable = null;
                    hashtable2.Remove(permissionAccessPath[i]);
                }
            }
        }
Exemple #2
0
 // Get the permission entries in this object.
 protected ResourcePermissionBaseEntry[] GetPermissionEntries()
 {
     ResourcePermissionBaseEntry[] array;
     array = new ResourcePermissionBaseEntry [permissions.Count];
     permissions.CopyTo(array, 0);
     return(array);
 }
        public override void FromXml(SecurityElement securityElement)
        {
            if (securityElement == null)
            {
                throw new ArgumentNullException("securityElement");
            }

#if !BOOTSTRAP_BASIC
            CheckSecurityElement(securityElement, "securityElement", version, version);
            // Note: we do not (yet) care about the return value
            // as we only accept version 1 (min/max values)
#endif

            _list.Clear();
            _unrestricted = PermissionHelper.IsUnrestricted(securityElement);
            if ((securityElement.Children == null) || (securityElement.Children.Count < 1))
            {
                return;
            }

            string[] names = new string [1];
            foreach (SecurityElement child in securityElement.Children)
            {
                // TODO: handle multiple names
                names [0] = child.Attribute("name");
                int access = (int)Enum.Parse(PermissionAccessType, child.Attribute("access"));
                ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry(access, names);
                AddPermissionAccess(entry);
            }
        }
 protected void AddPermissionAccess(ResourcePermissionBaseEntry entry)
 {
     if (entry == null)
     {
         throw new ArgumentNullException("entry");
     }
     if (entry.PermissionAccessPath.Length != this.TagNames.Length)
     {
         throw new InvalidOperationException(SR.GetString("PermissionNumberOfElements"));
     }
     Hashtable rootTable = this.rootTable;
     string[] permissionAccessPath = entry.PermissionAccessPath;
     for (int i = 0; i < (permissionAccessPath.Length - 1); i++)
     {
         if (rootTable.ContainsKey(permissionAccessPath[i]))
         {
             rootTable = (Hashtable) rootTable[permissionAccessPath[i]];
         }
         else
         {
             Hashtable hashtable2 = CreateHashtable();
             rootTable[permissionAccessPath[i]] = hashtable2;
             rootTable = hashtable2;
         }
     }
     if (rootTable.ContainsKey(permissionAccessPath[permissionAccessPath.Length - 1]))
     {
         throw new InvalidOperationException(SR.GetString("PermissionItemExists"));
     }
     rootTable[permissionAccessPath[permissionAccessPath.Length - 1]] = entry.PermissionAccess;
 }
        private ResourcePermissionBaseEntry[] GetChildrenAccess(object currentContent, int tagIndex)
        {
            IDictionaryEnumerator enumerator = ((Hashtable)currentContent).GetEnumerator();
            ArrayList             list       = new ArrayList();

            while (enumerator.MoveNext())
            {
                if (tagIndex < (this.TagNames.Length - 1))
                {
                    ResourcePermissionBaseEntry[] childrenAccess = this.GetChildrenAccess(enumerator.Value, tagIndex + 1);
                    for (int i = 0; i < childrenAccess.Length; i++)
                    {
                        childrenAccess[i].PermissionAccessPath[tagIndex] = (string)enumerator.Key;
                    }
                    list.AddRange(childrenAccess);
                }
                else
                {
                    ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry((int)enumerator.Value, new string[this.TagNames.Length]);
                    entry.PermissionAccessPath[tagIndex] = (string)enumerator.Key;
                    list.Add(entry);
                }
            }
            return((ResourcePermissionBaseEntry[])list.ToArray(typeof(ResourcePermissionBaseEntry)));
        }
        protected void AddPermissionAccess(ResourcePermissionBaseEntry entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }
            if (entry.PermissionAccessPath.Length != this.TagNames.Length)
            {
                throw new InvalidOperationException(SR.GetString("PermissionNumberOfElements"));
            }
            Hashtable rootTable = this.rootTable;

            string[] permissionAccessPath = entry.PermissionAccessPath;
            for (int i = 0; i < (permissionAccessPath.Length - 1); i++)
            {
                if (rootTable.ContainsKey(permissionAccessPath[i]))
                {
                    rootTable = (Hashtable)rootTable[permissionAccessPath[i]];
                }
                else
                {
                    Hashtable hashtable2 = CreateHashtable();
                    rootTable[permissionAccessPath[i]] = hashtable2;
                    rootTable = hashtable2;
                }
            }
            if (rootTable.ContainsKey(permissionAccessPath[permissionAccessPath.Length - 1]))
            {
                throw new InvalidOperationException(SR.GetString("PermissionItemExists"));
            }
            rootTable[permissionAccessPath[permissionAccessPath.Length - 1]] = entry.PermissionAccess;
        }
 internal EventLogPermissionEntryCollection(EventLogPermission owner, ResourcePermissionBaseEntry[] entries)
 {
     this.owner = owner;
     for (int i = 0; i < entries.Length; i++)
     {
         base.InnerList.Add(new EventLogPermissionEntry(entries[i]));
     }
 }
 internal ServiceControllerPermissionEntryCollection(ServiceControllerPermission owner, ResourcePermissionBaseEntry[] entries)
 {
     this.owner = owner;
     for (int i = 0; i < entries.Length; i++)
     {
         base.InnerList.Add(new ServiceControllerPermissionEntry(entries[i]));
     }
 }
		protected void AddPermissionAccess (ResourcePermissionBaseEntry entry)
		{
			CheckEntry (entry);
			if (Exists (entry)) {
				string msg = Locale.GetText ("Entry already exists.");
				throw new InvalidOperationException (msg);
			}

			_list.Add (entry);
		}
        protected void AddPermissionAccess(ResourcePermissionBaseEntry entry)
        {
            CheckEntry(entry);
            if (Exists(entry))
            {
                string msg = Locale.GetText("Entry already exists.");
                throw new InvalidOperationException(msg);
            }

            _list.Add(entry);
        }
 internal void CheckEntry(ResourcePermissionBaseEntry entry)
 {
     if (entry == null)
     {
         throw new ArgumentNullException("entry");
     }
     if ((entry.PermissionAccessPath == null) || (entry.PermissionAccessPath.Length != _tags.Length))
     {
         string msg = Locale.GetText("Entry doesn't match TagNames");
         throw new InvalidOperationException(msg);
     }
 }
Exemple #12
0
 // Determine if a particular entry is in this permission set.
 private bool Contains(ResourcePermissionBaseEntry entry)
 {
     foreach (ResourcePermissionBaseEntry e in permissions)
     {
         if (String.Compare(e.StringPath, entry.StringPath, true)
             == 0)
         {
             return(true);
         }
     }
     return(false);
 }
 internal bool Exists(ResourcePermissionBaseEntry entry)
 {
     if (_list.Count == 0)
     {
         return(false);
     }
     foreach (ResourcePermissionBaseEntry rpbe in _list)
     {
         if (Equals(rpbe, entry))
         {
             return(true);
         }
     }
     return(false);
 }
        protected void RemovePermissionAccess(ResourcePermissionBaseEntry entry)
        {
            CheckEntry(entry);
            for (int i = 0; i < _list.Count; i++)
            {
                ResourcePermissionBaseEntry rpbe = (ResourcePermissionBaseEntry)_list [i];
                if (Equals(entry, rpbe))
                {
                    _list.RemoveAt(i);
                    return;
                }
            }
            string msg = Locale.GetText("Entry doesn't exists.");

            throw new InvalidOperationException(msg);
        }
Exemple #15
0
 // Remove a permission entry from this object.
 protected void RemovePermissionAccess(ResourcePermissionBaseEntry entry)
 {
     if (entry == null)
     {
         throw new ArgumentNullException("entry");
     }
     else if (tagNames == null ||
              entry.PermissionAccessPath.Length != tagNames.Length)
     {
         throw new InvalidOperationException
                   (S._("Invalid_PathMismatch"));
     }
     else if (!permissions.Contains(entry))
     {
         throw new InvalidOperationException
                   (S._("Invalid_PermissionNotPresent"));
     }
     permissions.Remove(entry);
 }
 internal bool Equals(ResourcePermissionBaseEntry entry1, ResourcePermissionBaseEntry entry2)
 {
     if (entry1.PermissionAccess != entry2.PermissionAccess)
     {
         return(false);
     }
     if (entry1.PermissionAccessPath.Length != entry2.PermissionAccessPath.Length)
     {
         return(false);
     }
     for (int i = 0; i < entry1.PermissionAccessPath.Length; i++)
     {
         if (entry1.PermissionAccessPath [i] != entry2.PermissionAccessPath [i])
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #17
0
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected void RemovePermissionAccess(ResourcePermissionBaseEntry entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }

            if (entry.PermissionAccessPath.Length != this.TagNames.Length)
            {
                throw new InvalidOperationException(SR.GetString(SR.PermissionNumberOfElements));
            }

            Hashtable currentTable = this.rootTable;

            string[] accessPath = entry.PermissionAccessPath;
            for (int index = 0; index < accessPath.Length; ++index)
            {
                if (currentTable == null || !currentTable.ContainsKey(accessPath[index]))
                {
                    throw new InvalidOperationException(SR.GetString(SR.PermissionItemDoesntExist));
                }
                else
                {
                    Hashtable oldTable = currentTable;
                    if (index < accessPath.Length - 1)
                    {
                        currentTable = (Hashtable)currentTable[accessPath[index]];
                        if (currentTable.Count == 1)
                        {
                            oldTable.Remove(accessPath[index]);
                        }
                    }
                    else
                    {
                        currentTable = null;
                        oldTable.Remove(accessPath[index]);
                    }
                }
            }
        }
Exemple #18
0
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected void AddPermissionAccess(ResourcePermissionBaseEntry entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }

            if (entry.PermissionAccessPath.Length != this.TagNames.Length)
            {
                throw new InvalidOperationException(SR.GetString(SR.PermissionNumberOfElements));
            }

            Hashtable currentTable = this.rootTable;

            string[] accessPath = entry.PermissionAccessPath;
            for (int index = 0; index < accessPath.Length - 1; ++index)
            {
                if (currentTable.ContainsKey(accessPath[index]))
                {
                    currentTable = (Hashtable)currentTable[accessPath[index]];
                }
                else
                {
                    Hashtable newHashTable = CreateHashtable();
                    currentTable[accessPath[index]] = newHashTable;
                    currentTable = newHashTable;
                }
            }

            if (currentTable.ContainsKey(accessPath[accessPath.Length - 1]))
            {
                throw new InvalidOperationException(SR.GetString(SR.PermissionItemExists));
            }

            currentTable[accessPath[accessPath.Length - 1]] = entry.PermissionAccess;
        }
		public void RemovePermissionAccess_Unexisting ()
		{
			NonAbstractResourcePermissionBase rp = new NonAbstractResourcePermissionBase ();
			rp.TagNames = new string [1] { "Monkeys" };

			ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry (0, new string [1] { "Singes" });
			rp.RemovePermissionAccess (entry);
		}
		public void Copy ()
		{
			NonAbstractResourcePermissionBase rp = new NonAbstractResourcePermissionBase ();
			rp.PermissionAccessType = typeof (PermissionState);
			rp.TagNames = new string [1] { "Monkeys" };

			ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry (0, new string [1] { "Singes" });
			rp.AddPermissionAccess (entry);

			NonAbstractResourcePermissionBase copy = (NonAbstractResourcePermissionBase) rp.Copy ();
			Assert.AreEqual (typeof (PermissionState), copy.PermissionAccessType, "PermissionAccessType");
			Assert.AreEqual ("Monkeys", copy.TagNames [0], "TagNames");

			ResourcePermissionBaseEntry [] entries = copy.GetPermissionEntries ();
			Assert.AreEqual (1, entries.Length, "Count");
		}
		public void GetPermissionEntries ()
		{
			NonAbstractResourcePermissionBase rp = new NonAbstractResourcePermissionBase ();
			ResourcePermissionBaseEntry[] entries = rp.GetPermissionEntries ();
			Assert.AreEqual (0, entries.Length, "Empty");

			rp.PermissionAccessType = typeof (PermissionState);
			rp.TagNames = new string [1] { "Monkeys" };
			ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry (0, new string [1] { "Singes" });
			rp.AddPermissionAccess (entry);

			entries = rp.GetPermissionEntries ();
			Assert.AreEqual (1, entries.Length, "Count==1");

			rp.Clear ();
			entries = rp.GetPermissionEntries ();
			Assert.AreEqual (0, entries.Length, "Count==0");
		}
		public void AddPermissionAccess_Duplicates_DifferentInstances ()
		{
			NonAbstractResourcePermissionBase rp = new NonAbstractResourcePermissionBase ();
			rp.TagNames = new string [1] { "Monkeys" };
			ResourcePermissionBaseEntry entry1 = new ResourcePermissionBaseEntry (0, new string [1] { "Singes" });
			rp.AddPermissionAccess (entry1);
			ResourcePermissionBaseEntry entry2 = new ResourcePermissionBaseEntry (0, new string [1] { "Singes" });
			rp.AddPermissionAccess (entry2);
		}
		public void AddPermissionAccess_SemiDuplicates ()
		{
			NonAbstractResourcePermissionBase rp = new NonAbstractResourcePermissionBase ();
			rp.TagNames = new string [2] { "Monkeys", "Singes" };
			ResourcePermissionBaseEntry entry1 = new ResourcePermissionBaseEntry (0, new string [2] { "1", "2" });
			rp.AddPermissionAccess (entry1);
			ResourcePermissionBaseEntry entry2 = new ResourcePermissionBaseEntry (0, new string [2] { "2", "1" });
			rp.AddPermissionAccess (entry2);
		}
		public void Unrestricted_AddRemove ()
		{
			NonAbstractResourcePermissionBase rp = new NonAbstractResourcePermissionBase (PermissionState.Unrestricted);
			rp.TagNames = new string [1] { "Monkeys" };

			ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry (0, new string [1] { "Singes" });
			rp.AddPermissionAccess (entry);

			ResourcePermissionBaseEntry [] entries = rp.GetPermissionEntries ();
			Assert.AreEqual (1, entries.Length, "Count==1");

			rp.RemovePermissionAccess (entry);
			entries = rp.GetPermissionEntries ();
			Assert.AreEqual (0, entries.Length, "Count==0");
		}
		public override void FromXml (SecurityElement securityElement)
		{
			if (securityElement == null)
				throw new ArgumentNullException ("securityElement");

#if !BOOTSTRAP_BASIC				
			CheckSecurityElement (securityElement, "securityElement", version, version);
			// Note: we do not (yet) care about the return value 
			// as we only accept version 1 (min/max values)
#endif

			_list.Clear ();
			_unrestricted = PermissionHelper.IsUnrestricted (securityElement);
			if ((securityElement.Children == null) || (securityElement.Children.Count < 1))
				return;

			string[] names = new string [1];
			foreach (SecurityElement child in securityElement.Children) {
				// TODO: handle multiple names
				names [0] = child.Attribute ("name");
				int access = (int) Enum.Parse (PermissionAccessType, child.Attribute ("access"));
				ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry (access, names);
				AddPermissionAccess (entry);
			}
		}
		public new void RemovePermissionAccess (ResourcePermissionBaseEntry entry)
		{
			base.RemovePermissionAccess (entry);
		}
		public void Constructor_Null ()
		{
			ResourcePermissionBaseEntry rpbe = new ResourcePermissionBaseEntry (0, null);
		}
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected void RemovePermissionAccess(ResourcePermissionBaseEntry entry) {
            if (entry == null)
                throw new ArgumentNullException("entry");

            if (entry.PermissionAccessPath.Length != this.TagNames.Length)
                throw new InvalidOperationException(SR.GetString(SR.PermissionNumberOfElements));

            Hashtable currentTable = this.rootTable;
            string[] accessPath = entry.PermissionAccessPath;
            for (int index = 0; index < accessPath.Length; ++ index) {
                if (currentTable == null || !currentTable.ContainsKey(accessPath[index]))
                    throw new InvalidOperationException(SR.GetString(SR.PermissionItemDoesntExist));
                else {
                    Hashtable oldTable = currentTable;
                    if (index < accessPath.Length - 1) {
                        currentTable = (Hashtable)currentTable[accessPath[index]];
                        if (currentTable.Count == 1)
                            oldTable.Remove(accessPath[index]);
                    }
                    else {
                        currentTable = null;
                        oldTable.Remove(accessPath[index]);
                    }
                }
            }
        }
		public void Constructor_Negative ()
		{
			ResourcePermissionBaseEntry rpbe = new ResourcePermissionBaseEntry (Int32.MinValue, new string [1]);
			Assert.AreEqual (Int32.MinValue, rpbe.PermissionAccess, "PermissionAccess");
			Assert.AreEqual (1, rpbe.PermissionAccessPath.Length, "PermissionAccessPath");
		}
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected void AddPermissionAccess(ResourcePermissionBaseEntry entry) {
            if (entry == null)
                throw new ArgumentNullException("entry");

            if (entry.PermissionAccessPath.Length != this.TagNames.Length)
                throw new InvalidOperationException(SR.GetString(SR.PermissionNumberOfElements));

            Hashtable currentTable = this.rootTable;
            string[] accessPath = entry.PermissionAccessPath;
            for (int index = 0; index < accessPath.Length - 1; ++ index) {
                if (currentTable.ContainsKey(accessPath[index]))
                    currentTable = (Hashtable)currentTable[accessPath[index]];
                else {
                    Hashtable newHashTable = CreateHashtable();
                    currentTable[accessPath[index]] = newHashTable;
                    currentTable = newHashTable;
                }
            }

            if (currentTable.ContainsKey(accessPath[accessPath.Length - 1]))
                throw new InvalidOperationException(SR.GetString(SR.PermissionItemExists));

            currentTable[accessPath[accessPath.Length - 1]] = entry.PermissionAccess;
        }
 protected ResourcePermissionBaseEntry[] GetPermissionEntries()
 {
     ResourcePermissionBaseEntry[] entries = new ResourcePermissionBaseEntry [_list.Count];
     _list.CopyTo(entries, 0);
     return(entries);
 }
		protected ResourcePermissionBaseEntry[] GetPermissionEntries ()
		{
			ResourcePermissionBaseEntry[] entries = new ResourcePermissionBaseEntry [_list.Count];
			_list.CopyTo (entries, 0);
			return entries;
		}
		public void ToXml ()
		{
			NonAbstractResourcePermissionBase rp = new NonAbstractResourcePermissionBase ();
			rp.TagNames = new string [1] { "Monkeys" };
			SecurityElement se = rp.ToXml ();
			CheckCommonXml ("empty", se);
			Assert.AreEqual (2, se.Attributes.Count, "#attributes");
			Assert.IsNull (se.Children, "Children");

			ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry (0, new string [1] { "Singes" });
			rp.AddPermissionAccess (entry);
			se = rp.ToXml ();
			CheckCommonXml ("one", se);
			Assert.AreEqual (2, se.Attributes.Count, "#attributes");
			Assert.AreEqual (1, se.Children.Count, "1-Children");
			SecurityElement child = (SecurityElement) se.Children [0];
			Assert.AreEqual ("Monkeys", child.Tag, "Monkeys");
			Assert.AreEqual ("Singes", child.Attribute ("name"), "Singes");
		}
		public void Constructor_Default () 
		{
			ResourcePermissionBaseEntry rpbe = new ResourcePermissionBaseEntry ();
			Assert.AreEqual (0, rpbe.PermissionAccess, "PermissionAccess");
			Assert.AreEqual (0, rpbe.PermissionAccessPath.Length, "PermissionAccessPath");
		}
		public void ToXml_Unrestricted ()
		{
			NonAbstractResourcePermissionBase rp = new NonAbstractResourcePermissionBase (PermissionState.Unrestricted);
			rp.TagNames = new string [1] { "Monkeys" };
			SecurityElement se = rp.ToXml ();
			CheckCommonXml ("empty", se);
			Assert.AreEqual (3, se.Attributes.Count, "#attributes");
			Assert.AreEqual ("true", se.Attribute ("Unrestricted"), "Unrestricted");
			Assert.IsNull (se.Children, "Children");

			ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry (0, new string [1] { "Singes" });
			rp.AddPermissionAccess (entry);
			se = rp.ToXml ();
			CheckCommonXml ("one", se);
			Assert.AreEqual (3, se.Attributes.Count, "#attributes");
			// not XML output of childrens for unrestricted
			Assert.IsNull (se.Children, "Children");
		}
		public void AddPermissionAccess ()
		{
			NonAbstractResourcePermissionBase rp = new NonAbstractResourcePermissionBase ();
			rp.TagNames = new string [1] { "Monkeys" };
			ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry (0, new string [1] { "Singes" });
			rp.AddPermissionAccess (entry);

			ResourcePermissionBaseEntry[] entries = rp.GetPermissionEntries ();
			Assert.AreEqual (1, entries.Length, "Count");
		}
		public new void AddPermissionAccess (ResourcePermissionBaseEntry entry)
		{
			base.AddPermissionAccess (entry);
		}
		public void Constructor_IntString ()
		{
			ResourcePermissionBaseEntry rpbe = new ResourcePermissionBaseEntry (Int32.MaxValue, new string [10]);
			Assert.AreEqual (Int32.MaxValue, rpbe.PermissionAccess, "PermissionAccess");
			Assert.AreEqual (10, rpbe.PermissionAccessPath.Length, "PermissionAccessPath");
		}
 internal DirectoryServicesPermissionEntry(ResourcePermissionBaseEntry baseEntry)
 {
     this.permissionAccess = (DirectoryServicesPermissionAccess) baseEntry.PermissionAccess;
     this.path = baseEntry.PermissionAccessPath[0];
 }
 protected void RemovePermissionAccess(ResourcePermissionBaseEntry entry)
 {
     Contract.Requires(entry.PermissionAccessPath != null);
     Contract.Requires(this.TagNames != null);
     Contract.Ensures(0 <= entry.PermissionAccessPath.Length);
 }
		protected void RemovePermissionAccess (ResourcePermissionBaseEntry entry)
		{
			CheckEntry (entry);
			for (int i = 0; i < _list.Count; i++) {
				ResourcePermissionBaseEntry rpbe = (ResourcePermissionBaseEntry) _list [i];
				if (Equals (entry, rpbe)) {
					_list.RemoveAt (i);
					return;
				}
			}
			string msg = Locale.GetText ("Entry doesn't exists.");
			throw new InvalidOperationException (msg);
		}
 /// <include file='doc\DirectoryServicesPermissionEntryCollection.uex' path='docs/doc[@for="DirectoryServicesPermissionEntryCollection.DirectoryServicesPermissionEntryCollection"]/*' />        
 ///<internalonly/>   
 internal DirectoryServicesPermissionEntryCollection(DirectoryServicesPermission owner, ResourcePermissionBaseEntry[] entries) {
     this.owner = owner;
     for (int index = 0; index < entries.Length; ++index)
         this.InnerList.Add(new DirectoryServicesPermissionEntry(entries[index]));
 } 
Exemple #43
0
 protected void RemovePermissionAccess(ResourcePermissionBaseEntry entry)
 {
 }
		internal void CheckEntry (ResourcePermissionBaseEntry entry)
		{
			if (entry == null)
				throw new ArgumentNullException ("entry");
			if ((entry.PermissionAccessPath == null) || (entry.PermissionAccessPath.Length != _tags.Length)) {
				string msg = Locale.GetText ("Entry doesn't match TagNames");
				throw new InvalidOperationException (msg);
			}
		}
        private ResourcePermissionBaseEntry[] GetChildrenAccess(object currentContent, int tagIndex) {
            IDictionaryEnumerator contentEnumerator = ((Hashtable)currentContent).GetEnumerator();
            ArrayList list = new ArrayList();
            while(contentEnumerator.MoveNext()) {
                if (tagIndex < (this.TagNames.Length -1)) {
                    ResourcePermissionBaseEntry[] currentEntries = GetChildrenAccess(contentEnumerator.Value, tagIndex + 1);
                    for (int index = 0; index < currentEntries.Length; ++index)
                        currentEntries[index].PermissionAccessPath[tagIndex] = (string)contentEnumerator.Key;

                     list.AddRange(currentEntries);
                }
                else {
                    ResourcePermissionBaseEntry entry = new ResourcePermissionBaseEntry((int)contentEnumerator.Value, new string[this.TagNames.Length]);
                    entry.PermissionAccessPath[tagIndex] = (string)contentEnumerator.Key;

                    list.Add(entry);
                }
            }

            return (ResourcePermissionBaseEntry[])list.ToArray(typeof(ResourcePermissionBaseEntry));
        }
		internal bool Equals (ResourcePermissionBaseEntry entry1, ResourcePermissionBaseEntry entry2)
		{
			if (entry1.PermissionAccess != entry2.PermissionAccess)
				return false;
			if (entry1.PermissionAccessPath.Length != entry2.PermissionAccessPath.Length)
				return false;
			for (int i=0; i < entry1.PermissionAccessPath.Length; i++) {
				if (entry1.PermissionAccessPath [i] != entry2.PermissionAccessPath [i])
					return false;
			}
			return true;
		}
Exemple #47
0
 protected void RemovePermissionAccess(ResourcePermissionBaseEntry entry)
 {
     throw new NotImplementedException();
 }
		internal bool Exists (ResourcePermissionBaseEntry entry)
		{
			if (_list.Count == 0)
				return false;
			foreach (ResourcePermissionBaseEntry rpbe in _list) {
				if (Equals (rpbe, entry))
					return true;
			}
			return false;
		}