geonature.core.imports.routes

Submodules

Attributes

Classes

Functions

list_all_destinations(action_code)

Return the list of all destinations. If an action code is provided, only the destinations

get_destination(destinationCode)

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
get_transient_table()[source]
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 the Destination 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.

__repr__()[source]
class geonature.core.imports.routes.DestinationSchema[source]

Bases: utils_flask_sqla.schema.SmartRelationshipsMixin, geonature.utils.env.ma.SQLAlchemyAutoSchema

class Meta
model
include_fk = True
load_instance = True
sqla_session
module
geonature.core.imports.routes.blueprint[source]
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.

geonature.core.imports.routes.get_destination(destinationCode)[source]