summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-09-20 18:08:19 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-09-20 18:08:19 +0200
commit0d3a367ac97751790ea7677e13c086f22d48e8ab (patch)
tree9db3f7276d6ba16babcc939c2641fa407e1f04c8 /module/plugins
parentclosed #111 (diff)
downloadpyload-0d3a367ac97751790ea7677e13c086f22d48e8ab.tar.xz
chown fix
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/Plugin.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index e8ef15202..c623b90cc 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -31,6 +31,10 @@ from os.path import exists
from os import remove
from os import makedirs
from os import chmod
+from os import chown
+
+from pwd import getpwnam
+from grp import getgrnam
from mimetypes import guess_type
@@ -273,4 +277,13 @@ class Plugin(object):
if self.core.config["permission"]["change_file"]:
chmod(join(location, name), int(self.core.config["permission"]["file"],8))
+ if self.core.config["permission"]["change_user"] and self.core.config["permission"]["change_group"]:
+ try:
+ uid = getpwnam(self.config["permission"]["user"])
+ gid = getgrnam(self.config["permission"]["group"])
+
+ chown(join(location, name), uid, gid)
+ except Exception,e:
+ self.log.warning(_("Setting User and Group failed: %s") % str(e))
+
return join(location, name) \ No newline at end of file