Geographic Information Systems Asked on December 25, 2020
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 permissiones are restricted to groups SYSTEM and Admin and for the current user:
Project files saved under QGIS 2.x have in addition full access for groups User and Everyone:
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?
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:tmppermissions.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.
Answered by Jochen Schwarze on December 25, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP