CPI Ordering System (the old version)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

24 lines
783 B

''' Models for User Accounts and Roles '''
import enum
class Role(enum.Enum):
''' roles of user accounts '''
UNVALIDATED = 'unvalidated' #: new user, email not validated
NEW = 'new' #: new user, email validated, not active
USER = 'user' #: standard user, may place and view orders
PURCHASER = 'purchaser' #: privileged user, may edit orders
ADMIN = 'admin' #: fully privileged user
INACTIVE = 'inactive' #: user that is no longer active ("deleted")
@property
def principal(self):
''' returns the principal identifier of the role '''
return 'role:' + self.name.lower()
def __str__(self):
''' string representation '''
return self.name.capitalize()