Skip to content

Commit

Permalink
fix(model,destination) : replace get_permissions by `get_scopes_by_…
Browse files Browse the repository at this point in the history
…action`
  • Loading branch information
jacquesfize committed Oct 2, 2024
1 parent 7b0e00d commit 6b116f9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/geonature/core/imports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from collections.abc import Mapping
import re
from typing import Iterable, List, Optional
from geonature.core.gn_permissions.models import PermAction, Permission
from packaging import version

from flask import g
Expand All @@ -28,7 +27,7 @@

from geonature.utils.env import db
from geonature.utils.celery import celery_app
from geonature.core.gn_permissions.tools import get_permissions, get_scopes_by_action
from geonature.core.gn_permissions.tools import get_scopes_by_action
from geonature.core.gn_commons.models import TModules
from geonature.core.gn_meta.models import TDatasets
from pypnnomenclature.models import BibNomenclaturesTypes
Expand Down Expand Up @@ -176,10 +175,10 @@ def allowed_destinations(user: Optional[User] = None) -> List["Destination"]:
# Filter destinations based on permissions for each destination module for the selected user
allowed_destination = []
for dest in all_destination:
perm = get_permissions(
max_scope = get_scopes_by_action(

Check warning on line 178 in backend/geonature/core/imports/models.py

View check run for this annotation

Codecov / codecov/patch

backend/geonature/core/imports/models.py#L176-L178

Added lines #L176 - L178 were not covered by tests
action_code="C", id_role=user.id_role, module_code=dest.module.module_code
)
if len(perm) > 0:
if max_scope > 0:
allowed_destination.append(dest)
return allowed_destination

Check warning on line 183 in backend/geonature/core/imports/models.py

View check run for this annotation

Codecov / codecov/patch

backend/geonature/core/imports/models.py#L181-L183

Added lines #L181 - L183 were not covered by tests

Expand Down

0 comments on commit 6b116f9

Please sign in to comment.