docs: remove last occurrences to jinja2
This commit is contained in:
		| @ -21,8 +21,8 @@ A Prompt has the following attributes: | ||||
|  | ||||
| HTML name used for the prompt. This key is also used to later retrieve the data in expression policies: | ||||
|  | ||||
| ```jinja2 | ||||
| {{ request.context.prompt_data.<field_key> }} | ||||
| ```python | ||||
| request.context.get('prompt_data').get('<field_key>') | ||||
| ``` | ||||
|  | ||||
| ### `label` | ||||
|  | ||||
| @ -4,13 +4,12 @@ Further validation of prompts can be done using policies. | ||||
|  | ||||
| To validate that two password fields are identical, create the following expression policy: | ||||
|  | ||||
| ```jinja2 | ||||
| {% if request.context.prompt_data.password == request.context.prompt_data.password_repeat %} | ||||
| True | ||||
| {% else %} | ||||
| {% do pb_message("Passwords don't match.") %} | ||||
| False | ||||
| {% endif %} | ||||
| ```python | ||||
| if request.context.get('prompt_data').get('password') == request.context.get('prompt_data').get('password_repeat'): | ||||
|     return True | ||||
|  | ||||
| pb_message("Passwords don't match.") | ||||
| return False | ||||
| ``` | ||||
| This policy expects you two have two password fields with `field_key` set to `password` and `password_repeat`. | ||||
|  | ||||
|  | ||||
| @ -1,5 +1,8 @@ | ||||
| # Expression Policies | ||||
|  | ||||
| !!! notice | ||||
|     These variables are available in addition to the common variables/functions defined in [**Expressions**](../expressions/index.md) | ||||
|  | ||||
| The passing of the policy is determined by the return value of the code. Use `return True` to pass a policy and `return False` to fail it. | ||||
|  | ||||
| ### Available Functions | ||||
|  | ||||
| @ -2,6 +2,9 @@ | ||||
|  | ||||
| The property mapping should return a value that is expected by the Provider/Source. What types are supported, is documented in the individual Provider/Source. Returning `None` is always accepted, this simply skips this mapping. | ||||
|  | ||||
| !!! notice | ||||
|     These variables are available in addition to the common variables/functions defined in [**Expressions**](../expressions/index.md) | ||||
|  | ||||
| ### Context Variables | ||||
|  | ||||
| - `user`: The current user, this might be `None` if there is no contextual user. ([ref](../expressions/reference/user-object.md)) | ||||
|  | ||||
| @ -6,7 +6,7 @@ | ||||
| {% block above_form %} | ||||
| <h1> | ||||
|     {% blocktrans with type=form|form_verbose_name|title inst=form.instance %} | ||||
|     Update {{ type }}: {{ inst }} | ||||
|     Update {{ inst }} | ||||
|     {% endblocktrans %} | ||||
| </h1> | ||||
| {% endblock %} | ||||
|  | ||||
| @ -7,23 +7,8 @@ | ||||
|     <label for="" class="pf-c-form__label"></label> | ||||
|     <div class="c-form__horizontal-group"> | ||||
|         <p> | ||||
|             Expression using <a href="https://jinja.palletsprojects.com/en/2.11.x/templates/">Jinja</a>. Following variables are available: | ||||
|             Expression using Python. See <a href="https://passbook.beryju.org/policies/expression/">here</a> for a list of all variables. | ||||
|         </p> | ||||
|         <ul class="pf-c-list"> | ||||
|             <li><code>request.user</code>: Passbook User Object (<a href="https://beryju.github.io/passbook/property-mappings/reference/user-object/">Reference</a>)</li> | ||||
|             <li><code>request.http_request</code>: Django HTTP Request Object (<a href="https://docs.djangoproject.com/en/3.0/ref/request-response/#httprequest-objects">Reference</a>) </li> | ||||
|             <li><code>request.obj</code>: Model the Policy is run against. </li> | ||||
|             <li><code>pb_flow_plan</code>: Current Plan if Policy is called while a flow is active.</li> | ||||
|             <li><code>pb_is_sso_flow</code>: Boolean which is true if request was initiated by authenticating through an external Provider.</li> | ||||
|             <li><code>pb_is_group_member(user, group_name)</code>: Function which checks if <code>user</code> is member of a Group with Name <code>group_name</code>.</li> | ||||
|             <li><code>pb_logger</code>: Standard Python Logger Object, which can be used to debug expressions.</li> | ||||
|             <li><code>pb_client_ip</code>: Client's IP Address.</li> | ||||
|         </ul> | ||||
|         <p>Custom Filters:</p> | ||||
|         <ul class="pf-c-list"> | ||||
|             <li><code>regex_match(regex)</code>: Checks if value matches <code>regex</code></li> | ||||
|             <li><code>regex_replace(regex, repl)</code>: Replace string matched by <code>regex</code> with <code>repl</code></li> | ||||
|         </ul> | ||||
|     </div> | ||||
| </div> | ||||
| {% endblock %} | ||||
|  | ||||
| @ -7,12 +7,7 @@ | ||||
|     <label for="" class="pf-c-form__label"></label> | ||||
|     <div class="c-form__horizontal-group"> | ||||
|         <p> | ||||
|             Expression using <a href="https://jinja.palletsprojects.com/en/2.11.x/templates/">Jinja</a>. Following variables are available: | ||||
|             <ul class="pf-c-list"> | ||||
|                 <li><code>user</code>: Passbook User Object (<a href="https://beryju.github.io/passbook/reference/property-mappings/user-object/">Reference</a>)</li> | ||||
|                 <li><code>request</code>: Django HTTP Request Object (<a href="https://docs.djangoproject.com/en/3.0/ref/request-response/#httprequest-objects">Reference</a>) </li> | ||||
|                 <li><code>provider</code>: Passbook SAML Provider Object (<a href="https://github.com/BeryJu/passbook/blob/master/passbook/providers/saml/models.py#L16">Reference</a>) </li> | ||||
|             </ul> | ||||
|             Expression using Python. See <a href="https://passbook.beryju.org/property-mappings/expression/">here</a> for a list of all variables. | ||||
|         </p> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| @ -7,10 +7,7 @@ | ||||
|     <label for="" class="pf-c-form__label"></label> | ||||
|     <div class="c-form__horizontal-group"> | ||||
|         <p> | ||||
|             Expression using <a href="https://jinja.palletsprojects.com/en/2.11.x/templates/">Jinja</a>. Following variables are available: | ||||
|             <ul class="pf-c-list"> | ||||
|                 <li><code>ldap</code>: A Dictionary of all values retrieved from LDAP.</li> | ||||
|             </ul> | ||||
|             Expression using Python. See <a href="https://passbook.beryju.org/property-mappings/expression/">here</a> for a list of all variables. | ||||
|         </p> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer