geonature.core.imports.routes#
Submodules#
Attributes#
Classes#
Functions#
|
Return the list of all destinations. If an action code is provided, only the destinations |
|
Package Contents#
- class geonature.core.imports.routes.Destination[source]#
Bases:
geonature.utils.env.db.Model
- __tablename__ = 'bib_destinations'#
- __table_args__#
- id_destination#
- id_module#
- code#
- label#
- table_name#
- module#
- entities#
- property validity_columns#
- property statistics_labels#
- property actions#
- static allowed_destinations(user: pypnusershub.db.models.User | None = None, action_code: str = 'C') List[Destination] [source]#
Return a list of allowed destinations for a given user and an action.
Parameters#
- userUser, optional
The user to filter destinations for. If not provided, the current_user is used.
- actionstr
The action to filter destinations for. Possible values are “C”, “R”, “U”, “V”, “E”, “D”.
Returns#
- allowed_destinationList of Destination
List of allowed destinations for the given user.
- filter_by_role(user: pypnusershub.db.models.User | None = None, action_code: str = 'C', **kwargs)[source]#
Filter Destination by role.
Parameters#
- userUser, optional
The user to filter destinations for. If not provided, the current_user is used.
Returns#
- sqlalchemy.sql.elements.BinaryExpression
A filter criterion for the
id_destination
column of theDestination
table.
- has_instance_permission(user: pypnusershub.db.models.User | None = None, action_code: str = 'C')[source]#
Check if a user has the permissions to do an action on this destination.
Parameters#
- userUser, optional
The user to check the permission for. If not provided, the current_user is used.
- action_codestr
The action to check the permission for. Possible values are “C”, “R”, “U”, “V”, “E”, “D”.
Returns#
- bool
True if the user has the right to do the action on this destination, False otherwise.
- class geonature.core.imports.routes.DestinationSchema[source]#
Bases:
utils_flask_sqla.schema.SmartRelationshipsMixin
,geonature.utils.env.ma.SQLAlchemyAutoSchema
- module#
- geonature.core.imports.routes.list_all_destinations(action_code)[source]#
Return the list of all destinations. If an action code is provided, only the destinations that the user has permission (based on the action_code) to access are returned.
Parameters:#
- action_codestr
The action code to filter destinations. Possible values are “C”, “R”, “U”, “V”, “E”, “D”.
Returns:#
- destinationsList of Destination
List of all destinations.