diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-20 18:08:19 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-20 18:08:19 +0200 |
commit | 0d3a367ac97751790ea7677e13c086f22d48e8ab (patch) | |
tree | 9db3f7276d6ba16babcc939c2641fa407e1f04c8 /module/plugins/Plugin.py | |
parent | closed #111 (diff) | |
download | pyload-0d3a367ac97751790ea7677e13c086f22d48e8ab.tar.xz |
chown fix
Diffstat (limited to 'module/plugins/Plugin.py')
-rw-r--r-- | module/plugins/Plugin.py | 13 |
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 |