Fork me on GitHub

auth

An article by Gaspard Bucher

Pseudo attribute to access/edit linked user’s attributes.

Pseudo attribute to access/edit linked user’s attributes.

see select, StringHash

A node’s linked user is the user (think login/password) using the node as it’s visitor node.

We can think of a visitor as being represented by some relations and attributes (a node) and some authorization settings (a user).

display

We can display athorization settings through ‘auth’ field (a StringHash) :

Login: <b do='auth["login"]'/>
Profile: <b do='auth["profile"]'/>

Some fields are only accessible through the actual record by using “auth_user” (see User for a complete list). Example:

Admin?: <b do='auth_user.is_admin? ? "YES" : "NO"'/>
Status: <b do='auth_user.status_name'/>

edit

The ‘auth’ fields can be used as any StringHash:

login: <r:input name='auth[login]'/>
password: <r:input name='auth[password]'/>
profile: <r:select name='auth[profile]' type='profile'/>

A note on the last two fields. The password field is always blank and only updates the password if it contains something. The profile type for select enables selecting the profile from users with ‘is_profile’ set to true.