pyramid_jsonapi.permissions moduleΒΆ

Implement classes representing permissions

class pyramid_jsonapi.permissions.Permission(template: Optional[pyramid_jsonapi.permissions.PermissionBase] = None, attributes: Optional[FrozenSet[str]] = None, relationships: Optional[FrozenSet[str]] = None, id: Optional[bool] = None)[source]

Bases: pyramid_jsonapi.permissions.PermissionBase

Represent all possible permissions.

template

a Template object representing possible attributes and relationships.

Type

pyramid_jsonapi.permissions.PermissionBase

attributes

a frozenset of allowed attributes.

Type

FrozenSet[str]

relationships

a frozenset of allowed relationships.

Type

FrozenSet[str]

id

a boolean representing whether or not operations involving the resource identifier are allowed (like existence or viewing, adding and deleting from relationships).

Type

bool

attributes: FrozenSet[str] = None
classmethod from_pfilter(template, value)[source]

Construct a Permission object from the return value of a permission filter.

classmethod from_template_cached(template)[source]

New instance from template with default atts and rels. Cached.

classmethod from_view(view, attributes=None, relationships=None)[source]

New instance using a view (instance or class) to get the template.

classmethod from_view_subtractive(view, attributes={}, relationships={})[source]

New instance using view and subtracting atts and rels from full set.

id: bool = None
relationships: FrozenSet[str] = None
classmethod subtractive(template, attributes={}, relationships={})[source]

New instance by subtracting attributes and relationships from template.

template: pyramid_jsonapi.permissions.PermissionBase = None
classmethod template_from_view(view)[source]
class pyramid_jsonapi.permissions.PermissionTarget(type: pyramid_jsonapi.permissions.Targets, name: str = None)[source]

Bases: object

name: str = None
type: pyramid_jsonapi.permissions.Targets
class pyramid_jsonapi.permissions.Targets(value)[source]

Bases: enum.Enum

Possible PermissionTarget types.

collection = 1
item = 2
relationship = 3
exception pyramid_jsonapi.permissions.TemplateMissmatch[source]

Bases: Exception

Signal a missmatch in templates.