Exemple #1
0
 public RecipientRow(ReducedRecipient recipient) : base(recipient.ToIdentity(), recipient)
 {
     this.PrimarySmtpAddress      = recipient.PrimarySmtpAddress.ToString();
     this.SpriteId                = Icons.FromEnum(recipient.RecipientTypeDetails);
     this.RecipientTypeDetails    = recipient.RecipientTypeDetails.ToString();
     this.LocRecipientTypeDetails = LocalizedDescriptionAttribute.FromEnum(typeof(RecipientTypeDetails), recipient.RecipientTypeDetails);
 }
        public static void GenerateName(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            ReducedRecipient reducedRecipient = store.GetDataObject("ReducedRecipient") as ReducedRecipient;
            string           text             = (string)inputRow["DisplayName"];

            if (reducedRecipient != null)
            {
                string text2 = " " + Guid.NewGuid().ToString("B").ToUpperInvariant();
                if (text.Length > 64)
                {
                    text = text.SurrogateSubstring(0, text.Length - text2.Length);
                }
                inputRow["Name"] = text + text2;
            }
            else
            {
                if (text.Length > 64)
                {
                    text = text.SurrogateSubstring(0, 64);
                }
                inputRow["Name"] = text;
            }
            store.SetModifiedColumns(new List <string>
            {
                "Name"
            });
        }
        private void ExpandGroupMembership(ReducedRecipient groupRecipient, MultiValuedProperty <BindingMetadata> validatedRecipients)
        {
            QueryFilter filter = QueryFilter.AndTogether(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.MemberOfGroup, groupRecipient.Guid),
                new ComparisonFilter(ComparisonOperator.Equal, SharedPropertyDefinitions.FfoExpansionSizeUpperBoundFilter, this.maxRecipientsLimit)
            });

            try
            {
                ADPagedReader <ADRawEntry> adpagedReader = this.recipientSession.FindPagedADRawEntry(null, QueryScope.SubTree, filter, null, 1000, ExchangeValidator.memberOfProperties);
                foreach (ADRawEntry adrawEntry in adpagedReader)
                {
                    RecipientIdParameter arg       = RecipientIdParameter.Parse(adrawEntry.Id.ObjectGuid.ToString());
                    ReducedRecipient     recipient = this.recipientGetter(arg, this.recipientSession);
                    this.VerifyAndAddRecipient(recipient, validatedRecipients, true);
                }
            }
            catch (FfoSizeLimitReachedException ex)
            {
                base.LogOneEntry(ExecutionLog.EventType.Error, "InvalidArgument: {0}, Exception: {1}", new object[]
                {
                    Strings.ErrorMaxMailboxLimitReachedInGroupExpansion(this.maxRecipientsLimit),
                    ex
                });
                base.WriteError(new ExValidatorException(Strings.ErrorMaxMailboxLimitReachedInGroupExpansion(this.maxRecipientsLimit), ex), ErrorCategory.InvalidArgument);
            }
        }
Exemple #4
0
        public static bool UserHasArchive(ReducedRecipient user)
        {
            bool result = false;

            if (user != null)
            {
                result = (user.ArchiveState == ArchiveState.Local || user.ArchiveState == ArchiveState.HostedProvisioned);
            }
            return(result);
        }
 public MailboxRecipientRow(ReducedRecipient recipient) : base(recipient)
 {
     this.Recipient              = recipient;
     this.IsUserManaged          = (recipient.RecipientTypeDetails == Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails.UserMailbox && recipient.AuthenticationType == AuthenticationType.Managed);
     this.IsUserFederated        = (recipient.RecipientTypeDetails == Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails.UserMailbox && recipient.AuthenticationType == AuthenticationType.Federated);
     this.IsRoom                 = (recipient.RecipientTypeDetails == Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails.RoomMailbox);
     this.Type                   = recipient.RecipientTypeDetails.ToString();
     this.IsResetPasswordAllowed = RbacPrincipal.Current.RbacConfiguration.IsCmdletAllowedInScope("Set-Mailbox", new string[]
     {
         "Password"
     }, recipient, ScopeLocation.RecipientWrite);
     this.IsKeepWindowsLiveIdAllowed = RbacPrincipal.Current.IsInRole("Remove-Mailbox?KeepWindowsLiveId@W:Organization");
     this.MailboxType = MailboxRecipientRow.GenerateMailboxTypeText(recipient.RecipientTypeDetails, recipient.ArchiveGuid, this.IsUserFederated);
     base.SpriteId    = Icons.FromEnum(recipient.RecipientTypeDetails, recipient.ArchiveGuid, this.IsUserFederated);
 }
