Esempio n. 1
0
        /// <summary>
        /// 设置Customer HTTP header
        /// </summary>
        private bool SetCustomHTTPheaders(string metabasePath, string customHeaderName, string customHeaderNameValue)
        {
            try
            {
                DirectoryEntry          path       = new DirectoryEntry(metabasePath);
                PropertyValueCollection propValues = path.Properties["HttpCustomHeaders"];

                object exists = null;
                foreach (object value in propValues)
                {
                    string[] a;
                    a = value.ToString().Split(':');
                    if (a[0] == customHeaderName.Trim())
                    {
                        exists = value;
                    }
                }

                if (null != exists)
                {
                    propValues.Remove(exists);
                }

                string saveValue = customHeaderName + ":" + customHeaderNameValue;
                propValues.Add((object)saveValue);
                path.CommitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                throw new IISException("Set Customer HTTP header error - " + ex.Message, ex, IISVersion);
            }
        }
Esempio n. 2
0
        private static void SetMimeType(DirectoryEntry vdirObj, string newExtension, string newMimeType)
        {
            PropertyValueCollection propValues = vdirObj.Properties["MimeMap"];
            object       exists     = null;
            const string cMimeType  = "MimeType";
            const string cExtension = "Extension";

            foreach (object value in propValues)
            {
                if (newExtension == GetObjectProp(value, cExtension))
                {
                    exists = value;
                }
            }

            if (exists != null)
            {
                if (newMimeType == GetObjectProp(exists, cMimeType))
                {
                    return;
                }
                propValues.Remove(exists);
            }

            object newObj = CreateObject("MimeMap");

            SetObjectProp(newObj, cExtension, newExtension);
            SetObjectProp(newObj, cMimeType, newMimeType);
            propValues.Add(newObj);
            vdirObj.CommitChanges();
        }
Esempio n. 3
0
        /// <summary>
        /// 删除站点主机头(根据站点号,也就是站点标识)
        /// </summary>
        /// <param name="SiteNum"></param>
        /// <param name="IPAddress"></param>
        /// <param name="Port"></param>
        /// <param name="Url"></param>
        public void DeleteHostHeader(long SiteNum, string IPAddress, string Port, string Url)
        {
            if (SiteNum < 0)
            {
                throw new Exception("IIS 站点号“" + SiteNum.ToString() + "”打开失败。");
            }

            string         entry = String.Format("IIS://{0}/w3svc/{1}", HostName, SiteNum);
            DirectoryEntry site  = GetDirectoryEntry(entry);

            if (site == null)
            {
                throw new Exception("IIS 站点号“" + SiteNum.ToString() + "”打开失败。");
            }

            PropertyValueCollection serverBindings = site.Properties["ServerBindings"];

            string headerStr = string.Format("{0}:{1}:{2}", IPAddress, Port, Url);

            if (serverBindings.Contains(headerStr))
            {
                serverBindings.Remove(headerStr);
                site.CommitChanges();
            }
        }
Esempio n. 4
0
        //
        // PAPI --> S.DS (LDAP or WinNT) conversion routines
        //

        static internal void MultiStringToDirectoryEntryConverter(Principal p, string propertyName, DirectoryEntry de, string suggestedProperty)
        {
            PrincipalValueCollection <string> trackingList = (PrincipalValueCollection <string>)p.GetValueForProperty(propertyName);

            if (p.unpersisted && trackingList == null)
            {
                return;
            }

            List <string> insertedValues = trackingList.Inserted;
            List <string> removedValues  = trackingList.Removed;
            List <Pair <string, string> > changedValues = trackingList.ChangedValues;

            PropertyValueCollection properties = de.Properties[suggestedProperty];

            // We test to make sure the change hasn't already been applied to the PropertyValueCollection,
            // because PushChangesToNative can be called multiple times prior to committing the changes and
            // we want to maintain idempotency
            foreach (string value in removedValues)
            {
                if (value != null && properties.Contains(value))
                {
                    properties.Remove(value);
                }
            }

            foreach (Pair <string, string> changedValue in changedValues)
            {
                // Remove the original value and add in the new value
                Debug.Assert(changedValue.Left != null);    // since it came from the system
                properties.Remove(changedValue.Left);

                if (changedValue.Right != null && !properties.Contains(changedValue.Right))
                {
                    properties.Add(changedValue.Right);
                }
            }

            foreach (string value in insertedValues)
            {
                if (value != null && !properties.Contains(value))
                {
                    properties.Add(value);
                }
            }
        }
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            #region "base Deserialize"
            string key = DictionaryHelper.GetValue(dictionary, "Key", string.Empty);
            WfActivityDescriptor actDesp = (WfActivityDescriptor)CreateInstance(key, dictionary, type, serializer);
            actDesp.Name        = DictionaryHelper.GetValue(dictionary, "Name", string.Empty);;
            actDesp.Enabled     = DictionaryHelper.GetValue(dictionary, "Enabled", false);
            actDesp.Description = DictionaryHelper.GetValue(dictionary, "Description", string.Empty);

            Dictionary <string, object> activityProperties = new Dictionary <string, object>();

            Dictionary <string, Type> constKey = new Dictionary <string, Type>();
            constKey.Add("Variables", typeof(WfVariableDescriptorCollection));
            constKey.Add("Condition", typeof(WfConditionDescriptor));
            constKey.Add("BranchProcessTemplates", typeof(WfBranchProcessTemplateCollection));
            constKey.Add("Resources", typeof(WfResourceDescriptorCollection));
            constKey.Add("RelativeLinks", typeof(WfRelativeLinkDescriptorCollection));
            constKey.Add("EnterEventReceivers", typeof(WfResourceDescriptorCollection));
            constKey.Add("LeaveEventReceivers", typeof(WfResourceDescriptorCollection));
            constKey.Add("InternalRelativeUsers", typeof(WfResourceDescriptorCollection));
            constKey.Add("ExternalUsers", typeof(WfExternalUserCollection));

            constKey.Add("EnterEventExecuteServices", typeof(WfServiceOperationDefinitionCollection));
            constKey.Add("LeaveEventExecuteServices", typeof(WfServiceOperationDefinitionCollection));

            constKey.Add("WithdrawExecuteServices", typeof(WfServiceOperationDefinitionCollection));
            constKey.Add("BeWithdrawnExecuteServices", typeof(WfServiceOperationDefinitionCollection));

            constKey.Add("ParametersNeedToBeCollected", typeof(WfParameterNeedToBeCollected));

            if (dictionary.ContainsKey("Properties"))
            {
                PropertyValueCollection properties = JSONSerializerExecute.Deserialize <PropertyValueCollection>(dictionary["Properties"]);
                properties.Remove(p => string.Compare(p.Definition.Name, "ImportWfMatrix") == 0);
                //properties.Remove(p => string.Compare(p.Definition.Name, "BranchProcessTemplates") == 0);
                actDesp.Properties.Clear();
                foreach (PropertyValue pv in properties)
                {
                    if (constKey.ContainsKey(pv.Definition.Name))
                    {
                        var objValue = JSONSerializerExecute.DeserializeObject(pv.StringValue, constKey[pv.Definition.Name]);
                        activityProperties.Add(pv.Definition.Name, objValue);
                    }
                    else
                    {
                        actDesp.Properties.Add(pv);
                    }
                }
            }
            #endregion
            actDesp.ActivityType = DictionaryHelper.GetValue(dictionary, "ActivityType", WfActivityType.NormalActivity);

            ClearAllProperties(actDesp);
            SetActivityProperties(actDesp, activityProperties, dictionary);

            return(actDesp);
        }
Esempio n. 6
0
        internal static void MultiStringToDirectoryEntryConverter(Principal p, string propertyName, DirectoryEntry de, string suggestedProperty)
        {
            PrincipalValueCollection <string> valueForProperty = (PrincipalValueCollection <string>)p.GetValueForProperty(propertyName);

            if (!p.unpersisted || valueForProperty != null)
            {
                List <string> inserted = valueForProperty.Inserted;
                List <string> removed  = valueForProperty.Removed;
                List <Pair <string, string> > changedValues = valueForProperty.ChangedValues;
                PropertyValueCollection       item          = de.Properties[suggestedProperty];
                foreach (string str in removed)
                {
                    if (str == null || !item.Contains(str))
                    {
                        continue;
                    }
                    item.Remove(str);
                }
                foreach (Pair <string, string> changedValue in changedValues)
                {
                    item.Remove(changedValue.Left);
                    if (changedValue.Right == null || item.Contains(changedValue.Right))
                    {
                        continue;
                    }
                    item.Add(changedValue.Right);
                }
                foreach (string str1 in inserted)
                {
                    if (str1 == null || item.Contains(str1))
                    {
                        continue;
                    }
                    item.Add(str1);
                }
                return;
            }
            else
            {
                return;
            }
        }
