예제 #1
0
        public void OnOkClicked(object o, EventArgs args)
        {
            LdapEntry entry = null;

            if (isEdit)
            {
                entry = CreateEntry(currentEntry.DN);

                LdapEntryAnalyzer lea = new LdapEntryAnalyzer();
                lea.Run(currentEntry, entry);

                if (lea.Differences.Length == 0)
                {
                    return;
                }

                if (!Util.ModifyEntry(conn, entry.DN, lea.Differences))
                {
                    errorOccured = true;
                }
            }
            else
            {
                string userDN = null;

                if (string.IsNullOrEmpty(this.defaultNewContainer))
                {
                    SelectContainerDialog scd = new SelectContainerDialog(conn, groupDialog);
                    scd.Title   = "Save Group";
                    scd.Message = String.Format("Where in the directory would\nyou like save the group\n{0}?", groupNameEntry.Text);
                    scd.Run();

                    if (string.IsNullOrEmpty(scd.DN))
                    {
                        return;
                    }

                    userDN = String.Format("cn={0},{1}", groupNameEntry.Text, scd.DN);
                }
                else
                {
                    userDN = String.Format("cn={0},{1}", groupNameEntry.Text, this.defaultNewContainer);
                }

                entry = CreateEntry(userDN);

                string[] missing = LdapEntryAnalyzer.CheckRequiredAttributes(conn, entry);
                if (missing.Length != 0)
                {
                    missingAlert(missing);
                    missingValues = true;
                    return;
                }

                if (!Util.AddEntry(conn, entry))
                {
                    errorOccured = true;
                }
            }
        }
예제 #2
0
        public void OnOkClicked(object o, EventArgs args)
        {
            LdapEntry entry  = null;
            string    userDN = null;

            if (!IsUserNameAvailable() || !IsUIDAvailable() || (IsPasswordEmpty() && dontRequirePasswords == false))
            {
                errorOccured = true;
                return;
            }

            if (this.defaultNewContainer == null)
            {
                SelectContainerDialog scd = new SelectContainerDialog(conn, newUserDialog);
                scd.Title   = "Save Group";
                scd.Message = String.Format("Where in the directory would\nyou like save the user\n{0}", displayNameEntry.Text);
                scd.Run();

                if (scd.DN == "")
                {
                    return;
                }

                userDN = String.Format("cn={0},{1}", displayNameEntry.Text, scd.DN);
            }
            else
            {
                userDN = String.Format("cn={0},{1}", displayNameEntry.Text, this.defaultNewContainer);
            }

            entry = CreateEntry(userDN);

            string[] missing = LdapEntryAnalyzer.CheckRequiredAttributes(conn, entry);
            if (missing.Length != 0)
            {
                missingAlert(missing);
                missingValues = true;
                return;
            }

            updateGroupMembership();

            if (!Util.AddEntry(conn, entry))
            {
                errorOccured = true;
            }
        }
예제 #3
0
        public void OnOkClicked(object o, EventArgs args)
        {
            LdapEntry entry = null;

            string userDN = null;

            if (this.defaultNewContainer == null)
            {
                SelectContainerDialog scd = new SelectContainerDialog(conn, newContactDialog);
                scd.Title   = "Save Group";
                scd.Message = String.Format("Where in the directory would\nyou like save the contact\n{0}?", gnDisplayName.Text);
                scd.Run();

                if (scd.DN == "")
                {
                    return;
                }

                userDN = String.Format("cn={0},{1}", gnDisplayName.Text, scd.DN);
            }
            else
            {
                userDN = String.Format("cn={0},{1}", gnDisplayName.Text, this.defaultNewContainer);
            }

            entry = CreateEntry(userDN);

            string[] missing = LdapEntryAnalyzer.CheckRequiredAttributes(conn, entry);
            if (missing.Length != 0)
            {
                missingAlert(missing);
                missingValues = true;
                return;
            }

            if (!Util.AddEntry(conn, entry))
            {
                errorOccured = true;
            }
        }