internal static SetterDelegate ScopeTypeSetterDelegate(RoleAssignmentFlagsFormat.Bitfields bitfield)
 {
     return(delegate(object value, IPropertyBag propertyBag)
     {
         RoleAssignmentFlagsFormat.SetBits((ulong)((long)((ScopeType)value)), propertyBag, bitfield);
     });
 }
        static RoleAssignmentFlagsFormat()
        {
            int num = 64;

            for (int i = 0; i <= 11; i++)
            {
                RoleAssignmentFlagsFormat.masks[i] = RoleAssignmentFlagsFormat.Mask(RoleAssignmentFlagsFormat.sizes[i]);
                num -= RoleAssignmentFlagsFormat.sizes[i];
                RoleAssignmentFlagsFormat.shifts[i] = num;
            }
        }
        private static QueryFilter RoleAssignmentFlagsFilterBuilder <T>(SinglePropertyFilter filter, RoleAssignmentFlagsFormat.Bitfields bitfield, RoleAssignmentFlagsFormat.ConvertToUlongDelegate convertor)
        {
            if (!(filter is ComparisonFilter))
            {
                throw new ADFilterException(DirectoryStrings.ExceptionUnsupportedFilterForProperty(filter.Property.Name, filter.GetType(), typeof(ComparisonFilter)));
            }
            ComparisonFilter comparisonFilter = (ComparisonFilter)filter;

            if (comparisonFilter.ComparisonOperator != ComparisonOperator.Equal && ComparisonOperator.NotEqual != comparisonFilter.ComparisonOperator)
            {
                throw new ADFilterException(DirectoryStrings.ExceptionUnsupportedOperatorForProperty(comparisonFilter.Property.Name, comparisonFilter.ComparisonOperator.ToString()));
            }
            if (!(comparisonFilter.PropertyValue is T))
            {
                throw new ArgumentException("filter.PropertyValue");
            }
            ulong       rawUInt64Bits = RoleAssignmentFlagsFormat.GetRawUInt64Bits(convertor(comparisonFilter.PropertyValue), bitfield);
            ulong       mask          = RoleAssignmentFlagsFormat.masks[(int)bitfield] << RoleAssignmentFlagsFormat.shifts[(int)bitfield] & ~rawUInt64Bits;
            QueryFilter queryFilter   = new BitMaskAndFilter(ExchangeRoleAssignmentSchema.ExchangeRoleAssignmentFlags, rawUInt64Bits);
            QueryFilter queryFilter2  = new BitMaskOrFilter(ExchangeRoleAssignmentSchema.ExchangeRoleAssignmentFlags, mask);

            if (comparisonFilter.PropertyValue is bool && !(bool)comparisonFilter.PropertyValue)
            {
                if (ComparisonOperator.NotEqual != comparisonFilter.ComparisonOperator)
                {
                    return(new NotFilter(queryFilter));
                }
                return(queryFilter);
            }
            else
            {
                if (ComparisonOperator.NotEqual != comparisonFilter.ComparisonOperator)
                {
                    return(new AndFilter(new QueryFilter[]
                    {
                        queryFilter,
                        new NotFilter(queryFilter2)
                    }));
                }
                return(new OrFilter(new QueryFilter[]
                {
                    new NotFilter(queryFilter),
                    queryFilter2
                }));
            }
        }
Beispiel #4
0
        public Result <ExchangeRoleAssignment>[] FindRoleAssignmentsByUserIds(ADObjectId[] securityPrincipalIds, bool partnerMode)
        {
            QueryFilter partnerFilter = RoleAssignmentFlagsFormat.GetPartnerFilter(partnerMode);

            return(this.FindRoleAssignmentsByUserIds(securityPrincipalIds, partnerFilter));
        }
 internal static GetterDelegate ScopeTypeGetterDelegate(RoleAssignmentFlagsFormat.Bitfields bitfield)
 {
     return((IPropertyBag propertyBag) => (ScopeType)RoleAssignmentFlagsFormat.GetBits(propertyBag, bitfield));
 }
 internal static void RoleAssigneeTypeSetter(object value, IPropertyBag propertyBag)
 {
     RoleAssignmentFlagsFormat.SetBits((ulong)((long)((RoleAssigneeType)value)), propertyBag, RoleAssignmentFlagsFormat.Bitfields.RoleAssigneeType);
 }
 internal static QueryFilter RoleAssigneeTypeFilterBuilder(SinglePropertyFilter filter)
 {
     return(RoleAssignmentFlagsFormat.RoleAssignmentFlagsFilterBuilder <RoleAssigneeType>(filter, RoleAssignmentFlagsFormat.Bitfields.RoleAssigneeType, (object propertyValue) => (ulong)((long)((RoleAssigneeType)propertyValue))));
 }
 internal static object RoleAssigneeTypeGetter(IPropertyBag propertyBag)
 {
     return((RoleAssigneeType)RoleAssignmentFlagsFormat.GetBits(propertyBag, RoleAssignmentFlagsFormat.Bitfields.RoleAssigneeType));
 }
 internal static QueryFilter RoleAssignmentEnabledFilterBuilder(SinglePropertyFilter filter)
 {
     return(RoleAssignmentFlagsFormat.RoleAssignmentFlagsFilterBuilder <bool>(filter, RoleAssignmentFlagsFormat.Bitfields.IsEnabled, (object propertyValue) => ((bool)propertyValue) ? 1UL : 0UL));
 }
 internal static void EnabledSetter(object value, IPropertyBag propertyBag)
 {
     RoleAssignmentFlagsFormat.SetBits((ulong)(((bool)value) ? 1L : 0L), propertyBag, RoleAssignmentFlagsFormat.Bitfields.IsEnabled);
 }
 internal static object EnabledGetter(IPropertyBag propertyBag)
 {
     return(RoleAssignmentFlagsFormat.GetBits(propertyBag, RoleAssignmentFlagsFormat.Bitfields.IsEnabled) != 0UL);
 }
 internal static object ConfigWriteScopeGetter(IPropertyBag propertyBag)
 {
     return((ConfigWriteScopeType)RoleAssignmentFlagsFormat.GetBits(propertyBag, RoleAssignmentFlagsFormat.Bitfields.ConfigWriteScope));
 }