Exemple #6
0
        // Token: 0x06000B61 RID: 2913 RVA: 0x0002437C File Offset: 0x0002257C
        public bool AcceptElement(T element)
        {
            if (element == null)
            {
                return(false);
            }
            IList       list        = this.recipientTypes;
            ADRecipient adrecipient = element as ADRecipient;

            if (adrecipient != null)
            {
                return(list.Contains(adrecipient.RecipientType));
            }
            ReducedRecipient reducedRecipient = element as ReducedRecipient;

            return(reducedRecipient != null && list.Contains(reducedRecipient.RecipientType));
        }
Exemple #7
0
        public override CapabilityEvaluationResult Evaluate(ADRawEntry adObject)
        {
            if (adObject == null)
            {
                throw new ArgumentNullException("adObject");
            }
            ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Entering MasteredOnPremiseCapabilityIdentifierEvaluator.Evaluate('{0}') CapabilityToCheck '{1}'.", adObject.GetDistinguishedNameOrName(), base.Capability.ToString());
            if (!Datacenter.IsMultiTenancyEnabled())
            {
                ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "MasteredOnPremiseCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}' - not datacenter mode.", adObject.GetDistinguishedNameOrName(), CapabilityEvaluationResult.NotApplicable.ToString(), base.Capability.ToString());
                return(CapabilityEvaluationResult.NotApplicable);
            }
            ADRecipient      adrecipient      = adObject as ADRecipient;
            ReducedRecipient reducedRecipient = adObject as ReducedRecipient;

            if (adrecipient == null && reducedRecipient == null)
            {
                ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "MasteredOnPremiseCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}' - adObject in not ADRecipient or ReducedRecipient.", adObject.GetDistinguishedNameOrName(), CapabilityEvaluationResult.NotApplicable.ToString(), base.Capability.ToString());
                return(CapabilityEvaluationResult.NotApplicable);
            }
            if ((adrecipient == null || !adrecipient.IsDirSyncEnabled) && (reducedRecipient == null || !reducedRecipient.IsDirSyncEnabled))
            {
                ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "MasteredOnPremiseCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}' - recipient is not Dirsynced.", adObject.GetDistinguishedNameOrName(), CapabilityEvaluationResult.No.ToString(), base.Capability.ToString());
                return(CapabilityEvaluationResult.No);
            }
            OrganizationId organizationId = (adrecipient != null) ? adrecipient.OrganizationId : reducedRecipient.OrganizationId;

            if (organizationId == null || OrganizationId.ForestWideOrgId.Equals(organizationId))
            {
                ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "MasteredOnPremiseCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}' - recipient does not belong to tenant scope.", adObject.GetDistinguishedNameOrName(), CapabilityEvaluationResult.NotApplicable.ToString(), base.Capability.ToString());
                return(CapabilityEvaluationResult.NotApplicable);
            }
            ExchangeConfigurationUnit exchangeConfigurationUnit = this.GetExchangeConfigurationUnit(organizationId);

            if (exchangeConfigurationUnit == null)
            {
                ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "MasteredOnPremiseCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}' - recipient is not in tenant scope.", adObject.GetDistinguishedNameOrName(), CapabilityEvaluationResult.NotApplicable.ToString(), base.Capability.ToString());
                return(CapabilityEvaluationResult.NotApplicable);
            }
            CapabilityEvaluationResult capabilityEvaluationResult = exchangeConfigurationUnit.IsDirSyncEnabled ? CapabilityEvaluationResult.Yes : CapabilityEvaluationResult.No;

            ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "MasteredOnPremiseCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}'", adObject.GetDistinguishedNameOrName(), capabilityEvaluationResult.ToString(), base.Capability.ToString());
            return(capabilityEvaluationResult);
        }
Exemple #8
0
        internal ReducedRecipient GetRecipientObject(Identity identity)
        {
            Identity         identity2 = identity;
            ReducedRecipient result    = null;

            if (null == identity2 && RbacPrincipal.Current.ExecutingUserId != null)
            {
                identity2 = Identity.FromExecutingUserId();
            }
            if (null != identity2)
            {
                PowerShellResults <MailboxRecipientRow> @object = base.GetObject <MailboxRecipientRow>("Get-Recipient", identity2, false);
                if (@object.SucceededWithValue)
                {
                    result = @object.Value.Recipient;
                }
            }
            return(result);
        }
