1. schacki
  2. django-permissions

Source

django-permissions / docs / settings.rst

Settings

The following settings are available to customize django-permissions:

PERMISSIONS_ROLES_ENABLED

  • Controls, whether the roles concepts is enabled, i.e. whether permissions MUST be assigned to roles only. If False, permissions must be assigned to users or groups only.
  • default : True

PERMISSIONS_OBJECTS_PERM_CHECK

  • If this settings is enabled, for each permission that is assigned to a content type, this content type (model calls), will get a check method for that specific permission. E.g. if the permission "edit" is assigned to the model Blog, the model class Blog will get the a method editable, such that you check if a user has the permission "edit" for the blog "Python News": Blog.get(name="Python News").edit(user)
  • default : True

PERMISSIONS_OBJECTS_PERM_CHECK_OVERRIDE

  • If django-permissions adds the permission object check method to the model classes, the name might conflict with existing attributes. Unless this setting is set to False, an Exception will be raised. Please do not change the default, unless you are really sure what you are doing.
  • default : False

PERMISSIONS_OBJECTS_PERM_STRING

  • This string is used the define the the method name of the object permission check function.
  • default : '%s'

PERMISSIONS_OBJECTS_GENERIC_CHECK

  • If this settings is enabled, each content type with an assigned permission, will get a generic check method. E.g. if the permission "edit" is assigned to the model Blog, the model class Blog will get the a method "has_permission", such that you check if a user has the permission "edit" for the blog "Python News": Blog.get(name="Python News").has_permission("edit",user)
  • default : True

PERMISSIONS_OBJECTS_GENERIC_STRING

  • This string is used the define the the method name of the object permission generic check function.
  • default : 'has_permission'

PERMISSIONS_RETURN_403

  • If set to True, the decorator will return a 403 response, if the permission is missing.
  • default : True