Skip to content

Commit

Permalink
Disable 'Edit' button in MetadataView if not allowed submitter
Browse files Browse the repository at this point in the history
Issue #1817
  • Loading branch information
gothub committed Oct 8, 2021
1 parent c43b2b4 commit 8bcd6ef
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/js/views/MetadataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,14 @@ define(['jquery',
authorization = [],
resourceMap = this.dataPackage ? this.dataPackage.packageModel : null,
modelsToCheck = [this.model, resourceMap];

// Check if a list of allowed submitters has been specified for this MN.
if (typeof MetacatUI.appUserModel.get("isAuthorizedSubmitter") === 'undefined') {
view.listenToOnce(MetacatUI.appUserModel, "change:isAuthorizedSubmitter", function () {
view.checkWritePermissions();
});
return;
}

modelsToCheck.forEach(function (model, index) {
// If there is no resource map or no EML,
Expand Down Expand Up @@ -1175,8 +1183,9 @@ define(['jquery',
} else {
return
}
// Only render the editor controls if we have completed the checks AND the user has full editor permissions
if (allTrue) {
// Only render the editor controls if user is in the 'allowed submitters' list (if it exists) and
// if we have completed the checks AND the user has full editor permissions
if (MetacatUI.appUserModel.get("isAuthorizedSubmitter") == true && allTrue) {
this.insertEditorControls();
}

Expand Down

0 comments on commit 8bcd6ef

Please sign in to comment.