diff options
author | Milo Casagrande <milo@ubuntu.com> | 2013-05-17 19:10:57 +0200 |
---|---|---|
committer | Milo Casagrande <milo@ubuntu.com> | 2013-05-17 19:10:57 +0200 |
commit | 56484b2a4e6130fc5f47132a2431cddb5b640210 (patch) | |
tree | e4d27a2ab285bdb8d72fb47b9a2ccc9afbbc0aa9 | |
parent | 73a0d43b8cec8b9d8c08f5a94a4c18360a360da7 (diff) |
Added new system commands.
* Added a command to set sgid to directories.
* Added command to fix permissions on the file system.
-rw-r--r-- | rhodecode/lib/system_command.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/rhodecode/lib/system_command.py b/rhodecode/lib/system_command.py index 04d5d69c..364b2fab 100644 --- a/rhodecode/lib/system_command.py +++ b/rhodecode/lib/system_command.py @@ -77,6 +77,27 @@ class SystemCommand(): cls.execute(cmd_args) @classmethod + def set_guid(cls, path): + cmd_args = ["chmod", "g+s", path] + cls.execute(cmd_args) + + @classmethod + def fix_permissions(cls, path): + """Fix file system level permissions. + + This is used to correctly set the SGUID bit, fix write permissions for + directory and files of the group. + """ + cls.set_guid(path) + cmd_args = ["find", path, "-type", "d", "-exec", "chmod", "g+ws", + "{}", ";"] + cls.execute(cmd_args) + + cmd_args = ["find", path, "-type", "f", "-exec", "chmod", "g+w", + "{}", ";"] + cls.execute(cmd_args) + + @classmethod def get_system_groups(cls): cmd_args = ["getent", "group"] try: |