diff --git a/js/components/security/access/configure-access-modal.html b/js/components/security/access/configure-access-modal.html index a23e1441a..8a4edcebf 100644 --- a/js/components/security/access/configure-access-modal.html +++ b/js/components/security/access/configure-access-modal.html @@ -106,9 +106,9 @@ " class="btn btn-primary", /> - - - + + +

diff --git a/js/components/security/access/configure-access-modal.js b/js/components/security/access/configure-access-modal.js index 017790506..0e95ae08a 100644 --- a/js/components/security/access/configure-access-modal.js +++ b/js/components/security/access/configure-access-modal.js @@ -1,6 +1,6 @@ define([ 'knockout', - 'text!./configure-access-modal.html', + 'text!./configure-access-modal.html', 'components/Component', 'utils/CommonUtils', 'utils/AutoBind', @@ -8,7 +8,7 @@ define([ 'databindings', ], function ( ko, - view, + view, Component, commonUtils, AutoBind @@ -33,7 +33,7 @@ define([ this.readRoleOptions = ko.computed(() => this.readRoleSuggestions().map(r => r.name)); this.readRoleSearch = ko.observable(); this.readRoleSearch.subscribe(str => this.loadReadRoleSuggestions(str)); - + this.shareFlag = ko.observable(true); this.isOwnerFn = params.isOwnerFn; diff --git a/js/pages/concept-sets/conceptset-manager.html b/js/pages/concept-sets/conceptset-manager.html index a1643e25a..4ff046c19 100644 --- a/js/pages/concept-sets/conceptset-manager.html +++ b/js/pages/concept-sets/conceptset-manager.html @@ -27,7 +27,7 @@ - + diff --git a/js/pages/concept-sets/conceptset-manager.js b/js/pages/concept-sets/conceptset-manager.js index 7402046ed..b4430c230 100644 --- a/js/pages/concept-sets/conceptset-manager.js +++ b/js/pages/concept-sets/conceptset-manager.js @@ -8,7 +8,8 @@ define([ './const', 'const', 'components/conceptset/utils', - 'services/Vocabulary', + 'services/Vocabulary', + 'services/ShareRoleCheck', 'services/Permission', 'services/Tags', 'components/security/access/const', @@ -55,7 +56,8 @@ define([ constants, globalConstants, utils, - vocabularyAPI, + vocabularyAPI, + shareRoleCheck, GlobalPermissionService, TagsService, { entityType }, @@ -174,7 +176,25 @@ define([ this.canCopy = ko.computed(() => { return this.currentConceptSet() && this.currentConceptSet().id > 0; }); - this.enablePermissionManagement = config.enablePermissionManagement; + + this.enablePermissionManagement = ko.observable(false); + this.enablePermissionManagement(config.enablePermissionManagement); + + this.userCanShare = ko.observable(false); + if (config.permissionManagementRoleId === "") { + this.userCanShare(true); + } else { + shareRoleCheck.checkIfRoleCanShare(authApi.subject(), config.permissionManagementRoleId) + .then(res=>{ + this.userCanShare(res); + }) + .catch(error => { + console.error(error); + alert(ko.i18n('conceptSets.conceptSetManager.shareRoleCheck', 'Error when determining if user can share cohorts')()); + }); + } + + this.isSaving = ko.observable(false); this.isDeleting = ko.observable(false); this.isOptimizing = ko.observable(false);