Skip to content

Commit

Permalink
Merge pull request guardian#4317 from bbc/conal/IMAGEDAM-1830-restric…
Browse files Browse the repository at this point in the history
…tPhotoSalesFunctionality

IMAEGEDAM-1830: showPaid permission prevents standard users from accessing sendToPhotosales functionality
  • Loading branch information
andrew-nowak authored Aug 23, 2024
2 parents c2473bb + 0b798ae commit 3cbb128
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kahuna/public/js/search/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

<div class="results-toolbar-item results-toolbar-item--right"
tabindex="0"
ng-if="ctrl.showSendToPhotoSales()">
ng-if="ctrl.showSendToPhotoSales() && ctrl.showPaid">
<a id="send-to"
style="display: contents;"
ng-class="{'batch-archive__button--disabled': ctrl.selectionCount >= 45}"
Expand Down
5 changes: 5 additions & 0 deletions kahuna/public/js/search/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,11 @@ results.controller('SearchResultsCtrl', [
return [validImages, invalidImages];
};

ctrl.showPaid = undefined;
mediaApi.getSession().then(session => {
ctrl.showPaid = session.user.permissions.showPaid ? session.user.permissions.showPaid : undefined;
});

ctrl.sendToPhotoSales = () => {
try {
const validImages = validatePhotoSalesSelection(ctrl.selectedImages)[0];
Expand Down

0 comments on commit 3cbb128

Please sign in to comment.