// Token: 0x06000AFB RID: 2811 RVA: 0x00023698 File Offset: 0x00021898
        private OrganizationId ResolveOrganizationId(OrganizationId originalOrgId)
        {
            if (!OrganizationId.ForestWideOrgId.Equals(originalOrgId) || !base.IsMultitenancyEnabled())
            {
                return(originalOrgId);
            }
            string     text = null;
            ADObjectId adobjectId;

            if (base.InternalADObjectId != null)
            {
                text = base.InternalADObjectId.DistinguishedName;
            }
            else if (ADIdParameter.TryResolveCanonicalName(base.RawIdentity, out adobjectId))
            {
                text = adobjectId.DistinguishedName;
            }
            string orgName = base.RawIdentity;

            if (!string.IsNullOrEmpty(text))
            {
                try
                {
                    orgName = OrganizationIdParameter.GetHierarchicalIdentityFromDN(text);
                }
                catch (FormatException)
                {
                }
            }
            return(base.GetOrganizationId(originalOrgId, orgName));
        }
Esempio n. 2
0
 // Token: 0x06000849 RID: 2121 RVA: 0x0001E134 File Offset: 0x0001C334
 internal string GetDistinguishedName(IDirectorySession session)
 {
     if (session == null)
     {
         throw new ArgumentNullException("session");
     }
     if (base.InternalADObjectId == null && base.RawIdentity == null)
     {
         throw new InvalidOperationException(Strings.ErrorUninitializedParameter);
     }
     if (base.InternalADObjectId == null || string.IsNullOrEmpty(base.InternalADObjectId.DistinguishedName))
     {
         ADObjectId internalADObjectId = base.InternalADObjectId;
         if (internalADObjectId != null || ADIdParameter.TryResolveCanonicalName(base.RawIdentity, out internalADObjectId))
         {
             ADRawEntry adrawEntry = session.ReadADRawEntry(internalADObjectId, new ADPropertyDefinition[]
             {
                 ADObjectSchema.Id
             });
             if (adrawEntry != null)
             {
                 base.UpdateInternalADObjectId(adrawEntry.Id);
             }
         }
         if (base.InternalADObjectId == null || string.IsNullOrEmpty(base.InternalADObjectId.DistinguishedName))
         {
             throw new NameConversionException(Strings.ErrorConversionFailed(base.RawIdentity));
         }
     }
     return(base.InternalADObjectId.DistinguishedName);
 }
        internal MailboxIdParameter GetMailboxId()
        {
            ADObjectId internalADObjectId = base.InternalADObjectId;

            if (internalADObjectId == null)
            {
                ADIdParameter.TryResolveCanonicalName(base.RawIdentity, out internalADObjectId);
            }
            if (internalADObjectId == null || internalADObjectId.Parent == null || internalADObjectId.Parent.Parent == null)
            {
                return(null);
            }
            return(new MailboxIdParameter(internalADObjectId.Parent.Parent));
        }
Esempio n. 4
0
 protected virtual void ResolveCurrentOrgIdBasedOnIdentity(IIdentityParameter identity)
 {
     if (this.ShouldSupportPreResolveOrgIdBasedOnIdentity() && base.CurrentOrganizationId != null && base.CurrentOrganizationId.Equals(OrganizationId.ForestWideOrgId))
     {
         ADIdParameter adidParameter = identity as ADIdParameter;
         if (adidParameter != null)
         {
             OrganizationId organizationId = adidParameter.ResolveOrganizationIdBasedOnIdentity(base.ExecutingUserOrganizationId);
             if (organizationId != null && !organizationId.Equals(base.CurrentOrganizationId))
             {
                 this.SetCurrentOrganizationWithScopeSet(organizationId);
             }
         }
     }
 }
