예제 #1
0
        // Token: 0x06000E78 RID: 3704 RVA: 0x00045564 File Offset: 0x00043764
        private static ADRawEntry ADRawEntryFromPropValues(ADObjectId id, bool createReadOnly, PropValue[] propValues, IEnumerable <MbxPropertyDefinition> properties, List <ValidationError> errors)
        {
            string        fqdn          = LocalServerCache.LocalServer.Fqdn;
            ADPropertyBag adpropertyBag = new ADPropertyBag(createReadOnly, 16);

            adpropertyBag.SetField(ADObjectSchema.Id, id);
            foreach (PropValue propValue in propValues)
            {
                if (!propValue.IsError())
                {
                    MbxPropertyDefinition   mbxPropertyDefinition   = ObjectSchema.GetInstance <MbxRecipientSchema>().FindPropertyDefinitionByPropTag(propValue.PropTag);
                    PropertyValidationError propertyValidationError = mbxPropertyDefinition.ValidateValue(propValue.Value, true);
                    if (propertyValidationError != null)
                    {
                        errors.Add(propertyValidationError);
                    }
                    adpropertyBag.SetField(mbxPropertyDefinition, SimpleStoreValueConverter.ConvertValueFromStore(mbxPropertyDefinition, propValue.Value));
                }
            }
            MbxRecipientSession.PopulateCustomizedCalculatedProperties(adpropertyBag, properties);
            ADRawEntry adrawEntry = new ADRawEntry(adpropertyBag);

            adrawEntry.OriginatingServer = fqdn;
            adrawEntry.WhenReadUTC       = new DateTime?(DateTime.UtcNow);
            adrawEntry.ResetChangeTracking(true);
            return(adrawEntry);
        }
예제 #2
0
        public static ADRawEntry PerformADLookup(ADObjectId identity, List <ADPropertyDefinition> properties)
        {
            ADUser        aduser        = (ADUser)TemplateTenantConfiguration.GetLocalTempateUser().Clone();
            ADPropertyBag adpropertyBag = new ADPropertyBag();

            foreach (ADPropertyDefinition adpropertyDefinition in properties)
            {
                adpropertyBag.SetField(adpropertyDefinition, aduser[adpropertyDefinition]);
                if (adpropertyDefinition.IsCalculated)
                {
                    foreach (ProviderPropertyDefinition providerPropertyDefinition in adpropertyDefinition.SupportingProperties)
                    {
                        ADPropertyDefinition adpropertyDefinition2 = (ADPropertyDefinition)providerPropertyDefinition;
                        adpropertyBag.SetField(adpropertyDefinition2, aduser[adpropertyDefinition2]);
                    }
                }
            }
            ADRawEntry adrawEntry = new ADRawEntry(adpropertyBag);

            adrawEntry.SetId(identity);
            adrawEntry.ValidateRead();
            adrawEntry.ResetChangeTracking(true);
            return(adrawEntry);
        }
예제 #3
0
        // Token: 0x06000EFF RID: 3839 RVA: 0x000484C4 File Offset: 0x000466C4
        private ADRawEntry ADRawEntryFromMservRecords(ulong puid, IList <MservRecord> mservRecords, IEnumerable <MServPropertyDefinition> properties, string originatingServerName, List <ValidationError> errors)
        {
            ADObjectId    adobjectIdFromPuid = ConsumerIdentityHelper.GetADObjectIdFromPuid(puid);
            ADPropertyBag adpropertyBag      = new ADPropertyBag(this.isReadOnly, 16);

            adpropertyBag.SetField(ADObjectSchema.Id, adobjectIdFromPuid);
            adpropertyBag.SetField(MServRecipientSchema.Puid, puid);
            foreach (MservRecord mservRecord in mservRecords)
            {
                object value = mservRecord;
                ProviderPropertyDefinition providerPropertyDefinition;
                switch (mservRecord.ResourceId)
                {
                case 0:
                    if (mservRecord.SourceKey == null)
                    {
                        providerPropertyDefinition = MServRecipientSchema.MservPrimaryRecord;
                    }
                    else
                    {
                        providerPropertyDefinition = MServRecipientSchema.MservEmailAddressesRecord;
                        value = new MultiValuedProperty <MservRecord>
                        {
                            mservRecord
                        };
                    }
                    break;

                case 1:
                    providerPropertyDefinition = MServRecipientSchema.MservSoftDeletedPrimaryRecord;
                    break;

                case 2:
                case 3:
                case 5:
                case 6:
                    goto IL_D0;

                case 4:
                    providerPropertyDefinition = MServRecipientSchema.MservCalendarRecord;
                    break;

                case 7:
                    providerPropertyDefinition = MServRecipientSchema.MservSecondaryRecord;
                    break;

                case 8:
                    providerPropertyDefinition = MServRecipientSchema.MservSoftDeletedCalendarRecord;
                    break;

                default:
                    goto IL_D0;
                }
                PropertyValidationError propertyValidationError = providerPropertyDefinition.ValidateValue(value, true);
                if (propertyValidationError != null)
                {
                    errors.Add(propertyValidationError);
                }
                adpropertyBag.SetField(providerPropertyDefinition, value);
                continue;
IL_D0:
                throw new NotSupportedException("Unexpected record received:" + mservRecord.ToString());
            }
            ADRawEntry adrawEntry = new ADRawEntry(adpropertyBag);

            adrawEntry.OriginatingServer = originatingServerName;
            adrawEntry.WhenReadUTC       = new DateTime?(DateTime.UtcNow);
            adrawEntry.IsCached          = false;
            adrawEntry.ValidateRead(errors, properties);
            adrawEntry.ResetChangeTracking(true);
            return(adrawEntry);
        }