Skip to content

Commit

Permalink
started to implement the ability to hide the share-global buttons but…
Browse files Browse the repository at this point in the history
… then decided not to
  • Loading branch information
rkboyce committed Apr 23, 2024
1 parent 8f46884 commit b99d5d5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
6 changes: 3 additions & 3 deletions js/components/security/access/configure-access-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@
"
class="btn btn-primary",
/>
</div>
</div>
</div>
</div>

<div><br></div>

</div>
Expand Down
6 changes: 3 additions & 3 deletions js/components/security/access/configure-access-modal.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
define([
'knockout',
'text!./configure-access-modal.html',
'text!./configure-access-modal.html',
'components/Component',
'utils/CommonUtils',
'utils/AutoBind',
'less!./configure-access-modal.less',
'databindings',
], function (
ko,
view,
view,
Component,
commonUtils,
AutoBind
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion js/pages/concept-sets/conceptset-manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<button type="button" class="btn btn-primary" data-bind="click: () => isTagsModalShown(!isTagsModalShown()), visible: canEdit() && !previewVersion(), css: { disabled: isProcessing() }, title: ko.i18n('common.tags', 'Tags')"><i class="fa fa-tags"></i></button>
<button type="button" class="btn btn-primary" data-bind="visible: !previewVersion(), click: optimize, css: { disabled: !canOptimize() || isProcessing() }, text: ko.i18n('cs.manager.optimize', 'Optimize')"></button>

<!-- ko if: enablePermissionManagement -->
<!-- ko if: (enablePermissionManagement() === true && userCanShare() === true) -->
<button class="btn btn-primary" data-bind="visible: !previewVersion() && isOwner(), click: () => isAccessModalShown(!isAccessModalShown()), title: ko.i18n('common.configureAccess', 'Configure access')">
<i class="fa fa-lock"></i>
</button>
Expand Down
26 changes: 23 additions & 3 deletions js/pages/concept-sets/conceptset-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ define([
'./const',
'const',
'components/conceptset/utils',
'services/Vocabulary',
'services/Vocabulary',
'services/ShareRoleCheck',
'services/Permission',
'services/Tags',
'components/security/access/const',
Expand Down Expand Up @@ -55,7 +56,8 @@ define([
constants,
globalConstants,
utils,
vocabularyAPI,
vocabularyAPI,
shareRoleCheck,
GlobalPermissionService,
TagsService,
{ entityType },
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b99d5d5

Please sign in to comment.