react-redux-permissions
Version:
A permissions library for react and redux applications.
17 lines (15 loc) • 344 B
JavaScript
export const checkVisibility = (roles, allowed, except) => {
if (except.length > 0 && except.some(elem => roles.indexOf(elem) > -1)) {
return false
}
if (allowed.length > 0) {
if (allowed.some(elem => roles.indexOf(elem) > -1)) {
return true
}
return false
}
return true
}
export default {
checkVisibility,
}