Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | import xmlrpclib as x |
---|
3 | c = x.ServerProxy('https://localhost:9779') |
---|
4 | returncode = 0 |
---|
5 | try: |
---|
6 | magickey = open('/etc/n4d/key').readlines()[0].strip() |
---|
7 | returncode = 1 |
---|
8 | except Exception as e: |
---|
9 | pass |
---|
10 | |
---|
11 | if returncode == 1: |
---|
12 | try: |
---|
13 | groupstosync = c.get_available_groups(magickey,'Golem') |
---|
14 | |
---|
15 | environment = {'NEVERLAND_VAR':'add_user','ARGV':{}} |
---|
16 | execfile('/usr/share/n4d/hooks/golem/51_moodle_create-cohorte.py',environment) |
---|
17 | |
---|
18 | for group in groupstosync: |
---|
19 | environment = {'NEVERLAND_VAR':'add_group','ARGV':{'group':{'cn':group['cn'][0]}}} |
---|
20 | execfile('/usr/share/n4d/hooks/golem/51_moodle_create-cohorte.py',environment) |
---|
21 | for user in group['memberUid']: |
---|
22 | environment = {"NEVERLAND_VAR":"add_to_group","ARGV":{"group":{"cn":group["cn"][0]},"user":{"uid":user}}} |
---|
23 | execfile('/usr/share/n4d/hooks/golem/51_moodle_create-cohorte.py',environment) |
---|
24 | except: |
---|
25 | pass |
---|
Note: See
TracBrowser
for help on using the repository browser.