mirror of https://github.com/borgbase/vorta
Check for full disk access on macOS (#952)
This commit is contained in:
parent
15a97e4570
commit
96ed84b28d
|
@ -77,6 +77,9 @@ class VortaApp(QtSingleApplication):
|
||||||
self.backup_log_event.connect(self.react_to_log)
|
self.backup_log_event.connect(self.react_to_log)
|
||||||
self.aboutToQuit.connect(self.quit_app_action)
|
self.aboutToQuit.connect(self.quit_app_action)
|
||||||
self.set_borg_details_action()
|
self.set_borg_details_action()
|
||||||
|
if sys.platform == 'darwin':
|
||||||
|
self.check_darwin_permissions()
|
||||||
|
|
||||||
self.installEventFilter(self)
|
self.installEventFilter(self)
|
||||||
|
|
||||||
def create_backups_cmdline(self, profile_name):
|
def create_backups_cmdline(self, profile_name):
|
||||||
|
@ -182,6 +185,30 @@ class VortaApp(QtSingleApplication):
|
||||||
msg.setStandardButtons(QMessageBox.Ok)
|
msg.setStandardButtons(QMessageBox.Ok)
|
||||||
msg.exec()
|
msg.exec()
|
||||||
|
|
||||||
|
def check_darwin_permissions(self):
|
||||||
|
"""
|
||||||
|
macOS restricts access to certain folders by default. For some folders, the user
|
||||||
|
will get a prompt (e.g. Documents, Downloads), while others will cause file access
|
||||||
|
errors.
|
||||||
|
|
||||||
|
This function tries reading a file that is known to be restricted and warn the user about
|
||||||
|
incomplete backups.
|
||||||
|
"""
|
||||||
|
test_path = os.path.expanduser('~/Library/Cookies')
|
||||||
|
if os.path.exists(test_path) and not os.access(test_path, os.R_OK):
|
||||||
|
msg = QMessageBox()
|
||||||
|
msg.setIcon(QMessageBox.Warning)
|
||||||
|
msg.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse)
|
||||||
|
msg.setText(self.tr("Vorta needs Full Disk Access for complete Backups"))
|
||||||
|
msg.setInformativeText(self.tr(
|
||||||
|
"Without this, some files won't be accessible and you may end up with an incomplete "
|
||||||
|
"backup. Please set <b>Full Disk Access</b> permission for Vorta in "
|
||||||
|
"<a href='x-apple.systempreferences:com.apple.preference.security?Privacy'>"
|
||||||
|
"System Preferences > Security & Privacy</a>."
|
||||||
|
))
|
||||||
|
msg.setStandardButtons(QMessageBox.Ok)
|
||||||
|
msg.exec()
|
||||||
|
|
||||||
def react_to_log(self, mgs, context):
|
def react_to_log(self, mgs, context):
|
||||||
"""
|
"""
|
||||||
Trigger Vorta actions based on Borg logs. E.g. repo lock.
|
Trigger Vorta actions based on Borg logs. E.g. repo lock.
|
||||||
|
|
Loading…
Reference in New Issue