/// <summary>
 /// Create and Enable application in SSO Store
 /// </summary>
 /// <param name="appName">Application to create/enable</param>
 /// <param name="description"></param>
 /// <param name="ContactInfo"></param>
 /// <param name="AppUserAcct"></param>
 /// <param name="AppAdminAcct"></param>
 /// <param name="propertiesBag"></param>
 /// <param name="maskArray"></param>
 public static void CreateAndEnableAppInSSO(string appName, string description, string ContactInfo,
                                            string AppUserAcct, string AppAdminAcct, SSOPropBag propertiesBag, ArrayList maskArray)
 {
     //create and enable application
     SSOConfigManager.CreateConfigStoreApplication(appName, description, ContactInfo,
                                                   AppUserAcct, AppAdminAcct, propertiesBag, maskArray);
     //set default configuration field values
     SSOConfigManager.SetConfigProperties(appName, propertiesBag);
 }
Esempio n. 2
0
        private bool UpdateSSOApplication(string newName, string oldName)
        {
            //write to SSOPropBag to figure out how many rows we have
            ArrayList maskArray = new ArrayList();

            try
            {
                HybridDictionary props = new HybridDictionary();

                foreach (DataGridViewRow row in dgvSearch.Rows)
                {
                    int keyIndex   = 0;
                    int valueIndex = 1;

                    if (row.Cells[keyIndex].Value != null)
                    {
                        // insert values on grid from property bag, replace special characters like \r \t
                        object objPropValue = row.Cells[valueIndex].Value.ToString().Replace("\t", "").Replace("\r", "");
                        object objPropKey   = row.Cells[keyIndex].Value.ToString().Replace("\t", "").Replace("\r", "");
                        props.Add(objPropKey, objPropValue);
                        maskArray.Add(0);
                    }
                }

                //if (newApp)
                //{
                SSOConfigManager.DeleteApplication(oldName);
                //}

                SSOPropBag propertiesBag = new SSOPropBag(props);

                //create and enable application
                SSOConfigManager.CreateConfigStoreApplication(newName, "", ContactInfo,
                                                              AuserAcct, AdminAcct, propertiesBag, maskArray);

                //set default configuration field values
                SSOConfigManager.SetConfigProperties(newName, propertiesBag);
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show("Erro, verifique se existe alguma key repetida\n" + ex.ToString(),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Occured.  Details: " + ex.ToString(),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        private void save(string name)
        {
            SSOPropBag propertiesBag = new SSOPropBag();

            ISSOAdmin a = new ISSOAdmin();

            string appUserAcct, appAdminAcct, description, contactInfo;

            HybridDictionary props = SSOConfigManager.GetConfigProperties(tvApps.SelectedNode.Text, out description, out contactInfo, out appUserAcct, out appAdminAcct);

            foreach (DataGridViewRow row in dgvSearch.Rows)
            {
                if (row.Cells[0].Value != null)
                {
                    if (row.Cells[1].Value == null)
                    {
                        MessageBox.Show("The key value cannot be blank!", "Blank key value", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    //set values
                    string propName     = row.Cells[0].Value.ToString();
                    object objPropValue = row.Cells[1].Value;

                    propertiesBag.Write(propName, ref objPropValue);

                    if (!props.Contains(propName))
                    {
                        a.CreateFieldInfo(tvApps.SelectedNode.Text, propName, 0);
                    }
                }
            }

            UpdateSSOApplication(name, name);
            //didn't work properly in BTS2013R2
            //a.UpdateApplication(tvApps.SelectedNode.Text, null, null, null, null, SSOFlag.SSO_FLAG_ENABLED, SSOFlag.SSO_FLAG_ENABLED);

            try
            {
                SSOConfigManager.SetConfigProperties(tvApps.SelectedNode.Text, propertiesBag);

                MessageBox.Show("Properties saved successfully.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Occured.  Details: " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }