Ejemplo n.º 1
0
        private static bool IsACLableSyncedObjectEnabled(ADUser source, MailboxMoveHelper.Scenario scenario)
        {
            bool  result          = false;
            Trace exceptionTracer = ExTraceGlobals.ExceptionTracer;

            if (!MailboxMoveHelper.IsCrossPremiseScenario(scenario))
            {
                result = true;
            }
            else if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled)
            {
                try
                {
                    IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(source.OrganizationId), 605, "IsACLableSyncedObjectEnabled", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Common\\recipient\\MailboxMoveHelper.cs");
                    ADObjectId            orgContainerId       = tenantOrTopologyConfigurationSession.GetOrgContainerId();
                    ADOrganizationConfig  adorganizationConfig = tenantOrTopologyConfigurationSession.Read <ADOrganizationConfig>(orgContainerId);
                    if (adorganizationConfig != null)
                    {
                        result = adorganizationConfig.ACLableSyncedObjectEnabled;
                    }
                }
                catch (LocalizedException ex)
                {
                    exceptionTracer.TraceWarning(100L, ex.Message);
                }
                catch (Exception ex2)
                {
                    exceptionTracer.TraceWarning(200L, ex2.Message);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
 private static RecipientTypeDetails CalculateLegacyMailboxRTD(ADUser user)
 {
     if (MailboxMoveHelper.IsLinkedAccount(user))
     {
         return(RecipientTypeDetails.LinkedMailbox);
     }
     if (MailboxMoveHelper.IsSelfSid(user.MasterAccountSid))
     {
         return(RecipientTypeDetails.SharedMailbox);
     }
     return(RecipientTypeDetails.UserMailbox);
 }
Ejemplo n.º 3
0
        private static RecipientTypeDetails CalculateSourceRTD(ADUser source, int sourceServerVersion, MailboxMoveHelper.Scenario scenario)
        {
            RecipientTypeDetails result;

            if (scenario == MailboxMoveHelper.Scenario.CrossPremiseOnboarding && MailboxMoveHelper.IsRemoteMailboxTypeDefined(sourceServerVersion))
            {
                RecipientTypeDetails recipientTypeDetails = source.RecipientTypeDetails;
                if (recipientTypeDetails <= RecipientTypeDetails.RoomMailbox)
                {
                    if (recipientTypeDetails <= RecipientTypeDetails.SharedMailbox)
                    {
                        if (recipientTypeDetails < RecipientTypeDetails.UserMailbox)
                        {
                            goto IL_91;
                        }
                        switch ((int)(recipientTypeDetails - RecipientTypeDetails.UserMailbox))
                        {
                        case 0:
                        case 1:
                        case 2:
                            goto IL_91;

                        case 3:
                            return(RecipientTypeDetails.RemoteSharedMailbox);
                        }
                    }
                    if (recipientTypeDetails == RecipientTypeDetails.RoomMailbox)
                    {
                        return(RecipientTypeDetails.RemoteRoomMailbox);
                    }
                }
                else
                {
                    if (recipientTypeDetails == RecipientTypeDetails.EquipmentMailbox)
                    {
                        return(RecipientTypeDetails.RemoteEquipmentMailbox);
                    }
                    if (recipientTypeDetails == RecipientTypeDetails.TeamMailbox)
                    {
                        return(RecipientTypeDetails.RemoteTeamMailbox);
                    }
                }
IL_91:
                result = (RecipientTypeDetails)((ulong)int.MinValue);
            }
            else
            {
                result = RecipientTypeDetails.MailUser;
            }
            return(result);
        }
Ejemplo n.º 4
0
 private static void UpdateRecipientTypeProperties(ADUser source, int sourceServerVersion, ADUser target, int targetServerVersion, MailboxMoveHelper.Scenario scenario, MailboxMoveType moveType, MailboxMoveTransition transition)
 {
     if (!MailboxMoveHelper.IsMovingPrimary(moveType))
     {
         return;
     }
     if (scenario == MailboxMoveHelper.Scenario.CrossPremiseOnboarding && transition == MailboxMoveTransition.UpdateSourceUser && MailboxMoveHelper.IsRemoteMailboxTypeDefined(sourceServerVersion))
     {
         source.RemoteRecipientType = MailboxMoveHelper.CalculateSourceRRT(source.RecipientTypeDetails);
     }
     else if (scenario == MailboxMoveHelper.Scenario.CrossPremiseOffboarding && transition == MailboxMoveTransition.UpdateTargetUser && MailboxMoveHelper.IsRemoteMailboxTypeDefined(targetServerVersion))
     {
         target.RemoteRecipientType = RemoteRecipientType.Migrated;
     }
     if (transition == MailboxMoveTransition.UpdateTargetUser)
     {
         RecipientTypeDetails recipientTypeDetails = (source.RecipientTypeDetails != RecipientTypeDetails.None) ? source.RecipientTypeDetails : MailboxMoveHelper.CalculateLegacyMailboxRTD(source);
         if (target.MasterAccountSid == null && MailboxMoveHelper.IsResourceOrShared(recipientTypeDetails))
         {
             target.MasterAccountSid = new SecurityIdentifier(WellKnownSidType.SelfSid, null);
         }
         if (MailboxMoveHelper.IsRTDRDTDefined(targetServerVersion))
         {
             target.RecipientTypeDetails = MailboxMoveHelper.CalculateTargetRTD(recipientTypeDetails, MailboxMoveHelper.IsLinkedAccount(target));
             target.RecipientDisplayType = new RecipientDisplayType?(MailboxMoveHelper.CalculateTargetRDT(target.RecipientTypeDetails, MailboxMoveHelper.IsSecurityPrincipal(target)));
         }
         else
         {
             target.RecipientTypeDetails = RecipientTypeDetails.None;
             target.RecipientDisplayType = null;
         }
     }
     if (transition == MailboxMoveTransition.UpdateSourceUser)
     {
         if (MailboxMoveHelper.IsRTDRDTDefined(sourceServerVersion))
         {
             source.RecipientDisplayType = new RecipientDisplayType?(MailboxMoveHelper.CalculateSourceRDT(source.RecipientTypeDetails, MailboxMoveHelper.IsACLableSyncedObjectEnabled(source, scenario) && MailboxMoveHelper.IsSecurityPrincipal(source)));
             source.RecipientTypeDetails = MailboxMoveHelper.CalculateSourceRTD(source, sourceServerVersion, scenario);
             return;
         }
         source.RecipientTypeDetails = RecipientTypeDetails.None;
         source.RecipientDisplayType = null;
     }
 }
Ejemplo n.º 5
0
 private static void UpdateRecipientTypePropertiesForIntraOrg(ADUser target, int targetServerVersion)
 {
     if (MailboxMoveHelper.IsRTDRDTDefined(targetServerVersion))
     {
         RecipientTypeDetails recipientTypeDetails  = target.RecipientTypeDetails;
         RecipientTypeDetails recipientTypeDetails2 = (recipientTypeDetails == RecipientTypeDetails.None || recipientTypeDetails == RecipientTypeDetails.LegacyMailbox) ? MailboxMoveHelper.CalculateLegacyMailboxRTD(target) : recipientTypeDetails;
         target.RecipientTypeDetails = recipientTypeDetails2;
         if (target.RecipientDisplayType == null || recipientTypeDetails != recipientTypeDetails2)
         {
             target.RecipientDisplayType = new RecipientDisplayType?(MailboxMoveHelper.CalculateTargetRDT(target.RecipientTypeDetails, MailboxMoveHelper.IsSecurityPrincipal(target)));
             return;
         }
     }
     else
     {
         target.RecipientTypeDetails = RecipientTypeDetails.None;
         target.RecipientDisplayType = null;
     }
 }
Ejemplo n.º 6
0
 public static void UpdateRecipientTypeProperties(ADUser source, UserHoster sourceHoster, int sourceServerVersion, ADUser target, UserHoster targetHoster, int targetServerVersion, MailboxMoveType moveType, MailboxMoveTransition transition)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     if (transition == MailboxMoveTransition.IntraOrg)
     {
         if (MailboxMoveHelper.IsMovingPrimary(moveType))
         {
             MailboxMoveHelper.UpdateRecipientTypePropertiesForIntraOrg(target, targetServerVersion);
         }
         return;
     }
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if (!source.propertyBag.Contains(ADUserSchema.UserAccountControl))
     {
         throw new ArgumentException("Source ADUser missed property: UserAccountControl", "source");
     }
     if (!target.propertyBag.Contains(ADUserSchema.UserAccountControl))
     {
         throw new ArgumentException("Target ADUser missed property: UserAccountControl", "target");
     }
     if (transition == MailboxMoveTransition.UpdateSourceUser && sourceServerVersion == 0)
     {
         throw new ArgumentException("Version of source mailbox server is required", "sourceServerVersion");
     }
     if (transition == MailboxMoveTransition.UpdateTargetUser && targetServerVersion == 0)
     {
         throw new ArgumentException("Version of target mailbox server is required", "targetServerVersion");
     }
     MailboxMoveHelper.Scenario scenario = MailboxMoveHelper.GetScenario(sourceHoster, targetHoster);
     if (scenario == MailboxMoveHelper.Scenario.CrossPremiseOnboarding && sourceServerVersion < Server.E14SP1MinVersion)
     {
         sourceServerVersion = Server.E14SP1MinVersion;
     }
     MailboxMoveHelper.UpdateRecipientTypeProperties(source, sourceServerVersion, target, targetServerVersion, scenario, moveType, transition);
 }
Ejemplo n.º 7
0
 private static bool IsSecurityPrincipal(ADUser user)
 {
     return(!MailboxMoveHelper.IsSelfSid(user.MasterAccountSid) && ((user.UserAccountControl & UserAccountControlFlags.AccountDisabled) == UserAccountControlFlags.None || MailboxMoveHelper.IsLinkedAccount(user)));
 }