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.

2
  • 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
    Commented May 23, 2019 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
    Commented May 24, 2019 at 7:46

1 Answer 1

2

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.

2
  • i am running into this issue, and can't find the check box for "save credentials" in 3.36.1. any help?
    – gotjosh
    Commented Apr 13 at 11:11
  • @gotjosh try editing the connection in the data source manager
    – JGH
    Commented Apr 13 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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