forked from pvelder/wlst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_users_OiD.py
92 lines (77 loc) · 2.27 KB
/
test_users_OiD.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# go to %JDEV_HOME%\wlserver_10.3\common\bin and start wlst.cmd
# execfile('c:/...../users.py')
import sys
import traceback
print 'args' + str(sys.argv)
if len(sys.argv) != 5:
print "Invalid Arguments: " + str(sys.argv)
print " Usage createUsersGroups.py adminuser password adminurl defaultpassword"
print " defaultpassword should be at least 8 characters and contain a number,punctuation mark"
exit()
username=sys.argv[1]
password=sys.argv[2]
url=sys.argv[3]
standaard_password=sys.argv[4]
connect(username,password,url)
serverConfig()
print 'lookup DefaultAuthenticator'
atnr=cmo.getSecurityConfiguration().getDefaultRealm().lookupAuthenticationProvider('OiDAuthenticator')
## Users
users_admi = ['t_admin1','t_admin2']
users_junior = ['t_jrmed1','t_jrmed2']
users_mdw = ['t_mdw1','t_mdw2']
users_samr = ['t_samr1','t_samr2']
users_fb = ['t_fb1','t_fb2']
users_om = ['t_om1','t_om2']
users_ah = ['t_ah1','t_ah2']
users = users_admi + users_junior + users_mdw + users_samr + users_fb + users_om + users_ah
for user in users:
try:
atnr.removeUser(user)
except:
pass
try:
atnr.createUser(user,standaard_password,user)
print 'created user: ',user
except:
print 'can not create user: ',user
apply(traceback.print_exception, sys.exc_info())
# add mebemrs to groups
print 'Add members to groups'
# Administratief
group = 'G-COVOG-Administratief'
if users_admi:
for user in users_admi:
print 'Add to group: ',user
atnr.addMemberToGroup(group,user)
## JuniorMedewerker
group = 'G-COVOG-JuniorMedewerker'
if users_junior:
for user in users_junior:
print 'Add to group: ',user
atnr.addMemberToGroup(group,user)
## Medewerker
group = 'G-COVOG-Medewerker'
if users_mdw:
for user in users_mdw:
print 'Add to group: ',user
atnr.addMemberToGroup(group,user)
## SAMR
group = 'G-COVOG-SAMR'
if users_samr:
for user in users_samr:
print 'Add to group: ',user
atnr.addMemberToGroup(group,user)
## Functioneel Beheer
group = 'G-COVOG-FuncBeheer'
if users_fb:
for user in users_fb:
print 'Add to group: ',user
atnr.addMemberToGroup(group,user)
## Operationeel Management
group = 'G-COVOG-OperManage'
if users_om:
for user in users_om:
print 'Add to group: ',user
atnr.addMemberToGroup(group,user)
disconnect()