Exemple #9
0
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            DistributionGroupIdParameter @object = new DistributionGroupIdParameter(base.RawIdentity);
            ReducedRecipient             object2 = base.GetObject <ReducedRecipient>(rootId, session, subTreeSession, optionalData, new RecipientIdParameter.GetObjectsDelegate <ReducedRecipient>(@object.GetObjects <ReducedRecipient>), out notFoundReason);

            if (object2 == null)
            {
                return(EnumerableWrapper <T> .Empty);
            }
            if (object2.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox || object2.RecipientTypeDetails == RecipientTypeDetails.RemoteGroupMailbox)
            {
                throw new ArgumentException(Strings.WrongTypeMailboxRecipient(object2.Id.ToString()));
            }
            IDirectorySession directorySession        = TaskHelper.UnderscopeSessionToOrganization(session, object2.OrganizationId, true);
            IDirectorySession reducedRecipientSession = DirectorySessionFactory.Default.GetReducedRecipientSession((IRecipientSession)directorySession, 155, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\RecipientParameters\\DistributionGroupMemberIdParameter.cs");
            QueryFilter       filter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.MemberOfGroup, object2.Id);

            return(base.PerformPrimarySearch <T>(filter, null, reducedRecipientSession, true, optionalData));
        }
Exemple #10
0
        public override CapabilityEvaluationResult Evaluate(ADRawEntry adObject)
        {
            if (adObject == null)
            {
                throw new ArgumentNullException("adObject");
            }
            ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Entering FederatedUserCapabilityIdentifierEvaluator.Evaluate('{0}') CapabilityToCheck '{1}'.", adObject.GetDistinguishedNameOrName(), base.Capability.ToString());
            CapabilityEvaluationResult capabilityEvaluationResult = CapabilityEvaluationResult.NotApplicable;
            ADUser           aduser           = adObject as ADUser;
            ReducedRecipient reducedRecipient = adObject as ReducedRecipient;

            if (aduser == null && reducedRecipient == null)
            {
                ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "FederatedUserCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}' - adObject in not ADUser/ReducedRecipient.", adObject.GetDistinguishedNameOrName(), capabilityEvaluationResult.ToString(), base.Capability.ToString());
                return(capabilityEvaluationResult);
            }
            SmtpAddress value = (aduser != null) ? aduser.WindowsLiveID : reducedRecipient.WindowsLiveID;

            if (value == SmtpAddress.Empty || value.Domain == null)
            {
                ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "FederatedUserCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}' - user/recipient is not Live enabled.", adObject.GetDistinguishedNameOrName(), capabilityEvaluationResult.ToString(), base.Capability.ToString());
                return(capabilityEvaluationResult);
            }
            OrganizationId organizationId = (aduser != null) ? aduser.OrganizationId : reducedRecipient.OrganizationId;

            if (organizationId == null || OrganizationId.ForestWideOrgId.Equals(organizationId))
            {
                ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "FederatedUserCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}' - user/recipient does not belong to tenant scope.", adObject.GetDistinguishedNameOrName(), capabilityEvaluationResult.ToString(), base.Capability.ToString());
                return(capabilityEvaluationResult);
            }
            IConfigurationSession     tenantScopedSystemConfigurationSession = base.GetTenantScopedSystemConfigurationSession(organizationId);
            ExchangeConfigurationUnit exchangeConfigurationUnit = tenantScopedSystemConfigurationSession.Read <ExchangeConfigurationUnit>(organizationId.ConfigurationUnit);

            if (exchangeConfigurationUnit == null)
            {
                ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "FederatedUserCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}' - user/recipient does is not in tenant scope.", adObject.GetDistinguishedNameOrName(), capabilityEvaluationResult.ToString(), base.Capability.ToString());
                return(capabilityEvaluationResult);
            }
            capabilityEvaluationResult = (((exchangeConfigurationUnit.ObjectVersion < 13000) ? exchangeConfigurationUnit.IsFederated : FederatedUserCapabilityIdentifierEvaluator.IsNamespaceFederated(organizationId, value.Domain)) ? CapabilityEvaluationResult.Yes : CapabilityEvaluationResult.No);
            ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "FederatedUserCapabilityIdentifierEvaluator.Evaluate('{0}') return '{1}'. CapabilityToCheck '{2}'", adObject.GetDistinguishedNameOrName(), capabilityEvaluationResult.ToString(), base.Capability.ToString());
            return(capabilityEvaluationResult);
        }
 private void VerifyAndAddRecipient(ReducedRecipient recipient, MultiValuedProperty <BindingMetadata> validatedRecipients, bool inGroupExpansion)
 {
     if (ExchangeValidator.IsValidRecipientType(recipient))
     {
         if (!validatedRecipients.Any((BindingMetadata p) => string.Equals(recipient.ExternalDirectoryObjectId, p.ImmutableIdentity, StringComparison.OrdinalIgnoreCase)))
         {
             if (validatedRecipients.Count < this.maxRecipientsLimit)
             {
                 validatedRecipients.Add(new BindingMetadata(recipient.Name, recipient.PrimarySmtpAddress.ToString(), recipient.ExternalDirectoryObjectId, PolicyBindingTypes.IndividualResource));
                 return;
             }
             base.LogOneEntry(ExecutionLog.EventType.Error, "InvalidArgument: {0}", new object[]
             {
                 Strings.ErrorMaxMailboxLimitReachedInGroupExpansion(this.maxRecipientsLimit)
             });
             base.WriteError(new ExValidatorException(Strings.ErrorMaxMailboxLimitReachedInGroupExpansion(this.maxRecipientsLimit)), ErrorCategory.InvalidArgument);
             return;
         }
     }
     else
     {
         if (inGroupExpansion)
         {
             if (!this.warnedSkipInvalidTypeInGroup)
             {
                 this.warnedSkipInvalidTypeInGroup = true;
                 base.WriteWarning(Strings.SkippingInvalidTypeInGroupExpansion);
             }
             base.LogOneEntry(ExecutionLog.EventType.Warning, "Invalid group member '{0}' skipped as the type '{1}' is not supported", new object[]
             {
                 recipient.PrimarySmtpAddress.ToString(),
                 recipient.RecipientTypeDetails
             });
             return;
         }
         base.LogOneEntry(ExecutionLog.EventType.Error, "InvalidArgument: {0}", new object[]
         {
             Strings.ErrorInvalidRecipientType(recipient.PrimarySmtpAddress.ToString(), recipient.RecipientTypeDetails.ToString())
         });
         base.WriteError(new ExValidatorException(Strings.ErrorInvalidRecipientType(recipient.PrimarySmtpAddress.ToString(), recipient.RecipientTypeDetails.ToString())), ErrorCategory.InvalidArgument);
     }
 }
