Beispiel #1
0
        /// <summary>
        /// Converts SMO properties to LDAP ones & changes the values in order to be suitable for LDAP.
        /// </summary>
        /// <param name="smoProp">Property Name</param>
        /// <param name="smoValue">Property Value</param>
        /// <returns>Property name + Value</returns>
        private static FilterItem ConvertSmoToLdapFilter(string smoProp, string smoValue)
        {
            FilterItem filter = new FilterItem();

            if (String.IsNullOrEmpty(smoProp))
            {
                return(filter);
            }


            switch (smoProp)
            {
            case Constants.SOProperties.URM.FQN:
                filter.Prop  = Constants.Properties.AdProperties.sAMAccountName;
                filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                break;

            case Constants.SOProperties.URM.Name:
                filter.Prop  = Constants.Properties.AdProperties.sAMAccountName;
                filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                break;

            case Constants.SOProperties.URM.UserName:
                filter.Prop  = Constants.Properties.AdProperties.sAMAccountName;
                filter.Value = smoValue;
                break;

            case Constants.SOProperties.URM.GroupName:
                filter.Prop  = Constants.Properties.AdProperties.sAMAccountName;
                filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                break;

            case Constants.SOProperties.URM.Email:
                filter.Prop  = Constants.Properties.AdProperties.Email;
                filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                break;

            case Constants.SOProperties.URM.AccountIsDisabled:
                filter.Prop = Constants.Properties.AdProperties.UserAccountControlFilter;
                if (bool.Parse(smoValue) == false)
                {
                    filter.Prop = "!" + filter.Prop;
                }
                filter.Value = ((int)Constants.UserAccountControl.PropertyFlags.ACCOUNTDISABLE).ToString();
                break;

            default:
                filter.Prop  = smoProp;
                filter.Value = smoValue;
                break;
            }
            return(filter);
        }
Beispiel #2
0
        /// <summary>
        /// Converts SMO properties to LDAP ones & changes the values in order to be suitable for LDAP.
        /// </summary>
        /// <param name="smoProp">Property Name</param>
        /// <param name="smoValue">Property Value</param>
        /// <returns>Property name + Value</returns>
        private static FilterItem ConvertSmoToLdapFilter(string smoProp, string smoValue)
        {
            FilterItem filter = new FilterItem();

            if (String.IsNullOrEmpty(smoProp))
            {
                return(filter);
            }


            switch (smoProp)
            {
            case Constants.SOProperties.URM.FQN:
                filter.Prop  = Constants.Properties.AdProperties.sAMAccountName;
                filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                break;

            case Constants.SOProperties.URM.Name:
                filter.Prop  = Constants.Properties.AdProperties.sAMAccountName;
                filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                break;

            case Constants.SOProperties.URM.UserName:
                filter.Prop  = Constants.Properties.AdProperties.sAMAccountName;
                filter.Value = smoValue;
                break;

            case Constants.SOProperties.URM.GroupName:
                filter.Prop  = Constants.Properties.AdProperties.sAMAccountName;
                filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                break;

            case Constants.SOProperties.URM.Email:
                filter.Prop  = Constants.Properties.AdProperties.Email;
                filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                break;

            default:
                filter.Prop  = smoProp;
                filter.Value = smoValue;
                break;
            }
            return(filter);
        }
        /// <summary>
        /// Converts SMO properties to LDAP ones & changes the values in order to be suitable for LDAP.
        /// </summary>
        /// <param name="smoProp">Property Name</param>
        /// <param name="smoValue">Property Value</param>
        /// <returns>Property name + Value</returns>
        private static FilterItem ConvertSmoToLdapFilter(string smoProp, string smoValue)
        {
            FilterItem filter = new FilterItem();
            if (String.IsNullOrEmpty(smoProp))
            {
                return filter;
            }

            switch (smoProp)
            {
                case Constants.SOProperties.URM.FQN:
                    filter.Prop = Constants.Properties.AdProperties.sAMAccountName;
                    filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                    break;
                case Constants.SOProperties.URM.Name:
                    filter.Prop = Constants.Properties.AdProperties.sAMAccountName;
                    filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                    break;
                case Constants.SOProperties.URM.UserName:
                    filter.Prop = Constants.Properties.AdProperties.sAMAccountName;
                    filter.Value = smoValue;
                    break;
                case Constants.SOProperties.URM.GroupName:
                    filter.Prop = Constants.Properties.AdProperties.sAMAccountName;
                    filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                    break;
                default:
                    filter.Prop = smoProp;
                    filter.Value = smoValue;
                    break;
            }
            return filter;
        }
        /// <summary>
        /// Converts SMO properties to LDAP ones & changes the values in order to be suitable for LDAP.
        /// </summary>
        /// <param name="smoProp">Property Name</param>
        /// <param name="smoValue">Property Value</param>
        /// <returns>Property name + Value</returns>
        private static FilterItem ConvertSmoToLdapFilter(string smoProp, string smoValue)
        {
            FilterItem filter = new FilterItem();
            if (String.IsNullOrEmpty(smoProp))
            {
                return filter;
            }

            switch (smoProp)
            {
                case Constants.SOProperties.URM.FQN:
                    filter.Prop = Constants.Properties.AdProperties.sAMAccountName;
                    filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                    break;
                case Constants.SOProperties.URM.Name:
                    filter.Prop = Constants.Properties.AdProperties.sAMAccountName;
                    filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                    break;
                case Constants.SOProperties.URM.Email:
                    filter.Prop = Constants.Properties.AdProperties.Email;
                    filter.Value = smoValue;
                    break;
                case Constants.SOProperties.URM.Description:
                    filter.Prop = Constants.Properties.AdProperties.Description;
                    filter.Value = smoValue;
                    break;
                case Constants.SOProperties.URM.Manager:
                    filter.Prop = Constants.Properties.AdProperties.Manager;
                    filter.Value = smoValue;
                    break;
                case Constants.SOProperties.URM.DisplayName:
                    filter.Prop = Constants.Properties.AdProperties.DisplayName;
                    filter.Value = smoValue;
                    break;
                case Constants.SOProperties.URM.UserName:
                    filter.Prop = Constants.Properties.AdProperties.sAMAccountName;
                    filter.Value = smoValue;
                    break;
                case Constants.SOProperties.URM.ObjectSid:
                    filter.Prop = Constants.Properties.AdProperties.ObjectSID;
                    filter.Value = smoValue;
                    break;
                case Constants.SOProperties.URM.Saml:
                    filter.Prop = Constants.Properties.AdProperties.sAMAccountName;
                    filter.Value = smoValue;
                    break;
                case Constants.SOProperties.URM.GroupName:
                    filter.Prop = Constants.Properties.AdProperties.sAMAccountName;
                    filter.Value = smoValue.Substring(smoValue.IndexOf('\\') + 1);
                    break;
            }
            return filter;
        }