Gramex 1.74’s admin app lets administrators add new users, welcome them via email, add custom fields and roles for users based on rules, and more.
Admin app’s user management component lets administrators add new users via the user interface.
You can send welcome emails to new users added through this interface with the configuration below:
import:
admin/admin-user:
path: $GRAMEXAPPS/admin2/gramex.yaml
YAMLURL: /$YAMLURL/admin-user/
ADMIN_KWARGS:
authhandler: login # Manages users via the url: key named "login"
signup:
email_subject: Welcome {user} to {org}
email_body: |
Hello, {user}! Welcome to {org}.
Your location is {location}.
Thanks @jaidevd
Admin app’s user management component also includes an editor for the rules that modify user attributes.
The rule we added works as follows:
selector
: if the email
attribute of the user…pattern
: matches *@example.org
…field
: then set the role
attribute of the user…value
: to external
To enable this, add a rules:
section to the auth handler.
url:
auth:
pattern: /$YAMLURL/login
handler: SimpleAuth # Any auth handler works
kwargs:
rules:
url: sqlite:///path/to/rules.db # Connect to rules DB / file
table: rules
Thanks @jaidevd
To add logic to your component, add any JavaScript inside
<script $inline>
.
This runs when the component is rendered.
<template $name="repeat-script" icon="X" value="30">
<script $inline>
let count = +value;
let result = isNaN(count) ? "error" : icon.repeat(count);
</script>
${result}
</template>
When you add the component to your page:
<repeat-script icon="★" value="8"></repeat-html>
<repeat-script icon="★" value="a"></repeat-html>
… it renders this output:
★★★★★★★★
Thanks @jaidevd
Gramex 1.74 is backward compatible with previous releases unless the release notes say otherwise. Automated builds test this.
Every Gramex release is tested for security vulnerabilities using the following tools.
The Gramex code base has:
See the Gramex installation and upgrade instructions.
Note: Gramex 1.74 does not work with Python 3.8 or 3.9. We recommend Python 3.7.