From cc5908d26f1f9727ee95fc35f662d8c07080786b Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 4 Sep 2015 12:17:02 -0700 Subject: [PATCH] [Identity] Provide an undefined identity Provide an undefined identity by default, instead of an Unknown User. This suppresses display of identity-related features (such as the identity indicator) while still providing a default implementation of the identityService for platform components to utilize. nasa/openmctweb#99 --- platform/identity/src/IdentityProvider.js | 12 +++++------- platform/identity/test/IdentityProviderSpec.js | 7 ++----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/platform/identity/src/IdentityProvider.js b/platform/identity/src/IdentityProvider.js index 5acb4a2c97..8b6bd8f329 100644 --- a/platform/identity/src/IdentityProvider.js +++ b/platform/identity/src/IdentityProvider.js @@ -30,20 +30,18 @@ define( function () { "use strict"; - var UNKNOWN_USER = { - key: "unknown", - name: "Unknown User" - }; - /** * Default implementation of an identity service. Provides an - * unkown user. + * unknown user as an `undefined` value; this is present simply + * to ensure that there is always an `identityService` available + * for platform components to use. + * * @constructor * @implements {IdentityService} * @memberof platform/identity */ function IdentityProvider($q) { - this.userPromise = $q.when(UNKNOWN_USER); + this.userPromise = $q.when(undefined); } IdentityProvider.prototype.getUser = function () { diff --git a/platform/identity/test/IdentityProviderSpec.js b/platform/identity/test/IdentityProviderSpec.js index 85867642a8..61852c42ff 100644 --- a/platform/identity/test/IdentityProviderSpec.js +++ b/platform/identity/test/IdentityProviderSpec.js @@ -46,15 +46,12 @@ define( provider = new IdentityProvider(mockQ); }); - it("provides an unknown user", function () { + it("provides an undefined user", function () { provider.getUser().then(mockCallback); waitsFor(calledBack); runs(function () { - expect(mockCallback).toHaveBeenCalledWith({ - key: jasmine.any(String), - name: jasmine.any(String) - }); + expect(mockCallback).toHaveBeenCalledWith(undefined); }); });