Esempio n. 7
0
        public static void DeleteHostHeader(int siteid, string ip, int port, string domain)//删除主机头(站点编号.ip.端口.域名)
        {
            DirectoryEntry          site           = new DirectoryEntry("IIS://localhost/W3SVC/" + siteid);
            PropertyValueCollection serverBindings = site.Properties["ServerBindings"];
            string headerStr = string.Format("{0}:{1}:{2}", ip, port, domain);

            if (serverBindings.Contains(headerStr))
            {
                serverBindings.Remove(headerStr);
            }
            site.CommitChanges();
        }
Esempio n. 8
0
        public string RemoveHostHeader(string websiteName, string ipAddress, string port, string hostname)
        {
            string         websiteID   = GetWebsiteID(websiteName);
            string         websitePath = "IIS://" + mServer + "/w3svc/" + websiteID;
            DirectoryEntry website     = null;

            try
            {
                website = new DirectoryEntry(websitePath);
            }
            catch (Exception error)
            {
                throw new Exception("Error creating the web directory entry.\n" + error.Message + "\n" + error.InnerException);
            }

            PropertyValueCollection websiteBindings = null;

            try
            {
                websiteBindings = website.Properties["ServerBindings"];
            }
            catch (Exception error)
            {
                throw new Exception("Error getting the host header listing.\n" + error.Message + "\n" + error.InnerException);
            }

            string hostHeader = string.Format("{0}:{1}:{2}", ipAddress, port, hostname);

            if (!websiteBindings.Contains(hostHeader))
            {
                return("missing");
            }

            try
            {
                websiteBindings.Remove(hostHeader);
                website.CommitChanges();
            }
            catch (System.Exception error)
            {
                throw new Exception("Error removing the host header.\n" + error.Message + "\n" + error.InnerException);
            }

            return("removed");
        }
        protected override void OnRemoveValue(object value)
        {
            object[] array = value as object[];

            if (array == null)
            {
                array = new object[] { value };
            }

            PropertyValueCollection values = DirectoryUtils.GetPropertyValues(Entry, AttributeName);

            foreach (object val in array)
            {
                if (values.Contains(val))
                {
                    values.Remove(val);
                }
            }

            Entry.CommitChanges();
        }
Esempio n. 10
0
        public void DeleteHostHeader(long SiteNum, string IPAddress, string Port, string Url)
        {
            if (SiteNum < 0L)
            {
                throw new Exception("IIS 站点号“" + SiteNum.ToString() + "”打开失败。");
            }
            string         entryPath      = string.Format("IIS://{0}/w3svc/{1}", this.HostName, SiteNum);
            DirectoryEntry directoryEntry = this.GetDirectoryEntry(entryPath);

            if (directoryEntry == null)
            {
                throw new Exception("IIS 站点号“" + SiteNum.ToString() + "”打开失败。");
            }
            PropertyValueCollection values = directoryEntry.Properties["ServerBindings"];
            string str2 = string.Format("{0}:{1}:{2}", IPAddress, Port, Url);

            if (values.Contains(str2))
            {
                values.Remove(str2);
                directoryEntry.CommitChanges();
            }
        }
Esempio n. 11
0
        private void RePrepare(PropertyValueCollection propVals)
        {
            //If empty go for full rebuild
            if (propVals.Count == 0)
            {
                propertySnapshot = null;
                Prepare(propVals);
                return;
            }

            //Otherwise purge from the property values any properties not
            //in the snapshot
            List <PropertyValue> remove = new List <PropertyValue>();

            foreach (PropertyValue p in propVals)
            {
                if (!propertySnapshot.Contains(p.Name.Name))
                {
                    remove.Add(propVals.FindItem(p.Name.Name));
                }
            }
            if (remove.Count > 0)
            {
                foreach (PropertyValue propVal in remove)
                {
                    propVals.Remove(propVal);
                }
            }

            currentValues.Clear();
            //Re-cache property values into temp dictionary
            foreach (PropertyValue p in propVals)
            {
                currentValues[p.Name.Name] = p.Value as LiteralValue;
            }
        }
