123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /**
- * Licensed Materials - Property of IBM
- * IBM Business Analytics (C) Copyright IBM Corp. 2020
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../../features/dashboard/userProfile/UserProfileAPI'], function (APIFactory, UserProfileAPI) {
- /**
- * @class
- * @implements UserProfileAPI
- * @hideconstructor
- * @classdesc default implementation of the UserProfileAPI
- */
- var CAUserProfile = function () {
- function CAUserProfile() {
- _classCallCheck(this, CAUserProfile);
- this._api = APIFactory.createAPI(this, [UserProfileAPI]);
- }
- CAUserProfile.prototype.getAPI = function getAPI() {
- return this._api;
- };
- /**
- * Glass initialize method for services
- * @param {Object} glassContext
- */
- CAUserProfile.prototype.initialize = function initialize(glassContext) {
- var _this = this;
- this._userProfile = glassContext.getCoreSvc('.UserProfile');
- this._config = glassContext.getCoreSvc('.Config');
- return this._config.getConfigValue('ClientValidDomainList').then(function (list) {
- _this._validDomainList = list;
- });
- };
- /**
- *
- * @param {string} capabilityName
- * @returns {boolean} true/false based on CM capabilities
- */
- CAUserProfile.prototype.hasCapability = function hasCapability(capabilityName) {
- return this._userProfile.capabilities.indexOf(capabilityName) != -1;
- };
- CAUserProfile.prototype.getValidDomainList = function getValidDomainList() {
- return this._validDomainList;
- };
- /**
- * @returns {string} user content locale. Defaults to 'en'
- */
- CAUserProfile.prototype.getContentLocale = function getContentLocale() {
- var userPreferences = this._userProfile && this._userProfile.preferences;
- return userPreferences && userPreferences.contentLocale || 'en';
- };
- CAUserProfile.prototype.getAvailableContentLocales = function getAvailableContentLocales() {
- return this._config.getContentLocales();
- };
- CAUserProfile.prototype.getUserAccount = function getUserAccount() {
- var userAccount = this._userProfile.userAccount;
- return {
- defaultName: userAccount && userAccount.defaultName,
- userName: userAccount && userAccount.userName,
- id: userAccount && userAccount.id,
- email: userAccount && userAccount.email
- };
- };
- return CAUserProfile;
- }();
- return CAUserProfile;
- });
- //# sourceMappingURL=CAUserProfile.js.map
|