Esempio n. 5
0
        private void Task_PreIterate(object sender, EventArgs e)
        {
            ADIdParameter adidParameter = base.CurrentTaskContext.InvocationInfo.Fields["Identity"] as ADIdParameter;

            if (adidParameter != null && adidParameter.HasRedactedPiiData)
            {
                if (adidParameter.IsRedactedPiiResolved)
                {
                    base.CurrentTaskContext.CommandShell.WriteDebug(new LocalizedString("Redacted PII value in the Identity has been resolved."));
                    return;
                }
                if (base.CurrentTaskContext.ExchangeRunspaceConfig != null && base.CurrentTaskContext.ExchangeRunspaceConfig.EnablePiiMap)
                {
                    base.CurrentTaskContext.CommandShell.WriteWarning(new LocalizedString("The Identity looks like containing redacted PII value. Unfortunately it failed to resolve the redacted PII value in the Identity."));
                }
            }
        }
Esempio n. 6
0
        internal virtual OrganizationId ResolveOrganizationIdBasedOnIdentity(OrganizationId executingUserOrgId)
        {
            if (this.orgIdResolved)
            {
                return(this.resolvedOrganizationId);
            }
            if (!this.IsMultitenancyEnabled())
            {
                return(OrganizationId.ForestWideOrgId);
            }
            if (executingUserOrgId != null && !executingUserOrgId.Equals(OrganizationId.ForestWideOrgId))
            {
                return(executingUserOrgId);
            }
            ADObjectId id = null;
            string     text;
            string     text2;

            if (this.adObjectId != null)
            {
                this.resolvedOrganizationId = this.GetOrganizationId(executingUserOrgId, this.adObjectId);
            }
            else if (ADIdParameter.TryResolveCanonicalName(this.RawIdentity, out id))
            {
                this.resolvedOrganizationId = this.GetOrganizationId(executingUserOrgId, id);
            }
            else if (this.TryParseOrganizationName(out text, out text2))
            {
                if (this.IsWildcardDefined(text))
                {
                    this.resolvedOrganizationId = OrganizationId.ForestWideOrgId;
                }
                else
                {
                    this.resolvedOrganizationId = this.GetOrganizationId(executingUserOrgId, text);
                }
            }
            else
            {
                this.resolvedOrganizationId = null;
            }
            this.orgIdResolved = true;
            return(this.resolvedOrganizationId);
        }
Esempio n. 7
0
        internal IEnumerable <T> GetExactMatchObjects <T>(ADObjectId rootId, IDirectorySession session, OptionalIdentityData optionalData) where T : IConfigurable, new()
        {
            EnumerableWrapper <T> enumerableWrapper = EnumerableWrapper <T> .Empty;
            ADObjectId            identity;

            if (this.InternalADObjectId != null)
            {
                enumerableWrapper = EnumerableWrapper <T> .GetWrapper(this.GetADObjectIdObjects <T>(this.InternalADObjectId, rootId, session, optionalData));
            }
            else if (ADIdParameter.TryResolveCanonicalName(this.RawIdentity, out identity))
            {
                enumerableWrapper = EnumerableWrapper <T> .GetWrapper(this.GetADObjectIdObjects <T>(identity, rootId, session, optionalData));

                if (enumerableWrapper.HasElements())
                {
                    this.UpdateInternalADObjectId(identity);
                }
            }
            return(enumerableWrapper);
        }
 // Token: 0x06000DBE RID: 3518 RVA: 0x000290C8 File Offset: 0x000272C8
 private static ADObjectId GetObjectIdFromCanonicalName(string canonicalName)
 {
     if (!string.IsNullOrEmpty(canonicalName))
     {
         string[] array = canonicalName.Split(new char[]
         {
             '/'
         });
         ADObjectId childId;
         if (array.Length == 3 && array[1].Equals("Deleted Objects", StringComparison.OrdinalIgnoreCase) && ADIdParameter.TryResolveCanonicalName(array[0], out childId))
         {
             childId = childId.GetChildId(array[1]);
             if (childId != null)
             {
                 return(childId.GetChildId(array[2]));
             }
         }
     }
     return(null);
 }