From 0d3a367ac97751790ea7677e13c086f22d48e8ab Mon Sep 17 00:00:00 2001 From: RaNaN Date: Mon, 20 Sep 2010 18:08:19 +0200 Subject: chown fix --- module/plugins/Plugin.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'module/plugins') 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 -- cgit v1.2.3