From 3342c3222ab729f3d45523a74a0973a2c11e60d8 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 29 Jul 2022 07:43:14 +0200 Subject: [PATCH] Missing migration file --- .../versions/57179ae34069_api_permissions.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 migrations/versions/57179ae34069_api_permissions.py diff --git a/migrations/versions/57179ae34069_api_permissions.py b/migrations/versions/57179ae34069_api_permissions.py new file mode 100644 index 000000000..6ba587954 --- /dev/null +++ b/migrations/versions/57179ae34069_api_permissions.py @@ -0,0 +1,36 @@ +"""api_permissions + +Revision ID: 57179ae34069 +Revises: d718533466aa +Create Date: 2022-07-28 21:11:24.959406 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "57179ae34069" +down_revision = "d718533466aa" +branch_labels = None +depends_on = None + + +def upgrade(): + # Modification des permissions API + # APIView 1<<40 = 1099511627776 => ScoView = 4 + # APIEditGroups 1<<41 = 2199023255552 => ScoEtudChangeGroups = 1<<16 65536 + op.execute( + """ + update role set permissions = permissions | 4 where (permissions & 1099511627776) <> 0; + update role set permissions = permissions | 65536 where (permissions & 2199023255552) <> 0; + """ + ) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + pass + # ### end Alembic commands ###