Skip to content

Instantly share code, notes, and snippets.

@sjmcgrath
sjmcgrath / authorization.py
Last active March 9, 2016 20:44 — forked from airtonix/authorization.py
A django-tastypie Authorization Class that uses django-guardian for row level permission checking.
import logging
from tastypie.authorization import DjangoAuthorization
from tastypie.exceptions import Unauthorized
from guardian.shortcuts import get_objects_for_user
from guardian.core import ObjectPermissionChecker
logger = logging.getLogger(__name__)