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

Last change on this file since 2469 was 2469, checked in by daduve, 4 years ago

Adding new files

  • Property svn:executable set to *
File size: 675 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]
10s = x.ServerProxy('https://server:9779')
11list_acl = s.get_acl_group_filtered('','NetFoldersManager',group)
12try:
13        apply_nobody_nogroup = False
14        if len(list_acl) > 0:
15                list_acl.append(['-m','u:'+user+':rwx'])
16                apply_nobody_nogroup = True
17        for x in list_acl:
18                os.system('setfacl ' + ' '.join(x) + ' "' + home + '"')
19               
20        # Apply --- to others to every single home
21        os.system('setfacl -m o:--- "%s"'%home)
22       
23        if apply_nobody_nogroup:
24                os.system('chown ' + user+':nogroup "' + home + '"')
25except Exception as e:
26        pass
Note: See TracBrowser for help on using the repository browser.