mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
bf0a2aeefb
async emails
23 lines
690 B
JavaScript
23 lines
690 B
JavaScript
'use strict';
|
|
|
|
export function getAvailableAcls(editions) {
|
|
let availableAcls = [];
|
|
|
|
// If no edition has been selected, availableActions is empty
|
|
// If only one edition has been selected, their actions are available
|
|
// If more than one editions have been selected, their acl properties are intersected
|
|
if(editions.length >= 1) {
|
|
availableAcls = editions[0].acl;
|
|
}
|
|
if(editions.length >= 2) {
|
|
for(let i = 1; i < editions.length; i++) {
|
|
availableAcls = intersectAcls(availableAcls, editions[i].acl);
|
|
}
|
|
}
|
|
|
|
return availableAcls;
|
|
}
|
|
|
|
export function intersectAcls(a, b) {
|
|
return a.filter((val) => b.indexOf(val) > -1);
|
|
} |