Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# without parameters implicitly adds django model permissions (app_name.view_model, app_name.change_model) # and support for django-guardian
# # can set the permission either here or on a perms.apply() call - see itemB, C, D. # In that case it takes the model class from the queryset field defined on the viewset # # User has permission to Container if he has guardian permissions or django model permissions Container: [],
# User has permission to ItemA if he has guardian or django permissions to the instance or # if he has permission to Container pointed by "parent" field ItemA: DelegatedPermission(perms, 'parent'), })
""" This view set automatically provides `list` and `detail` actions. """
""" This view set automatically provides `list` and `detail` actions. """
# User has permission to ItemB if he has guardian or django permissions to the instance or # if he has permission to any of Containers pointed by "parents" m2m field """ This view set automatically provides `list` and `detail` actions. """
# User has permission to ItemC if he has guardian or django permissions to the instance or # if he has permission to any of Containers that point to it via its item_c ForeignKey. # Note: we are checking perms for ItemC and the Foreign Key is defined on Container, # so we need to put in the related_name """ This view set automatically provides `list` and `detail` actions. """
# User has permission to ItemD if he has guardian or django permissions to the instance or # if he has permission to any of Containers that point to it via its items_d m2m field # Note: we are checking perms for ItemD and the m2m field is defined on Container, # so we need to put in the related_name """ This view set automatically provides `list` and `detail` actions. """
# different set of permissions
# deny all viewset """ This view set automatically provides `list` and `detail` actions. """
# different set of permissions
# allow only owner """ This view set automatically provides `list` and `detail` actions. """
initial_permissions={ Container: Condition.Or(OwnerPermission(), DjangoCombinedPermission()) # this is the same as Container: [OwnerPermission(), DjangoCombinedPermission()] })
""" This view set automatically provides `list` and `detail` actions. """
initial_permissions={ Container: Condition.And(OwnerPermission(), DjangoCombinedPermission()) # must be owner and have django permissions })
""" This view set automatically provides `list` and `detail` actions. """
|