Esempio n. 1
0
 public void Copy()
 {
     foreach (DirectoryServicesPermissionAccess ppl in AllAccess)
     {
         DirectoryServicesPermission      dsp  = new DirectoryServicesPermission(PermissionState.None);
         DirectoryServicesPermissionEntry dspe = new DirectoryServicesPermissionEntry(ppl, ppl.ToString());
         dsp.PermissionEntries.Add(dspe);
         DirectoryServicesPermission copy = (DirectoryServicesPermission)dsp.Copy();
         Assert.AreEqual(1, copy.PermissionEntries.Count, "Count==1");
         Assert.AreEqual(ppl, dsp.PermissionEntries [0].PermissionAccess, ppl.ToString());
         Assert.AreEqual(ppl.ToString(), dsp.PermissionEntries [0].Path, ppl.ToString() + "-Path");
     }
 }
Esempio n. 2
0
        }// CreateDataTable

        protected override void PutValuesinPage()
        {
            // Put in the text for the radio buttons
            m_radUnrestricted.Text             = CResourceStore.GetString("DirectoryServicesPerm:GrantUnrestrict");
            m_radGrantFollowingPermission.Text = CResourceStore.GetString("DirectoryServicesPerm:GrantFollowing");

            DirectoryServicesPermission perm = (DirectoryServicesPermission)m_perm;

            CheckUnrestricted(perm);

            if (!perm.IsUnrestricted())
            {
                // Run through the list of socket permissions we have to accept connections
                IEnumerator enumer = perm.PermissionEntries.GetEnumerator();
                while (enumer.MoveNext())
                {
                    DirectoryServicesPermissionEntry dspp = (DirectoryServicesPermissionEntry)enumer.Current;
                    DataRow newRow;
                    newRow         = m_dt.NewRow();
                    newRow["Path"] = dspp.Path;

                    String sAccessString = "";
                    if (dspp.PermissionAccess == DirectoryServicesPermissionAccess.Browse)
                    {
                        sAccessString = CResourceStore.GetString("DirectoryServicesPermission:Browse");
                    }
                    else if (dspp.PermissionAccess == DirectoryServicesPermissionAccess.Write)
                    {
                        sAccessString = CResourceStore.GetString("DirectoryServicesPermission:Write");
                    }
                    else
                    {
                        sAccessString = CResourceStore.GetString("<unknown>");
                    }

                    newRow["Access"] = new DataGridComboBoxEntry(sAccessString);
                    m_dt.Rows.Add(newRow);
                }
            }

            // We want at least 1 row so it looks pretty
            while (m_dt.Rows.Count < 1)
            {
                AddEmptyRow(m_dt);
            }
        }// PutValuesinPage
Esempio n. 3
0
        public void PermissionEntries()
        {
            DirectoryServicesPermissionAccess          dspa  = DirectoryServicesPermissionAccess.None;
            DirectoryServicesPermission                dsp   = new DirectoryServicesPermission(dspa, String.Empty);
            DirectoryServicesPermissionEntryCollection dspec = dsp.PermissionEntries;

            Assert.AreEqual(1, dspec.Count, "Count==1");

            DirectoryServicesPermissionEntry dspe = new DirectoryServicesPermissionEntry(DirectoryServicesPermissionAccess.Browse, "*");

            dsp.PermissionEntries.Add(dspe);
            Assert.AreEqual(2, dspec.Count, "Count==2");

            // remove (same instance)
            dsp.PermissionEntries.Remove(dspe);
            Assert.AreEqual(1, dspec.Count, "Count==1 (b)");

            // remove different instance (doesn't work)
            dspe = new DirectoryServicesPermissionEntry(DirectoryServicesPermissionAccess.None, String.Empty);
            Assert.AreEqual(1, dspec.Count, "Count==1");
        }
 // Methods
 public int Add(DirectoryServicesPermissionEntry value)
 {
 }
 public void Remove(DirectoryServicesPermissionEntry value)
 {
 }
 public int IndexOf(DirectoryServicesPermissionEntry value)
 {
 }
 public void Insert(int index, DirectoryServicesPermissionEntry value)
 {
 }
	public DirectoryServicesPermission(DirectoryServicesPermissionEntry[] permissionAccessEntries) {}
 public bool Contains(DirectoryServicesPermissionEntry value)
 {
 }
	public void CopyTo(DirectoryServicesPermissionEntry[] array, int index) {}
	public int IndexOf(DirectoryServicesPermissionEntry value) {}
	public bool Contains(DirectoryServicesPermissionEntry value) {}
	public void AddRange(DirectoryServicesPermissionEntry[] value) {}
	// Methods
	public int Add(DirectoryServicesPermissionEntry value) {}
	public void Remove(DirectoryServicesPermissionEntry value) {}
	public void Insert(int index, DirectoryServicesPermissionEntry value) {}