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.