-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcreate_auth.py
More file actions
executable file
·40 lines (29 loc) · 1001 Bytes
/
create_auth.py
File metadata and controls
executable file
·40 lines (29 loc) · 1001 Bytes
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
#!/usr/bin/env python
#
#
# Regenerate files in example_conf
from datetime import datetime
from cork import Cork
def makeuser(cork, username, password, tstamp):
cork._store.users[username] = {
'role': 'admin',
'hash': cork._hash(username, password),
'email_addr': username + '@localhost.local',
'desc': username + ' test user',
'creation_date': tstamp
}
def populate_conf_directory():
cork = Cork('auth', initialize=True)
cork._store.roles['admin'] = 100
cork._store.roles['editor'] = 60
cork._store.roles['user'] = 50
cork._store._savejson('roles', cork._store.roles)
tstamp = str(datetime.utcnow())
print "Change the usernames and passwords in the code"
exit()
makeuser(cork, 'admin', 'CHANGEME', tstamp)
makeuser(cork, 'someuser', 'CHANGEME', tstamp)
makeuser(cork, 'woohoo', 'CHANGEME', tstamp)
cork._store._save_users()
if __name__ == '__main__':
populate_conf_directory()