{% load api %}
{% ifapiallows user 'repos/delete_repo' repo %}
<p>Hey, the user can delete the repo</p>
{% endifapiallows %}
{% withapiallows allowed user 'repos/delete_repo' repo %}
<p>The user {% if allowed %}is allowed to{% else %}can not{% endif %} delete the repo</p>
{% endwithapiallows %}
{% withapiprevents disabled user 'repos/delete_repo' repo %}
<button{% if disabled %} disabled{% endif %}>Delete</button>
{% endwithapiprevents %}
{% ifapiallows <user> <api call> <parameters> %}
{% else %}
{% endifapiallows %}
The <user>
should be a User (or whatever your system has configured to be a user).
The <api call>
should be the string name of the api call.
The <parameters>
are whatever parameters you want to test against the api call. Normal Python rules apply, ie args then kwargs.
{% if apiallows user 'repos/modify_repo' repo name='' %}
{% withapiallows <variable> <user> <api call> <parameters> %}
{% endwithapiallows %}
The <variable>
will be set to True
or False
depending on whether then api call is allowed by permissions.
The <user>
should be a User (or whatever your system has configured to be a user).
The <api call>
should be the string name of the api call.
The <parameters>
are whatever parameters you want to test against the api call. Normal Python rules apply, ie args then kwargs.
{% withapiprevents <variable> <user> <api call> <parameters> %}
{% endwithapiprevents %}
The <variable>
will be set to True
or False
depending on whether then api call is prevented by permissions.
The <user>
should be a User (or whatever your system has configured to be a user).
The <api call>
should be the string name of the api call.
The <parameters>
are whatever parameters you want to test against the api call. Normal Python rules apply, ie args then kwargs.