4

When saving a project under QGIS 3.x on a local Windows PC under e.g. c:\tmp another user logged on to the PC cannot open the project due to lacking permissions. The project file saved from QGIS 3 permissions are restricted to groups SYSTEM and Admin and for the current user:

enter image description here

Project files saved under QGIS 2.x have in addition full access for groups User and Everyone:

enter image description here

Changing permissions for the target folder (c:\tmp) has no affect. Remarkable: This behavior does not apply to i.e. Layer definitions saved from QGIS 3, these have the same permissions as project files saved from QGIS 2 (cp. above screenshot).

Is this a bug or a feature or am I missing any settings?

2
  • After setting the target folder permissions, new files saved in this directory should inherit the folder permissions.
    – JGH
    Sep 11 '20 at 12:08
  • @JGH That's what I expect, but then the permissions for QGIS 2 and QGIS 3 project files shouldn't differ, but they do. And as I stated above, changes in the target folders permissions have no effect :-( Sep 14 '20 at 11:23
1

Here is a workaround that catches the QgsProject.projectSaved signal and creates a batch file and executes it:

import os
from qgis.core import QgsProject

bat_tmp = """@echo off
             set quelle="path_to_qgz"
             icacls %quelle% /grant Jeder:(CI)(OI)(F)
             pause
          """

def setPermissions():
    
    qgs_path = os.path.normpath(QgsProject.instance().fileName())
    batch_path = os.path.normpath('c:\\tmp\\permissions.bat')
    
    with open(batch_path, 'w') as file:
        file.write(bat_tmp.replace('path_to_qgz', qgs_path))
    
    os.system(batch_path)

QgsProject.instance().projectSaved.connect(setPermissions)
    

This can be executed from python console editor or putted in a startup-script.

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.