示例#1
0
        protected override bool Apply(EditDialogAction actionCause)
        {
            uint   result       = (uint)LUGAPI.WinError.ERROR_SUCCESS;
            string errorMessage = null;

            try
            {
                if (!Hostinfo.ValidatePassword(tbConfirmPassword.Text, tbPassword.Text, out errorMessage))
                {
                    if (!(tbConfirmPassword.Text.Trim().Equals(tbPassword.Text)))
                    {
                        errorMessage = "The password was not correctly confirmed. Please ensure that the password and confirmation match exactly";
                    }
                    container.ShowError(errorMessage, MessageBoxButtons.OK);
                    return(false);
                }

                Password     = tbPassword.Text;
                User         = tbUserName.Text;
                FullName     = tbFullName.Text;
                Description  = tbDescription.Text;
                CannotChange = cbCannotChange.Checked;
                MustChange   = cbMustChange.Checked;
                NeverExpires = cbNeverExpires.Checked;
                IsDisabled   = cbIsDisabled.Checked;

                LUGPage lugPg = localParent;

                if (lugPg == null)
                {
                    Logger.Log("NewUserDlg.Apply  localParent == null", Logger.LogLevel.Error);
                    return(false);
                }

                result = lugPg.AddLUG(this);

                if (result != (uint)LUGAPI.WinError.ERROR_SUCCESS)
                {
                    container.ShowError(
                        "Likewise Administrative Console encountered an error when trying to add a new user.  " + ErrorCodes.WIN32String((int)result),
                        MessageBoxButtons.OK);
                    return(false);
                }
            }
            catch (Exception e)
            {
                Logger.LogException("NewUserDlg.Apply", e);
            }

            return(true);
        }
示例#2
0
        protected override bool Apply(EditDialogAction actionCause)
        {
            if (Applied && !bDataWasChanged)
            {
                return(true);
            }

            bool bRet = true;

            try
            {
                uint result = localParent.AddLUG(this);
                if (result != (uint)LUGAPI.WinError.ERROR_SUCCESS)
                {
                    container.ShowError(
                        "Likewise Administrative Console encountered an error when trying to add a new group.  " + ErrorCodes.WIN32String((int)result),
                        MessageBoxButtons.OK);
                    bDataWasChanged = true;
                    return(false);
                }
                Hostinfo hn = localParent.GetContext() as Hostinfo;

                bRet = bRet && hn != null && hn.creds != null &&
                       ProcessMembers(hn.creds, localParent.GetDomain());
            }
            catch (Exception e)
            {
                bRet = false;
                Logger.LogException("NewGroupDlg.Apply", e);
            }

            if (bRet)
            {
                Applied = true;
                Close();
            }

            return(bRet);
        }