diff --git a/docs/flow/stages/prompt/index.md b/docs/flow/stages/prompt/index.md index fa95e5e47..c05f37858 100644 --- a/docs/flow/stages/prompt/index.md +++ b/docs/flow/stages/prompt/index.md @@ -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. }} +```python +request.context.get('prompt_data').get('') ``` ### `label` diff --git a/docs/flow/stages/prompt/validation.md b/docs/flow/stages/prompt/validation.md index 8c1ac4f28..f2e64a9df 100644 --- a/docs/flow/stages/prompt/validation.md +++ b/docs/flow/stages/prompt/validation.md @@ -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`. diff --git a/docs/policies/expression.md b/docs/policies/expression.md index e3d0812cb..c6d9c9374 100644 --- a/docs/policies/expression.md +++ b/docs/policies/expression.md @@ -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 diff --git a/docs/property-mappings/expression.md b/docs/property-mappings/expression.md index a25ee2aad..3888ce92d 100644 --- a/docs/property-mappings/expression.md +++ b/docs/property-mappings/expression.md @@ -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)) diff --git a/passbook/admin/templates/generic/update.html b/passbook/admin/templates/generic/update.html index 7c7f57290..cee51661c 100644 --- a/passbook/admin/templates/generic/update.html +++ b/passbook/admin/templates/generic/update.html @@ -6,7 +6,7 @@ {% block above_form %}

{% blocktrans with type=form|form_verbose_name|title inst=form.instance %} - Update {{ type }}: {{ inst }} + Update {{ inst }} {% endblocktrans %}

{% endblock %} diff --git a/passbook/policies/expression/templates/policy/expression/form.html b/passbook/policies/expression/templates/policy/expression/form.html index 14bfa626e..95b3a8fb9 100644 --- a/passbook/policies/expression/templates/policy/expression/form.html +++ b/passbook/policies/expression/templates/policy/expression/form.html @@ -7,23 +7,8 @@

- Expression using Jinja. Following variables are available: + Expression using Python. See here for a list of all variables.

-
    -
  • request.user: Passbook User Object (Reference)
  • -
  • request.http_request: Django HTTP Request Object (Reference)
  • -
  • request.obj: Model the Policy is run against.
  • -
  • pb_flow_plan: Current Plan if Policy is called while a flow is active.
  • -
  • pb_is_sso_flow: Boolean which is true if request was initiated by authenticating through an external Provider.
  • -
  • pb_is_group_member(user, group_name): Function which checks if user is member of a Group with Name group_name.
  • -
  • pb_logger: Standard Python Logger Object, which can be used to debug expressions.
  • -
  • pb_client_ip: Client's IP Address.
  • -
-

Custom Filters:

-
    -
  • regex_match(regex): Checks if value matches regex
  • -
  • regex_replace(regex, repl): Replace string matched by regex with repl
  • -
{% endblock %} diff --git a/passbook/providers/saml/templates/saml/idp/property_mapping_form.html b/passbook/providers/saml/templates/saml/idp/property_mapping_form.html index 7b5d3f36e..4bd3085af 100644 --- a/passbook/providers/saml/templates/saml/idp/property_mapping_form.html +++ b/passbook/providers/saml/templates/saml/idp/property_mapping_form.html @@ -7,12 +7,7 @@

- Expression using Jinja. Following variables are available: -

    -
  • user: Passbook User Object (Reference)
  • -
  • request: Django HTTP Request Object (Reference)
  • -
  • provider: Passbook SAML Provider Object (Reference)
  • -
+ Expression using Python. See here for a list of all variables.

diff --git a/passbook/sources/ldap/templates/ldap/property_mapping_form.html b/passbook/sources/ldap/templates/ldap/property_mapping_form.html index 63887ba7d..4bd3085af 100644 --- a/passbook/sources/ldap/templates/ldap/property_mapping_form.html +++ b/passbook/sources/ldap/templates/ldap/property_mapping_form.html @@ -7,10 +7,7 @@

- Expression using Jinja. Following variables are available: -

    -
  • ldap: A Dictionary of all values retrieved from LDAP.
  • -
+ Expression using Python. See here for a list of all variables.