UserProfileImpl.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Business Analytics (C) Copyright IBM Corp. 2020
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', './UserProfileAPI'], function (APIFactory, UserProfileAPI) {
  9. /**
  10. * @class
  11. * @implements UserProfileAPI
  12. * @hideconstructor
  13. * @classdesc default implementation of the UserProfileAPI
  14. */
  15. var UserProfileImpl = function () {
  16. function UserProfileImpl() {
  17. _classCallCheck(this, UserProfileImpl);
  18. this._api = APIFactory.createAPI(this, [UserProfileAPI]);
  19. this._capabilities = {
  20. 'canAuthorDashboard': true,
  21. 'canUseInteractiveDashboard': true
  22. };
  23. }
  24. /**
  25. * it is required in order to be defined as a dashboard feature
  26. * @returns {Object} instance of the API implementation
  27. */
  28. UserProfileImpl.prototype.getAPI = function getAPI() {
  29. return this._api;
  30. };
  31. UserProfileImpl.prototype.getAvailableContentLocales = function getAvailableContentLocales() {
  32. return Promise.resolve(null);
  33. };
  34. UserProfileImpl.prototype.getValidDomainList = function getValidDomainList() {
  35. return null;
  36. };
  37. /**
  38. *
  39. * @param {string} capabilityName
  40. * @returns {boolean} true for the built-in capabilities, false otherwise
  41. */
  42. UserProfileImpl.prototype.hasCapability = function hasCapability(capabilityName) {
  43. var hasIt = capabilityName ? !!this._capabilities[capabilityName] : false;
  44. return hasIt;
  45. };
  46. UserProfileImpl.prototype.getContentLocale = function getContentLocale() {
  47. return 'en';
  48. };
  49. UserProfileImpl.prototype.getUserAccount = function getUserAccount() {
  50. return {
  51. defaultName: undefined,
  52. userName: undefined,
  53. id: undefined
  54. };
  55. };
  56. return UserProfileImpl;
  57. }();
  58. return UserProfileImpl;
  59. });
  60. //# sourceMappingURL=UserProfileImpl.js.map