1.2.1.2. models
¶
This module provides the models for the data stored in the database as well as functionality for defining and managing the models themselves.
1.2.1.2.1. Data¶
1.2.1.2.2. Functions¶
-
current_timestamp
(*args, **kwargs)[source]¶ The function used for creating the timestamp used by database objects.
Returns: The current timestamp. Return type: datetime.datetime
-
get_tables_with_column_id
(column_id)[source]¶ Get all tables which contain a column named column_id.
Parameters: column_id (str) – The column name to get all the tables of. Returns: The list of matching tables. Return type: set
1.2.1.2.3. Classes¶
-
class
BaseRowCls
[source]¶ Bases:
object
The base class from which other database table objects inherit from. Provides a standard
__repr__
method and default permission checks which are to be overridden as desired by subclasses.-
assert_session_has_permissions
(*args, **kwargs)[source]¶ A convenience function which wraps
session_has_permissions()
and raises aKingPhisherPermissionError
if the session does not have the specified permissions.
-
classmethod
metatable
()[source]¶ Generate a
MetaTable
instance for this model class.Returns: The appropriate metadata for the table represented by this model. Return type: MetaTable
-
session_has_permissions
(access, session)[source]¶ Check that the authenticated session has the permissions specified in access. The permissions in access are abbreviated with the first letter of create, read, update, and delete.
Parameters: - access (str) – The desired permissions.
- session – The authenticated session to check access for.
Returns: Whether the session has the desired permissions.
Return type:
-