Skip to content

Commit

Permalink
Fix permissions for instructeurs departementaux
Browse files Browse the repository at this point in the history
  • Loading branch information
syldb committed Sep 30, 2024
1 parent 92a87b3 commit 7d6934d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion siap/custom_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ def _find_or_create_entity(
in GroupProfileRole.readonly_group_profile_roles()
)

# Set admininistration in session for SIAP_SER_DEP to give access to "Votre administration"
if from_habilitation["groupe"]["profil"]["code"] == GroupProfile.SIAP_SER_DEP:
administration = get_or_create_administration(from_habilitation["gestionnaire"])
request.session["administration"] = model_to_dict(
administration,
fields=[
"id",
"uuid",
"code",
"nom",
],
)

if from_habilitation["groupe"]["profil"]["code"] in [
GroupProfile.SIAP_ADM_CENTRALE,
GroupProfile.SIAP_ASS_HLM,
Expand Down Expand Up @@ -242,7 +255,6 @@ def _find_or_create_entity(

if from_habilitation["groupe"]["profil"]["code"] in [
GroupProfile.SIAP_SER_GEST,
GroupProfile.SIAP_SER_DEP,
]:
# create if not exists gestionnaire
administration = get_or_create_administration(from_habilitation["gestionnaire"])
Expand Down

0 comments on commit 7d6934d

Please sign in to comment.