Skip to content

Instantly share code, notes, and snippets.

@bmuller
Created November 19, 2016 16:24
Show Gist options
  • Save bmuller/1afdfea0dc2ef68311505ca115aeca1b to your computer and use it in GitHub Desktop.
Save bmuller/1afdfea0dc2ef68311505ca115aeca1b to your computer and use it in GitHub Desktop.
class ItemAuthorization {
construtor(user, item) {
this.user = user
this.item = item
}
can_create() {
return this.item.list.organization_id == this.user.organization_id;
}
can_update() {
return this.item.list.organization_id == this.user.organization_id;
}
can_read() {
return true;
}
can_delete() {
return this.item.creator_id == this.user.id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment