Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

nickfrez / unb-djutils   python

Repository URL to install this package:

Version: 0.0.24 

/ unb_djutils / rest / permissions.py

"""
Extra permissions for use in Django REST Framework views.

"""

from rest_framework import permissions


class IsStaff(permissions.BasePermission):
  """Only allow users where user.is_staff is True."""

  def has_permission(self, request, view):
    return request.user.is_staff


class IsAdmin(permissions.BasePermission):
  """Only allow users where user.is_superuser is True."""

  def has_permission(self, request, view):
    return request.user.is_superuser