Skip to content

rules

Access control rules.

allows_submissions

allows_submissions(user, obj)

Check if the object allows submissions.

Source code in src/django_quotes/rules.py
@django_rules.predicate  # type: ignore
def allows_submissions(user, obj):
    """Check if the object allows submissions."""
    return obj.allow_submissions

is_group_owner

is_group_owner(user, obj)

Check if the object's group is owned by the user.

Source code in src/django_quotes/rules.py
@django_rules.predicate  # type: ignore
def is_group_owner(user, obj):
    """Check if the object's group is owned by the user."""
    return user == obj.group.owner

is_owner

is_owner(user, obj)

Check if the user is the owner of the object.

Source code in src/django_quotes/rules.py
@django_rules.predicate  # type: ignore
def is_owner(user, obj):
    """Check if the user is the owner of the object."""
    return obj.owner == user

is_public

is_public(user, obj)

Check if the object is public.

Source code in src/django_quotes/rules.py
@django_rules.predicate  # type: ignore
def is_public(user, obj):
    """Check if the object is public."""
    return obj.public

is_source_owner

is_source_owner(user, obj)

Check that the quote source is owned by the user.

Source code in src/django_quotes/rules.py
@django_rules.predicate  # type: ignore
def is_source_owner(user, obj):
    """Check that the quote source is owned by the user."""
    return user == obj.source.owner