diff --git a/packages/postgres-database/src/simcore_postgres_database/migration/versions/5e27063c3ac9_set_privacy_hide_email_to_false_.py b/packages/postgres-database/src/simcore_postgres_database/migration/versions/5e27063c3ac9_set_privacy_hide_email_to_false_.py new file mode 100644 index 00000000000..2381193baeb --- /dev/null +++ b/packages/postgres-database/src/simcore_postgres_database/migration/versions/5e27063c3ac9_set_privacy_hide_email_to_false_.py @@ -0,0 +1,34 @@ +"""set privacy_hide_email to false temporarily + +Revision ID: 5e27063c3ac9 +Revises: 4d007819e61a +Create Date: 2024-12-10 15:50:48.024204+00:00 + +""" +from alembic import op +from sqlalchemy.sql import expression + +# revision identifiers, used by Alembic. +revision = "5e27063c3ac9" +down_revision = "4d007819e61a" +branch_labels = None +depends_on = None + + +def upgrade(): + # Change the server_default of privacy_hide_email to false + with op.batch_alter_table("users") as batch_op: + batch_op.alter_column("privacy_hide_email", server_default=expression.false()) + + # Reset all to default: Update existing values in the database + op.execute("UPDATE users SET privacy_hide_email = false") + + +def downgrade(): + + # Revert the server_default of privacy_hide_email to true + with op.batch_alter_table("users") as batch_op: + batch_op.alter_column("privacy_hide_email", server_default=expression.true()) + + # Reset all to default: Revert existing values in the database to true + op.execute("UPDATE users SET privacy_hide_email = true") diff --git a/packages/postgres-database/src/simcore_postgres_database/models/users.py b/packages/postgres-database/src/simcore_postgres_database/models/users.py index d42568d772f..bdff1293211 100644 --- a/packages/postgres-database/src/simcore_postgres_database/models/users.py +++ b/packages/postgres-database/src/simcore_postgres_database/models/users.py @@ -161,7 +161,7 @@ class UserStatus(str, Enum): "privacy_hide_email", sa.Boolean, nullable=False, - server_default=expression.true(), + server_default=expression.false(), doc="If true, it hides users.email to others", ), # diff --git a/services/web/server/src/simcore_service_webserver/groups/_groups_api.py b/services/web/server/src/simcore_service_webserver/groups/_groups_api.py index 27b80baf821..ad76c9ba3d9 100644 --- a/services/web/server/src/simcore_service_webserver/groups/_groups_api.py +++ b/services/web/server/src/simcore_service_webserver/groups/_groups_api.py @@ -102,7 +102,7 @@ async def get_associated_group( user_id: UserID, group_id: GroupID, ) -> tuple[Group, AccessRightsDict]: - """ + """NOTE: here it can also be a non-standard group raises GroupNotFoundError raises UserInsufficientRightsError: needs READ access