Last change
on this file since 1330 was
1330,
checked in by kbut, 5 years ago
|
add script to sync users on install
|
File size:
844 bytes
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | import xmlrpclib as x |
---|
3 | |
---|
4 | c = x.ServerProxy('https://localhost:9779') |
---|
5 | try: |
---|
6 | magickey = open('/etc/n4d/key').readlines()[0] |
---|
7 | except Exception as e: |
---|
8 | return 0 |
---|
9 | |
---|
10 | groupstosync = c.get_available_groups(magickey,'Golem') |
---|
11 | |
---|
12 | 'add_user' |
---|
13 | environment = {'NEVERLAND_VAR':'add_user','ARGV':{}} |
---|
14 | execfile('/usr/share/n4d/hooks/golem/51_moodle_create-cohorte.py',{}) |
---|
15 | |
---|
16 | ['group']['cn'] |
---|
17 | ['user']['uid'] |
---|
18 | add_group |
---|
19 | add_to_group |
---|
20 | for group in groupstosync: |
---|
21 | environment = {'NEVERLAND_VAR':'add_group','ARGV':{'group':{'cn':group['cn'][0]}}} |
---|
22 | execfile('/usr/share/n4d/hooks/golem/51_moodle_create-cohorte.py',environment) |
---|
23 | for user in group['memberUid']: |
---|
24 | environment = {"NEVERLAND_VAR":"add_to_group","ARGV":{"group":{"cn":group["cn"][0]},"user":{"uid":user}}} |
---|
25 | execfile('/usr/share/n4d/hooks/golem/51_moodle_create-cohorte.py',environment) |
---|
26 | |
---|
Note: See
TracBrowser
for help on using the repository browser.