Superuser role is lost

Hello there, I am using DHIS2 version 2.38. and I accidentally removed the authorities -ALL authority of superuser role. what should I do to bring back those authorities. @Gassim Please help

@blen are you currently able to log in with your superuser Account . Who else is the superuser other than you in the system

no-one is superuser just me . and yes I can login

@blen If you have direct access to the DHIS2 database (Postgres), you can try to re-add the lost authority manually.

  1. Login to your DHIS2 server console and launch PostgreSQL client:
    sudo -u postgres -i psql
  2. In the PostgreSQL client console, connect to your DHIS2 database (we assume that its name is dhis):
    \c dhis
  3. Find an internal database role ID (userroleid) for a Superuser:
    SELECT userroleid FROM userrole WHERE code='Superuser';
    This command should return a numeric value (typically, it is 2).
  4. Recreate the missing authority for a Superuser, using just obtained userroleid value (2):
    INSERT INTO userroleauthorities (userroleid, authority) VALUES (2, 'ALL');
  5. Check that you have inserted the record correctly and you can find the ALL authority in the list:
    SELECT authority FROM userroleauthorities WHERE userroleid=2;
  6. Check through the DHIS2 web UI that the permissions are back.
3 Likes