source: home-linker/trunk/fuentes/home-linker.install/usr/bin/get_acl_from_server

Last change on this file was 7631, checked in by kbut, 21 months ago

add fix on media folder

  • Property svn:executable set to *
File size: 817 bytes
Line 
1#!/usr/bin/env python
2import xmlrpclib as x
3import sys
4import os
5if len(sys.argv) != 4:
6        sys.exit(0)
7home = sys.argv[1]
8group = sys.argv[2]
9user = sys.argv[3]
10media = "/media/" + user
11s = x.ServerProxy('https://server:9779')
12list_acl = s.get_acl_group_filtered('','NetFoldersManager',group)
13try:
14        apply_nobody_nogroup = False
15        if len(list_acl) > 0:
16                list_acl.append(['-m','u:'+user+':rwx'])
17                apply_nobody_nogroup = True
18        for x in list_acl:
19                os.system('setfacl ' + ' '.join(x) + ' "' + home + '"')
20       
21
22        # Apply --- to others to every single home
23        os.system('setfacl -m o:--- "%s"'%home)
24        if os.path.exists(media):
25                os.system('setfacl -kb ' + media )
26                os.system('setfacl -m u:'+ user+ ':rx ' + media )
27               
28        if apply_nobody_nogroup:
29                os.system('chown ' + user+':nogroup "' + home + '"')
30except Exception as e:
31        pass
Note: See TracBrowser for help on using the repository browser.