aboutsummaryrefslogtreecommitdiffstats
path: root/backend/magiback
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2023-06-30 11:28:07 +0200
committerPapoteur <papoteur@mageia.org>2023-06-30 11:28:07 +0200
commit23cd3e7048252777e6bb38288b66c14c2ec718db (patch)
tree8be4424b6c21b3603ee5c8846a1098cea378a3c1 /backend/magiback
parentd9ed76e1088e8af27bdea226a9f562e91209283a (diff)
downloadisodumper-23cd3e7048252777e6bb38288b66c14c2ec718db.tar
isodumper-23cd3e7048252777e6bb38288b66c14c2ec718db.tar.gz
isodumper-23cd3e7048252777e6bb38288b66c14c2ec718db.tar.bz2
isodumper-23cd3e7048252777e6bb38288b66c14c2ec718db.tar.xz
isodumper-23cd3e7048252777e6bb38288b66c14c2ec718db.zip
Give user ownership to the backup image.
Diffstat (limited to 'backend/magiback')
-rwxr-xr-xbackend/magiback21
1 files changed, 20 insertions, 1 deletions
diff --git a/backend/magiback b/backend/magiback
index c65b3a3..526e98a 100755
--- a/backend/magiback
+++ b/backend/magiback
@@ -38,6 +38,12 @@ class Isodumper(raw_write.Dumper):
<arg type='s' name='label' direction='in'/>
<arg type='s' name='key' direction='in'/>
</method>
+ <method name='set_backup_mode'>
+ <arg type='x' name='uid' direction='in'/>
+ <arg type='x' name='gid' direction='in'/>
+ </method>
+ <method name='unset_backup_mode'>
+ </method>
<method name='end'>
<arg type='b' name='success' direction='out'/>
<arg type='s' name='message' direction='out'/>
@@ -69,11 +75,14 @@ class Isodumper(raw_write.Dumper):
self.signature_checked = False
self.writing_perm = False
self.writing_target = ""
+ self.backup_mode = False
+ self.uid = 0
+ self.gid = 0
def do_write(self, source, target, size, dbus_context):
self.finished.clear()
if check_permission('org.mageia.Magiback.Isodumper.write', dbus_context):
- self.thread = threading.Thread(target=self._do_write, args=(source, target, size, ))
+ self.thread = threading.Thread(target=self._do_write, args=(source, target, size, self.backup_mode, self.uid, self.uid))
self.thread.start()
logging.debug("Writing thread started")
self.writing_perm = True
@@ -124,6 +133,16 @@ class Isodumper(raw_write.Dumper):
self.thread = threading.Thread(target=self._check_write, args=(target, source,))
self.thread.start()
+ def set_backup_mode(self, uid, gid):
+ self.backup_mode = True
+ self.uid = uid
+ self.gid = gid
+
+ def unset_backup_mode(self):
+ self.backup_mode = False
+ self.uid = 0
+ self.gid = 0
+
def run(self):
self.loop.run()