PolicyPropertyView.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. /*
  3. *+------------------------------------------------------------------------+
  4. *| Licensed Materials - Property of IBM
  5. *| IBM Cognos Products: BI Content Explorer
  6. *| (C) Copyright IBM Corp. 2017
  7. *|
  8. *| US Government Users Restricted Rights - Use, duplication or disclosure
  9. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *+------------------------------------------------------------------------+
  11. */
  12. define(['q', 'bi/content_apps/common/PolicyPropertyView'], function (Q, CAPolicyPropertyView) {
  13. 'use strict'; //NOSONAR
  14. var PolicyPropertyView = CAPolicyPropertyView.extend({
  15. init: function init(options) {
  16. PolicyPropertyView.inherited('init', this, arguments);
  17. },
  18. _getObject: function _getObject() {
  19. if (this.isNew) {
  20. var newPermissions = {
  21. data: [{
  22. policies: []
  23. }]
  24. };
  25. var aDef = Q.defer();
  26. aDef.resolve(newPermissions);
  27. return aDef.promise;
  28. } else {
  29. return PolicyPropertyView.inherited('_getObject', this, arguments);
  30. }
  31. },
  32. _sendRequest: function _sendRequest(options, successHandler) {
  33. if (this.isNew || this.oData.data[0].type === 'dataSourceSignon') {
  34. $(this).trigger("policiesChanged", options);
  35. var aDef = Q.defer();
  36. aDef.resolve();
  37. return aDef.promise;
  38. } else {
  39. return PolicyPropertyView.inherited('_sendRequest', this, arguments);
  40. }
  41. }
  42. });
  43. return PolicyPropertyView;
  44. });