Exemple #12
0
        protected override bool ShouldSkipObject(IConfigurable dataObject)
        {
            if (dataObject is PagedPositionInfo)
            {
                return(false);
            }
            RecipientType        recipientType;
            RecipientTypeDetails recipientTypeDetails;

            if (dataObject is ReducedRecipient)
            {
                ReducedRecipient reducedRecipient = dataObject as ReducedRecipient;
                recipientType        = reducedRecipient.RecipientType;
                recipientTypeDetails = reducedRecipient.RecipientTypeDetails;
            }
            else
            {
                ADRecipient adrecipient = dataObject as ADRecipient;
                recipientType        = adrecipient.RecipientType;
                recipientTypeDetails = adrecipient.RecipientTypeDetails;
            }
            return(Array.IndexOf <RecipientType>(this.RecipientTypes, recipientType) == -1 || (this.InternalRecipientTypeDetails != null && this.InternalRecipientTypeDetails.Length > 0 && Array.IndexOf <RecipientTypeDetails>(this.InternalRecipientTypeDetails, recipientTypeDetails) == -1));
        }
 private static bool IsMembershipGroup(ReducedRecipient recipient)
 {
     return(recipient.RecipientTypeDetails.HasFlag(RecipientTypeDetails.MailNonUniversalGroup) || recipient.RecipientTypeDetails.HasFlag(RecipientTypeDetails.MailUniversalDistributionGroup) || recipient.RecipientTypeDetails.HasFlag(RecipientTypeDetails.MailUniversalSecurityGroup));
 }
 private static bool IsValidRecipientType(ReducedRecipient recipient)
 {
     return(recipient.RecipientTypeDetails.HasFlag(RecipientTypeDetails.MailUser));
 }
 // Token: 0x06000A60 RID: 2656 RVA: 0x000229C6 File Offset: 0x00020BC6
 public GeneralMailboxIdParameter(ReducedRecipient reducedRecipient) : this(reducedRecipient.Id)
 {
 }
