123456789101112131415161718192021222324252627282930313233343536373839404142 |
- "use strict";
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Cognos Analytics
- * Copyright IBM Corp. 2015, 2016
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['underscore'], function (_) {
- 'use strict'; //NOSONAR: meant to be strict
- var _singletonInstance = null;
- var CapabilityHelper = function CapabilityHelper() {
- if (CapabilityHelper.prototype._singletonInstance) {
- return CapabilityHelper.prototype._singletonInstance;
- }
- };
- CapabilityHelper.prototype.checkCapabilities = function (capabilityName, glassContext) {
- if (glassContext) {
- return _.find(glassContext.services.userProfile.capabilities, function (capability) {
- return capability === capabilityName;
- });
- } else {
- return _.find(this.glassContext.services.userProfile.capabilities, function (capability) {
- return capability === capabilityName;
- });
- }
- };
- var _static = {
- getInstance: function getInstance() {
- if (!_singletonInstance) {
- _singletonInstance = new CapabilityHelper();
- }
- return _singletonInstance;
- }
- };
- return _static.getInstance();
- });
|