Models needed for registration, and user servicing.
Bases: pyramid_fullauth.models.mixins.password.UserPasswordMixin, pyramid_fullauth.models.mixins.email.UserEmailMixin, sqlalchemy.ext.declarative.api.Base
User object.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in kwargs.
Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
Perform soft delete action. along with checking if it’s super admin, or not.
Rises pyramid_fullauth.exceptions.DeleteException: | |
---|---|
if you try to delete last super admin. |
Note
You should use this method to delete users
Check if user is active.
Returns: | Returns False if user account is not active (or deleted). |
---|---|
Return type: | bool |
Return provider identification for give user.
Parameters: | provider (str) – provider name |
---|---|
Returns: | provider identification |
Return type: | str |
Validate is_admin value, we forbid the deletion of the last superadmin.
Note
More about simple validators: http://docs.sqlalchemy.org/en/latest/orm/mapper_config.html#simple-validators
Raises AttributeError: | |
---|---|
Information about an error |
User group object.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in kwargs.
Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
Model to store authentication methods for different providers.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in kwargs.
Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
Authentication field definition along with appropriate methods.
password field
hash_algorithm field
salt field
reset key field
Check if password correspond to the saved one.
Parameters: | password (str) – password to compare |
---|---|
Returns: | True, if password is same, False if not |
Return type: | bool |
Produce hash out of a password.
Parameters: | |
---|---|
Returns: | hashed password |
Return type: | str |
Validate password.
Password validator keeps new password hashed. Rises Value error on empty password
Parameters: | |
---|---|
Returns: | hashed and salted password |
Return type: | str |
Raises: | pyramid_fullauth.exceptions.EmptyError |
Note
If you’re using this Mixin on your own User object, don’t forget to add a listener as well, like that:
from sqlalchemy.event import listen
listen(User.password, 'set', User.password_listener, retval=True)
Note
For more information on Attribute Events in sqlalchemy see:
User email fields and functionality.
Change email after activation.
We don’t clear new email field because of validator of email which won’t allow to None value.
Set new email and generate new email change hash.
Parameters: | email_new (str) – email address |
---|---|
Returns: | generated email_change_key |
Trype: | str |
Validate email addresses.
Note
See pyramid docs about simple validators
Parameters: | |
---|---|
Raises: |
|