What's changed
Bug Fixes (3)
-
admin: prevent manual username changes for existing users in Django admin (#6839)
This PR locks down the
usernamefield in the Django admin panel for
existing users, preventing superusers from manually changing it and
breaking the_userform_idmapping in MongoDB.Manually changing a username via the Django admin updates the relational
database but leaves MongoDB documents out of sync. Because the
_userform_idkey in MongoDB relies on the original username, altering
it breaks submission retrieval and detaches submissions from their
correct projects. -
permissions: org admins can see and manage all asset permissions (#6836)
Organization admins were unable to see other users' permission
assignments on projects belonging to their organization.Organization admins receive
manage_assetimplicitly through their org
role — noObjectPermissionrecord is created in the database. The
permission visibility logic for both the asset detail endpoint and the
organization assets list relied solely on explicit DB records to
determine whether the requesting user could see all assignments. As a
result, org admins were silently treated as regular users and could only
see the owner's and their own permissions, making it impossible to
manage sharing from the project detail page. -
scripts: display detailed error output on unexpected migration failures (#6830)
Fixes a logging issue in
scripts/migrate.shwhere unexpected migration
tracebacks were hidden from the console, restoring standard error
visibility for developers.In a recent update (see
kpi#6796), we automated
the resolution of materialized view schema locks during deployments. To
achieve this, we updatedscripts/migrate.shto capture the output of
the Djangomigratecommand into a bash variable ($MIGRATE_OUT) so we
could scan it for specific locking errors.However, this had an unintended side effect: it swallowed the Python
traceback for all other types of migration crashes. If a migration
failed for an unrelated reason (like a broken model or bad arguments),
the developer only saw a generic "failed for an unknown reason" message,
making debugging incredibly difficult.This PR fixes that oversight by ensuring the
$MIGRATE_OUTvariable is
explicitly echoed to the console before the script exits, restoring full
Django error visibility when unexpected migration failures occur.
Full Changelog: https://github.com/kobotoolbox/kpi/compare/2.026.07..2.026.07a
Full Changelog: 2.026.07...2.026.07a