Esempio n. 12
0
        private void RePrepare(PropertyValueCollection propVals)
        {
            //If empty go for full rebuild
            if (propVals.Count == 0)
            {
                propertySnapshot = null;
                Prepare(propVals);
                return;
            }

            //Otherwise purge from the property values any properties not 
            //in the snapshot
            List<PropertyValue> remove = new List<PropertyValue>();
            foreach (PropertyValue p in propVals)
            {
                if (!propertySnapshot.Contains(p.Name.Name))
                    remove.Add(propVals.FindItem(p.Name.Name));
            }
            if (remove.Count > 0)
            {
                foreach (PropertyValue propVal in remove)
                {
                    propVals.Remove(propVal);
                }
            }

            currentValues.Clear();
            //Re-cache property values into temp dictionary
            foreach (PropertyValue p in propVals)
            {
                currentValues[p.Name.Name] = p.Value as LiteralValue;
            }
        }
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, System.Web.Script.Serialization.JavaScriptSerializer serializer)
        {
            //WfProcessDescriptor processDesp = (WfProcessDescriptor)base.Deserialize(dictionary, type, serializer);
            #region "base Deserialize"
            string key = DictionaryHelper.GetValue(dictionary, "Key", string.Empty);
            WfProcessDescriptor processDesp = (WfProcessDescriptor)CreateInstance(key, dictionary, type, serializer);
            processDesp.Name        = DictionaryHelper.GetValue(dictionary, "Name", string.Empty);;
            processDesp.Enabled     = DictionaryHelper.GetValue(dictionary, "Enabled", false);
            processDesp.Description = DictionaryHelper.GetValue(dictionary, "Description", string.Empty);

            Dictionary <string, object> processProperties = new Dictionary <string, object>();
            Dictionary <string, Type>   constKey          = new Dictionary <string, Type>();
            constKey.Add("RelativeLinks", typeof(WfRelativeLinkDescriptorCollection));
            constKey.Add("CancelEventReceivers", typeof(WfResourceDescriptorCollection));
            constKey.Add("CompleteEventReceivers", typeof(WfResourceDescriptorCollection));
            constKey.Add("InternalRelativeUsers", typeof(WfResourceDescriptorCollection));
            constKey.Add("ExternalUsers", typeof(WfExternalUserCollection));
            constKey.Add("Variables", typeof(WfVariableDescriptorCollection));
            constKey.Add("ParametersNeedToBeCollected", typeof(WfParameterNeedToBeCollected));

            constKey.Add("CancelBeforeExecuteServices", typeof(WfServiceOperationDefinitionCollection));
            constKey.Add("CancelAfterExecuteServices", typeof(WfServiceOperationDefinitionCollection));

            if (dictionary.ContainsKey("Properties"))
            {
                PropertyValueCollection properties = JSONSerializerExecute.Deserialize <PropertyValueCollection>(dictionary["Properties"]);
                properties.Remove(p => string.Compare(p.Definition.Name, "ImportWfMatrix") == 0);
                processDesp.Properties.Clear();
                foreach (PropertyValue pv in properties)
                {
                    if (constKey.ContainsKey(pv.Definition.Name))
                    {
                        var objValue = JSONSerializerExecute.DeserializeObject(pv.StringValue, constKey[pv.Definition.Name]);
                        processProperties.Add(pv.Definition.Name, objValue);
                    }
                    else
                    {
                        processDesp.Properties.Add(pv);
                    }
                }
            }
            #endregion

            processDesp.GraphDescription = DictionaryHelper.GetValue(dictionary, "GraphDescription", string.Empty);

            WfActivityDescriptorCollection activities = JSONSerializerExecute.Deserialize <WfActivityDescriptorCollection>(dictionary["Activities"]);
            processDesp.Activities.Clear();
            processDesp.Activities.CopyFrom(activities);

            ClearAllProperties(processDesp);
            SetProcessProperties(processDesp, processProperties, dictionary);

            ToTransitionsDescriptorCollection transitions = JSONSerializerExecute.Deserialize <ToTransitionsDescriptorCollection>(dictionary["Transitions"]);

            foreach (WfTransitionDescriptor tranDesp in transitions)
            {
                WfActivityDescriptor fromActDesc = (WfActivityDescriptor)processDesp.Activities[tranDesp.FromActivityKey];
                WfActivityDescriptor toActDesc   = (WfActivityDescriptor)processDesp.Activities[tranDesp.ToActivityKey];

                if (fromActDesc != null && toActDesc != null)
                {
                    fromActDesc.ToTransitions.AddTransition(toActDesc, tranDesp);
                }
            }

            return(processDesp);
        }
