Beispiel #1
0
        //
        // Static constructor: used for initializing static tables
        //
#pragma warning disable CA1810 // Initialize reference type static fields inline
        static ADAMStoreCtx()
#pragma warning restore CA1810
        {
            LoadFilterMappingTable(mappingIndex, s_filterPropertiesTableRaw);
            LoadPropertyMappingTable(mappingIndex, s_propertyMappingTableRaw);

            NonPresentAttrDefaultStateMapping ??= new Dictionary <string, bool>();

            for (int i = 0; i < s_presenceStateTable.GetLength(0); i++)
            {
                string attributeName = s_presenceStateTable[i, 0] as string;
                string defaultState  = s_presenceStateTable[i, 1] as string;
                NonPresentAttrDefaultStateMapping.Add(attributeName, (defaultState == "FALSE") ? false : true);
            }
        }
Beispiel #2
0
        // Use this function when searching for an attribute where the absence of the attribute = a default setting.
        // i.e.  ms-DS-UserPasswordNotRequired in ADAM where non existence equals false.
        protected static string DefaultValueBoolConverter(FilterBase filter, string suggestedAdProperty)
        {
            Debug.Assert(NonPresentAttrDefaultStateMapping != null);
            Debug.Assert(NonPresentAttrDefaultStateMapping.ContainsKey(suggestedAdProperty));

            if (filter.Value == null)
            {
                return($"(!({suggestedAdProperty}=*))");
            }

            bool defaultState = NonPresentAttrDefaultStateMapping[suggestedAdProperty];

            if (defaultState == (bool)filter.Value)
            {
                return($"(|(!({suggestedAdProperty}=*)({suggestedAdProperty}={((bool)filter.Value ? "TRUE" : "FALSE")})))");
            }

            return($"({suggestedAdProperty}={((bool)filter.Value ? "TRUE" : "FALSE")})");
        }