Exemple #16
0
 public RecipientWithAdUserIdParameter(ReducedRecipient recipient) : base(recipient.Id)
 {
 }
 public LogonableObjectIdParameter(ReducedRecipient reducedRecipient) : base(reducedRecipient)
 {
 }
Exemple #18
0
 public DistributionGroupMemberIdParameter(ReducedRecipient recipient) : base(recipient.Id)
 {
 }
Exemple #19
0
 public UMMailboxPickerObject(ReducedRecipient recipient) : base(recipient)
 {
 }
Exemple #20
0
 // Token: 0x06000D1B RID: 3355 RVA: 0x00028337 File Offset: 0x00026537
 public GeneralRecipientIdParameter(ReducedRecipient recipient) : base(recipient.Id)
 {
 }
 public RecipientPickerObject(ReducedRecipient recipient) : base(recipient.ToIdentity(), recipient)
 {
     this.Recipient = recipient;
 }
        private MultiValuedProperty <BindingMetadata> ValidateRecipientsImpl(IEnumerable <string> recipients)
        {
            MultiValuedProperty <BindingMetadata> multiValuedProperty = new MultiValuedProperty <BindingMetadata>();
            bool flag = false;

            this.warnedSkipInvalidTypeInGroup = false;
            if (recipients.Count <string>() > this.maxRecipientsLimit)
            {
                base.LogOneEntry(ExecutionLog.EventType.Error, "InvalidArgument: {0}", new object[]
                {
                    Strings.ErrorMaxMailboxLimit(this.maxRecipientsLimit, recipients.Count <string>())
                });
                base.WriteError(new ExValidatorException(Strings.ErrorMaxMailboxLimit(this.maxRecipientsLimit, recipients.Count <string>())), ErrorCategory.InvalidArgument);
            }
            else
            {
                foreach (string text in recipients)
                {
                    if (SourceValidator.IsWideScope(text))
                    {
                        base.LogOneEntry(ExecutionLog.EventType.Verbose, "Skipping validation for wide scoped value '{0}", new object[]
                        {
                            text
                        });
                        multiValuedProperty.Add(new BindingMetadata(text, text, text, SourceValidator.GetBindingType(text)));
                    }
                    else
                    {
                        RecipientIdParameter recipientIdParameter = RecipientIdParameter.Parse(text);
                        ReducedRecipient     reducedRecipient     = this.recipientGetter(recipientIdParameter, this.recipientSession);
                        if (ExchangeValidator.IsMembershipGroup(reducedRecipient) && this.allowGroups)
                        {
                            if (!flag)
                            {
                                if (base.ShouldContinue(Strings.ShouldExpandGroups))
                                {
                                    flag = true;
                                    base.LogOneEntry(ExecutionLog.EventType.Information, "Got confirmation to expand groups", new object[0]);
                                }
                                else
                                {
                                    base.LogOneEntry(ExecutionLog.EventType.Error, "User selected not to expand groups. {0}", new object[]
                                    {
                                        Strings.GroupsIsNotAllowedForHold(recipientIdParameter.RawIdentity)
                                    });
                                    base.WriteError(new ExValidatorException(Strings.GroupsIsNotAllowedForHold(recipientIdParameter.RawIdentity)), ErrorCategory.InvalidArgument);
                                }
                            }
                            if (flag)
                            {
                                this.ExpandGroupMembership(reducedRecipient, multiValuedProperty);
                            }
                        }
                        else
                        {
                            this.VerifyAndAddRecipient(reducedRecipient, multiValuedProperty, false);
                        }
                    }
                }
            }
            return(multiValuedProperty);
        }
Exemple #23
0
 public static Identity ToIdentity(this ReducedRecipient entry)
 {
     return(entry.Id.ToIdentity(entry.DisplayName));
 }
Exemple #24
0
 public DistributionGroupRow(ReducedRecipient distributionGroup) : base(distributionGroup)
 {
     this.Initalize(distributionGroup.RecipientTypeDetails);
 }
 public GroupRecipientRow(ReducedRecipient recipient) : base(recipient)
 {
     this.DistinguishedName = recipient.DistinguishedName;
 }