mirror of
https://github.com/ae-utbm/sith.git
synced 2026-03-21 19:15:10 +00:00
remove settings.SITH_MAXIMUM_FREE_ROLE
This commit is contained in:
@@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
import django.db.models.functions.datetime
|
import django.db.models.functions.datetime
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
from django.db.migrations.state import StateApps
|
from django.db.migrations.state import StateApps
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.utils.timezone import localdate
|
from django.utils.timezone import localdate
|
||||||
|
|
||||||
|
# Before the club role rework, the maximum free role
|
||||||
|
# was the hardcoded highest non-board role
|
||||||
|
MAXIMUM_FREE_ROLE = 1
|
||||||
|
|
||||||
|
|
||||||
def migrate_meta_groups(apps: StateApps, schema_editor):
|
def migrate_meta_groups(apps: StateApps, schema_editor):
|
||||||
"""Attach the existing meta groups to the clubs.
|
"""Attach the existing meta groups to the clubs.
|
||||||
@@ -46,10 +49,7 @@ def migrate_meta_groups(apps: StateApps, schema_editor):
|
|||||||
).select_related("user")
|
).select_related("user")
|
||||||
club.members_group.users.set([m.user for m in memberships])
|
club.members_group.users.set([m.user for m in memberships])
|
||||||
club.board_group.users.set(
|
club.board_group.users.set(
|
||||||
[
|
[m.user for m in memberships.filter(role__gt=MAXIMUM_FREE_ROLE)]
|
||||||
m.user
|
|
||||||
for m in memberships.filter(role__gt=settings.SITH_MAXIMUM_FREE_ROLE)
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# Generated by Django 5.2.3 on 2025-06-21 21:59
|
# Generated by Django 5.2.3 on 2025-06-21 21:59
|
||||||
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
from django.db.migrations.state import StateApps
|
from django.db.migrations.state import StateApps
|
||||||
from django.db.models import Case, When
|
from django.db.models import Case, When
|
||||||
|
|
||||||
PRESIDENT_ROLE = 10
|
PRESIDENT_ROLE = 10
|
||||||
|
MAXIMUM_FREE_ROLE = 1
|
||||||
SITH_CLUB_ROLES = {
|
SITH_CLUB_ROLES = {
|
||||||
10: "Président⸱e",
|
10: "Président⸱e",
|
||||||
9: "Vice-Président⸱e",
|
9: "Vice-Président⸱e",
|
||||||
@@ -28,7 +28,7 @@ def migrate_roles(apps: StateApps, schema_editor):
|
|||||||
for club_id, role in Membership.objects.values_list("club", "role").distinct():
|
for club_id, role in Membership.objects.values_list("club", "role").distinct():
|
||||||
new_role = ClubRole.objects.create(
|
new_role = ClubRole.objects.create(
|
||||||
name=SITH_CLUB_ROLES[role],
|
name=SITH_CLUB_ROLES[role],
|
||||||
is_board=role > settings.SITH_MAXIMUM_FREE_ROLE,
|
is_board=role > MAXIMUM_FREE_ROLE,
|
||||||
is_presidency=role == PRESIDENT_ROLE,
|
is_presidency=role == PRESIDENT_ROLE,
|
||||||
club_id=club_id,
|
club_id=club_id,
|
||||||
order=PRESIDENT_ROLE - role,
|
order=PRESIDENT_ROLE - role,
|
||||||
|
|||||||
@@ -574,11 +574,6 @@ SITH_SUBSCRIPTIONS = {
|
|||||||
# To be completed....
|
# To be completed....
|
||||||
}
|
}
|
||||||
|
|
||||||
# This corresponds to the maximum role a user can freely subscribe to
|
|
||||||
# In this case, SITH_MAXIMUM_FREE_ROLE=1 means that a user can
|
|
||||||
# set himself as "Membre actif" or "Curieux", but not higher
|
|
||||||
SITH_MAXIMUM_FREE_ROLE = 1
|
|
||||||
|
|
||||||
# Minutes to timeout the logged barmen
|
# Minutes to timeout the logged barmen
|
||||||
SITH_BARMAN_TIMEOUT = 30
|
SITH_BARMAN_TIMEOUT = 30
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user