Last active
July 27, 2017 13:18
-
-
Save stalniy/0d4bbe25a1d8159c56858d8aa24ed64b to your computer and use it in GitHub Desktop.
CASL js-data subject name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function subjectName(subject) { | |
if (!subject || typeof subject === 'string') { | |
return subject | |
} | |
return subject.constructor.mapper.name | |
} | |
export function configureAbility({ container }) { | |
const ability = new Ability([], { subjectName }) | |
// the rest of the logic .... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment