mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
add filter function for acl actions
This commit is contained in:
parent
9b663c64b2
commit
e13649383a
@ -82,7 +82,7 @@ let PieceListBulkModal = React.createClass({
|
||||
|
||||
render() {
|
||||
let selectedEditions = this.fetchSelectedEditionList();
|
||||
let availableAcls = getAvailableAcls(selectedEditions);
|
||||
let availableAcls = getAvailableAcls(selectedEditions, (aclName) => aclName !== 'acl_view');
|
||||
|
||||
if(Object.keys(availableAcls).length > 0) {
|
||||
return (
|
||||
|
@ -6,7 +6,7 @@ function intersectAcls(a, b) {
|
||||
return a.filter((val) => b.indexOf(val) > -1);
|
||||
}
|
||||
|
||||
export function getAvailableAcls(editions) {
|
||||
export function getAvailableAcls(editions, filterFn) {
|
||||
let availableAcls = [];
|
||||
if (editions.constructor !== Array){
|
||||
return [];
|
||||
@ -26,6 +26,13 @@ export function getAvailableAcls(editions) {
|
||||
|
||||
edition.acl = sanitize(edition.acl, (val) => !val);
|
||||
edition.acl = Object.keys(edition.acl);
|
||||
|
||||
// additionally, the user can specify a filter function for
|
||||
// an acl array
|
||||
if(typeof filterFn === 'function') {
|
||||
edition.acl = edition.acl.filter(filterFn);
|
||||
}
|
||||
|
||||
return edition;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user