0

I have multiple QGIS projects with PostGIS layers saved to different schemas (new feature in QGIS 3.x). I created various users with different privileges, but for the sake of this problem, let's assume that that there are 2 PostGIS users: one with all privileges and the other with read-only abilities.

When I connect to a PostGIS database using read-only credentials and load layers alone into QGIS, everything's fine, the user can only read and cannot edit layers in any way.

When I load the project, all layers and symbology are correctly loaded with it, but the read_only user appears to have all the privileges associated with the user that created the project. Even on the layers list when I move the cursor over the layer, it points to a different user.

At first I suspected QGIS might have somehow saved privileges of the admin user and use them to bypass PostGIS. I checked on other PC, on which I had never logged to any of the databases, and the problem persists.

Has anyone encountered such problem and perhaps have a solution? I wouldn't want to stop using that feature (saving QGIS projects to PostGIS), it's very convenient.

  • 1
    Isn't it that userB connects to the DB (read only), then load the QGIS project. Its connection stops being used at that point. Within the project, the credentials of userA are saved and used for the layer, by anybody that can access the project. You would have to re-save the project without the credentials. – JGH May 23 at 11:24
  • That was it. Unchecking 'save credentials' when connecting to a DB before saving the project fixed the problem. Can you post it as an answer, so I can mark it as a solution? Thanks! – Dreamscape May 24 at 7:46
1

UserB connects to the DB (read only), then load the QGIS project. Its connection stops being used at that point.

Within the project, the credentials of userA are saved and used for the layer, by anybody that can access the project.

You would have to re-save the project in the DB without the credentials.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.