Models - UsersBase
Description
Derived from BaseModel, this model defines SaWALi's user record structures.
Properties
All inherited from BaseModel.
Database Schema
- [buzhug record default properties]
- These include __id__, __version__, etc.
- openid_url (Unicode)
- The OpenID URL that was used by a visitor for logging-in.
- perms (Integer, 2)
- User privilege level, possible values are:
5 - site owner
4 - site administrator, full content and user management access
3 - contributor, may create content and modify content that they authored
2 - regual, may post comments (not yet implemented)
1 - banned - username (Unicode, u"Anonymous")
- The user's prefered account username. If the username value is not "Anonymous", it must to be unique.
- date_made (Float, BaseModel.calltime)
- The time (in seconds) when the account was created.
- last_edit (Float, BaseModel.calltime)
- The time (in seconds) when the account was last modified.
- session_id (Unicode)
- A Beaker-supplied session id.
Methods
- __init__
- Initialises the BaseModel super-class passing "UsersBase" as the prefix.
- _check_username (oldname, newname)
- A helper invoked by update_self to see whether a username change is possible. Returns True or False.
- _create_schema
- Override to BaseModel._create_schema, see Database Schema heading. Additionally, this method, when invoked, inserts the "root" document.
- add (openid_url, session_id)
- Creates a new user account.
- get (url_or_id)
- Selects a user record either by openid_url or __id__.
- set_user_perms (user, get_info, difference)
- Validates GET information, then either increases or decreases the perms property of a user as provided by `difference`. This method is used by administrator to promote or demote a user.
- update_self (user, post_info)
- Validates POST information and updates the user's own record accordingly.