Esempio n. 14
0
        /// <summary>
        /// SetMultiValued method implementation
        /// </summary>
        internal static void SetMultiValued(PropertyValueCollection props, bool ismultivalued, string value)
        {
            if (props == null)
            {
                return;
            }
            if (!ismultivalued)
            {
                if (string.IsNullOrEmpty(value))
                {
                    props.Clear();
                }
                else
                {
                    props.Value = value;
                }
            }
            else
            {
                switch (props.Count)
                {
                case 0:
                    if (!string.IsNullOrEmpty(value))
                    {
                        props.Add(SetMultiValuedHeader(value));
                    }
                    break;

                case 1:
                    if (props.Value == null)
                    {
                        return;
                    }
                    if (props.Value is string)
                    {
                        string so = props.Value as string;
                        if (string.IsNullOrEmpty(value))
                        {
                            props.Remove(so);      // Clean value anyway
                            return;
                        }
                        if (HasSetMultiValued(so))
                        {
                            props.Value = SetMultiValuedHeader(value);
                        }
                        else
                        {
                            props.Add(SetMultiValuedHeader(value));
                        }
                    }
                    break;

                default:
                    int j = props.Count;
                    for (int i = 0; i < j; i++)
                    {
                        if (props[i] != null)
                        {
                            if (props[i] is string)
                            {
                                string so2 = props[i] as string;
                                if (HasSetMultiValued(so2))
                                {
                                    if (string.IsNullOrEmpty(value))
                                    {
                                        props.Remove(so2);
                                    }
                                    else
                                    {
                                        props[i] = SetMultiValuedHeader(value);
                                    }
                                    return;
                                }
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(value))
                    {
                        props.Add(SetMultiValuedHeader(value));     // Add tagged value if not null
                    }
                    break;
                }
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Create an Application VDir for this directory and set its properties to allow the execution of WCF Services
        /// </summary>
        static void CreateApplicationVDir(string applicationName)
        {
            DirectoryEntry site      = new DirectoryEntry(FindSharepointRootPath()); // BUGBUG: Do we want to hardcode this installer to just SharePoint?
            string         className = site.SchemaClassName.ToString();

            DirectoryEntries vdirs = site.Children;

            #region Delete old Application if it exists
            foreach (DirectoryEntry de in vdirs)
            {
                if (de.Name == applicationName)
                {
                    Console.WriteLine(Strings.DeletingExistingApplication, de.Name);
                    de.DeleteTree(); // Out with the old, in with the new!
                }
            }
            #endregion

            #region Add the new Application
            Console.WriteLine(Strings.AddingNewApplication, applicationName);

            DirectoryEntry vdir = vdirs.Add(applicationName, className);
            vdir.Properties["AppFriendlyName"][0] = applicationName;

            string currentPath = new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName;
            vdir.Properties["Path"][0]         = currentPath;                       // Set this from the currently executing directory
            vdir.Properties["AccessScript"][0] = true;                              // Allow scripts
            vdir.Properties["AuthFlags"][0]    = "1";                               // Turn on Anonymous authentication
            vdir.Invoke("AppCreate3", new object[] { 0, "SLK Services", true });    // Make this an Application vdir running in process in a new AppPool named "SLK Services"

            vdir.CommitChanges();
            #endregion

            #region Fix up the ScriptMap setting that SharePoint removes which breaks WCF Services
            vdir.RefreshCache(); // Load the default properties that were inherited when the Application was committed
            foreach (PropertyValueCollection pvc in vdir.Properties)
            {
                if (pvc.PropertyName == "ScriptMaps") // Update the ScriptMap to add back in .svc (WCF Service) support
                {
                    List <object> values = new List <object>(pvc.Value as object[]);
                    bool          found  = false;

                    foreach (object value in values)
                    {
                        if ((value as string).StartsWith(".svc"))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        Console.WriteLine(Strings.AddingSvcMapping);
                        values.Add(Strings._SvcScriptMapping);
                        pvc.Value = values.ToArray();
                        vdir.CommitChanges();
                    }
                }
            }
            vdir.Close();
            #endregion

            #region Add the MimeType mapping for .grproj
            PropertyValueCollection mimeMapCollection = site.Properties["MimeMap"]; // Can I just do this on the vdir I wonder...?
            foreach (IISOle.IISMimeType mimeType in mimeMapCollection)
            {
                if (mimeType.Extension == ".grproj")
                {
                    mimeMapCollection.Remove(mimeType);
                    break;
                }
            }

            IISOle.MimeMapClass mimeMapping = new IISOle.MimeMapClass();
            mimeMapping.Extension = ".grproj";
            mimeMapping.MimeType  = "x-ms-gravaproject";
            mimeMapCollection.Add(mimeMapping);
            site.CommitChanges();
            #endregion
        }
Esempio n. 16
0
        private void button2_Click(object sender, EventArgs e)
        {
            string name = groupBox.Text;

            if (name.Length == 0)
            {
                return;
            }
            AddUserBox.Enabled   = false;
            removeButton.Enabled = false;
            addButton.Visible    = false;
            cancelButton.Text    = "Cancel";
            CANCEL = false;

            DirectoryEntry          group   = (DirectoryEntry)groupName2Ldap[name];
            PropertyValueCollection members = group.Properties["member"];

            List <string> domainusers = new List <string>();

            foreach (string x in membersBox.SelectedItems)
            {
                domainusers.Add(x);
            }

            List <string> success = new List <string>();
            List <string> failed  = new List <string>();
            string        forest  = "." + Forest.GetCurrentForest().RootDomain.Name;

            progress_i = 0; progressTotal = domainusers.Count;
            domainusers.AsParallel().ForAll(domainuser =>
            {
                progress_i++;

                if (CANCEL)
                {
                    failed.Add(domainuser);
                }
                else
                {
                    string principal = Regex.Replace(domainuser, @"(\w+)\\(\w+)", "$2@$1" + forest);
                    DirectorySearcher USER_SEARCH = new DirectorySearcher();
                    USER_SEARCH.SearchScope       = SearchScope.Subtree;
                    USER_SEARCH.Filter            = "(&(ObjectClass=user)(!ObjectClass=computer)(userPrincipalName=" + principal + "))";
                    SearchResult r = null; foreach (Domain d in Forest.GetCurrentForest().Domains)
                    {
                        USER_SEARCH.SearchRoot = d.GetDirectoryEntry();
                        if ((r = USER_SEARCH.FindOne()) != null)
                        {
                            break;
                        }
                    }

                    if (r != null)
                    {
                        try
                        {
                            string dn      = Regex.Replace(r.GetDirectoryEntry().Path, "LDAP://[^/]*/(.*)", "$1");
                            progressString = domainuser;

                            Console.WriteLine("Removing... " + progress_i + "/" + progressTotal + "  " + domainuser);
                            lock (members) { members.Remove(dn); }
                            success.Add(domainuser);
                        }
                        catch (Exception ee)
                        {
                            failed.Add(domainuser);
                            Console.WriteLine("Failed removing " + domainuser + ". " + ee.Message);
                        }
                    }
                    else
                    {
                        failed.Add(domainuser);
                        Console.WriteLine("Failed removing " + domainuser + ". Not found");
                    }
                }
            });


            if (failed.Count > 0)
            {
                MessageBox.Show("Could not remove users:\n\n" + failed.Aggregate((x, y) => x + "; " + y));
            }
            foreach (string x in success)
            {
                membersBox.Items.Remove(x);
            }
            if (success.Count > 0)
            {
                applyButton.BackColor = System.Drawing.SystemColors.Control;
                applyButton.Visible   = true; cancelButton.Text = "Cancel";
                addButton.Visible     = removeButton.Visible = false;
            }
            else
            {
                addButton.Visible = removeButton.Visible = true;
            }
            AddUserBox.Text      = success.Count == 0 ? "" : success.Aggregate((x, y) => x + "; " + y);
            progressString       = "";
            AddUserBox.Enabled   = true;
            removeButton.Enabled = true;
        }