-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Corrige la mauvaise permission sur les galeries lors de la désinscrip…
…tion (#6693)
- Loading branch information
1 parent
4096ebf
commit b39c7fc
Showing
2 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
zds/gallery/migrations/0008_normalize_user_gallery_mode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Generated by Django 4.2.16 on 2024-11-21 22:39 | ||
|
||
""" | ||
In production, the column `mode` of the table gallery_usergallery contains both | ||
lower case 'w' and upper case 'W': | ||
SELECT mode, COUNT(*) AS nb FROM gallery_usergallery GROUP BY BINARY mode; | ||
+------+-------+ | ||
| mode | nb | | ||
+------+-------+ | ||
| R | 10 | | ||
| W | 22693 | | ||
| w | 603 | | ||
+------+-------+ | ||
while only the upper case 'W' is actually recognized (see value of | ||
zds.gallery.models.GALLERY_WRITE). This comes probably from the the permission | ||
modification of galleries when a member unregisters itself: the lower case 'w' | ||
was hard-coded. | ||
This migration changes 'w' to 'W'. | ||
""" | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("gallery", "0007_auto_20191122_1154"), | ||
] | ||
|
||
operations = [ | ||
# This WHERE is actually case *in*sensitive, but it will not change | ||
# the result (just modify more records which don't need it), but | ||
# having a WHERE which is case-sensitive *and* compatible with both | ||
# SQLite and MariaDB seems tricky... | ||
migrations.RunSQL( | ||
("UPDATE gallery_usergallery SET mode = 'W' WHERE mode = 'w';"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters