Did I find the right examples for you? yes no

All Samples(13)  |  Call(0)  |  Derive(10)  |  Import(3)

src/d/j/djangorestframework-extensions-0.0.3/djangorestframework_extensions/permissions.py   djangorestframework-extensions(Download)
from django.contrib.auth.models import User, Group
from djangorestframework import status
from djangorestframework.response import ErrorResponse
from djangorestframework.permissions import SAFE_METHODS, BasePermission
from djangorestframework_extensions.utils import user_passes_test
class InstancePermission(BasePermission):
    def get_instance(self):
        view = self.view
        if getattr(view, 'model_instance', None):
            return view.model_instance
class BaseWhitelistPermission(BasePermission):
    whitelist = True
 
 
class PassesTestPermission(object):
class WhitelistPermissions(BasePermission):
    DEFAULT_PERMISSIONS = (
        ('superuser', lambda x: x.is_superuser),
        ('staff', lambda x: x.is_staff),
    )
class IsStaffOrIsAnonReadOnly(BasePermission):
    """
    The request is authenticated as staff, or is a read-only request.
    """
 

src/s/h/shareabouts-api-HEAD/src/sa_api_v1/views.py   shareabouts-api(Download)
class IsOwnerOrSuperuser(permissions.BasePermission):
    def check_permission(self, user):
        """
        Allows only superusers or the user named by
        ``self.view.allowed_username``.
class CanShowPrivateData (permissions.BasePermission):
    def check_permission(self, user):
        if not self.view.flags.get('include_private_data'):
            return
 

src/i/o/ionyweb-0.3/ionyweb/administration/permissions.py   ionyweb(Download)
# -*- coding: utf-8 -*-
from djangorestframework.permissions import BasePermission
 
from djangorestframework import status
from djangorestframework.response import ErrorResponse
class IsAdminUser(BasePermission):
    """
    Allows access only to admin users.
    """
 
class IsSuperAdminUser(BasePermission):
    """
    Allows access only to admin users.
    """
 

src/i/o/ionyweb-HEAD/ionyweb/administration/permissions.py   ionyweb(Download)
# -*- coding: utf-8 -*-
from djangorestframework.permissions import BasePermission
 
from djangorestframework import status
from djangorestframework.response import ErrorResponse
class IsAdminUser(BasePermission):
    """
    Allows access only to admin users.
    """
 
class IsSuperAdminUser(BasePermission):
    """
    Allows access only to admin users.
    """