1
0
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:
Tim Daubenschütz 2015-07-14 13:34:32 +02:00
parent 9b663c64b2
commit e13649383a
2 changed files with 9 additions and 2 deletions

View File

@ -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 (

View File

@ -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;
});