Skip to content

Remove Directory property from Tenant #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public static void CopyFrom(this IAzureTenant tenant, IAzureTenant other)
if (tenant != null && other != null)
{
tenant.Id = other.Id;
tenant.Directory = other.Directory;
tenant.CopyPropertiesFrom(other);
}
}
Expand All @@ -52,7 +51,6 @@ public static void Update(this IAzureTenant tenant, IAzureTenant other)
{
if (tenant != null && other != null)
{
tenant.Directory = other.Directory?? tenant.Directory;
tenant.UpdateProperties(other);
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/Authentication.Abstractions/Interfaces/IAzureTenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,5 @@ public interface IAzureTenant : IExtensibleModel
/// The Tenant Identifier (GUID)
/// </summary>
string Id { get; set; }

/// <summary>
/// The dns name of the tenant directory (domain)
/// </summary>
string Directory { get; set; }
}
}
9 changes: 1 addition & 8 deletions src/Authentication.ResourceManager/Models/PSAzureTenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public PSAzureTenant(PSObject other)
}

this.Id = other.GetProperty<string>(nameof(Id));
this.Directory = other.GetProperty<string>(nameof(Directory));
this.PopulateExtensions(other);
}
/// <summary>
Expand All @@ -91,12 +90,6 @@ public PSAzureTenant(PSObject other)
[Ps1Xml(Label = "Id", Target = ViewControl.Table, Position = 0)]
public string Id { get; set; }

/// <summary>
/// The name of the subscription.
/// </summary>
[Ps1Xml(Label = "Directory", Target = ViewControl.Table, Position = 1)]
public string Directory { get; set; }

/// <summary>
/// For legacy support - the tenant id
/// </summary>
Expand All @@ -110,7 +103,7 @@ public PSAzureTenant(PSObject other)

public override string ToString()
{
return (this.Id == Guid.Empty.ToString()) ? this.Directory : this.Id;
return this.Id;
}
}
}
9 changes: 0 additions & 9 deletions src/Authentication.Test/Cmdlets/ConnectAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ private bool TryGetTenantSubscription(IAccessToken accessToken,

tenant = new AzureTenant();
tenant.Id = accessToken.TenantId;
tenant.Directory = accessToken.GetDomain();
return true;
}

Expand All @@ -604,14 +603,6 @@ private bool TryGetTenantSubscription(IAccessToken accessToken,
{
tenant = new AzureTenant();
tenant.Id = accessToken.TenantId;
if (accessToken.UserId != null)
{
var domain = accessToken.UserId.Split(new[] { '@' }, StringSplitOptions.RemoveEmptyEntries);
if (domain.Length == 2)
{
tenant.Directory = domain[1];
}
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public static bool CheckExtensionsEqual(this IExtensibleModel model, IExtensible
public static bool IsEqual(this IAzureTenant baseTenant, IAzureTenant other)
{
return (baseTenant == null && other == null) || (baseTenant.CheckExtensionsEqual(other)
&& string.Equals(baseTenant.Directory, other.Directory, StringComparison.OrdinalIgnoreCase)
&& string.Equals(baseTenant.Id, other.Id, StringComparison.OrdinalIgnoreCase));
}

Expand Down
10 changes: 4 additions & 6 deletions src/TestFx/TestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class TestManager : ITestRunnerFactory, ITestRunner
/// <returns></returns>
public static ITestRunnerFactory CreateInstance(ITestOutputHelper output, [CallerFilePath] string callerFilePath = null)
{
var callingClassName = string.IsNullOrEmpty(callerFilePath)
var callingClassName = string.IsNullOrEmpty(callerFilePath)
? null
: Path.GetFileNameWithoutExtension(callerFilePath);
return new TestManager(callingClassName).WithTestOutputHelper(output);
Expand Down Expand Up @@ -84,7 +84,7 @@ protected TestManager(string callingClassName)
#region Builder impl

/// <summary>
/// Sets a name of the subfolder where a test project keeps tests
/// Sets a name of the subfolder where a test project keeps tests
/// </summary>
/// <param name="folderName"></param>
/// <returns>self</returns>
Expand Down Expand Up @@ -130,7 +130,7 @@ public ITestRunnerFactory WithExtraRmModules(Func<EnvironmentSetupHelper, string
}

/// <summary>
/// Clears default RM modules list and sets a brand new
/// Clears default RM modules list and sets a brand new
/// </summary>
/// <param name="buildModuleList"></param>
/// <returns></returns>
Expand Down Expand Up @@ -167,7 +167,7 @@ public ITestRunnerFactory WithRecordMatcher(RecordMatcherDelegate recordMatcher)
}

/// <summary>
///
///
/// </summary>
/// <param name="userAgentsToIgnore">
/// Dictionary to store pairs: {user agent name, version-api to ignore}.
Expand Down Expand Up @@ -265,7 +265,6 @@ protected void SetupAzureContext()
string tenantId = null;
string userDomain = null;
string subscriptionId = null;

switch (HttpMockServer.Mode)
{
case HttpRecorderMode.Record:
Expand Down Expand Up @@ -295,7 +294,6 @@ protected void SetupAzureContext()
}

AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant.Id = tenantId ?? undefined;
AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant.Directory = userDomain ?? undefined;
AzureRmProfileProvider.Instance.Profile.DefaultContext.Subscription.Id = subscriptionId ?? undefined;
}

Expand Down