/* * Licensed Materials - Property of IBM * * IBM Cognos Products: Modeling UI * * Copyright IBM Corp. 2018 * * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * This handler is for open a modue stored in cm session. A typical case is to create * a datamodule after file upload. In such case, we don't need the permission check. Plus, * it won't be exposed to any perspective contextmenu action, so it will always be hidden. */ define(['bi/glass/core/Class', 'underscore'], function (BaseClass, _) { var OpenSessionModuleHandler = BaseClass.extend({ init: function() { OpenSessionModuleHandler.inherited('init', this, arguments); }, doAction: function(context) { return this._passSecurityCheck(context) ? Promise.resolve(this.onSelectItem(context)) : Promise.reject(); }, onSelectItem: function(context) { var application = context.glassContext; var selected = context.target.activeObject.aSelectedContext[0]; var id = selected.id; var sessionModule = selected.sessionModule; application.openAppView('ca-modeller', { content: { tid: id, id: id, sessionModule: sessionModule } }); }, _passSecurityCheck: function(context) { return ( context.glassContext.services.userProfile.capabilities.indexOf('canUseWebBasedModeling') >= 0 ); }, isItemVisible: function(context) { return false; } }); return OpenSessionModuleHandler; });