GRAINY_ADMIN_REMOVE_DEFAULT_FORMS
If true the forms for vanilla django permissions will be removed from the admin UI
default: True
GRAINY_ANONYMOUS_PERMS
Allows you to specify a set of permissions for AnonymousUser instances.
GRAINY_ANONYMOUS_PERMS = {
"a.b.c" : grainy.const.PERM_READ
}
default
GRAINY_ANONYMOUS_PERMS = {}
GRAINY_ANONYMOUS_GROUP
Can be set to a user group name. AnonymousUser permissions will be augmented with permissions from that specified group.
default
GRAINY_ANONYMOUS_GROUP = None
GRAINY_DJANGO_OP_TO_FLAG
dict
used to convert a django admin operation to a grainy permission flag
default
GRAINY_DJANGO_OP_TO_FLAG = {
"add" : grainy.const.PERM_CREATE,
"delete" : grainy.const.PERM_DELETE,
"change" : grainy.const.PERM_UPDATE,
"view" : grainy.const.PERM_READ
}
GRAINY_PERM_CHOICES
A list describing the possible permission flags
default
import grainy.const
GRAINY_PERM_CHOICES = [
#(bitmask flag, verbose name, string flag)
(grainy.const.PERM_CREATE, _("Create"), "c"),
(grainy.const.PERM_READ, _("Read"), "r"),
(grainy.const.PERM_UPDATE, _("Update"), "u"),
(grainy.const.PERM_DELETE, _("Delete"), "d"),
]
django-grainy comes with two predefined permission setups that you can use.
predefined shortcuts
GRAINY_PERM_CHOICES = django_grainy.const.PERM_CHOICES_CRUD #Create / Read / Update / Delete
GRAINY_PERM_CHOICES = django_grainy.const.PERM_CHOICES_RW #Read / Write
GRAINY_REQUEST_METHOD_TO_FLAG
dict
used to convert a request method to a grainy permission flag
default:
GRAINY_REQUEST_METHOD_TO_FLAG = getattr(settings, "GRAINY_REQUEST_METHOD_TO_FLAG", {
"HEAD" : grainy.const.PERM_READ,
"OPTIONS" : grainy.const.PERM_READ,
"GET" : grainy.const.PERM_READ,
"PUT" : grainy.const.PERM_UPDATE,
"PATCH" : grainy.const.PERM_UPDATE,
"POST" : grainy.const.PERM_CREATE,
"DELETE" : grainy.const.PERM_DELETE,
})