forked from nfsnfs/COSCUP-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitial_setup.py
29 lines (24 loc) · 1.19 KB
/
initial_setup.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-import sys
from pymongo import MongoClient
from db.permission import Permission
import permission_setting
db = MongoClient().coscup2015
def init_permission():
db.permission.insert(permission_setting.self_permission)
db.permission.insert(permission_setting.admin_permission)
db.permission.insert(permission_setting.team_admin_permission)
db.permission.insert(permission_setting.organizer_permission)
db.permission.insert(permission_setting.team_committee_permission)
db.permission.insert(permission_setting.team_field_permission)
db.permission.insert(permission_setting.team_sales_permission)
db.permission.insert(permission_setting.team_cpr_permission)
db.permission.insert(permission_setting.team_marketing_permission)
db.permission.insert(permission_setting.team_accountant_permission)
db.permission.insert(permission_setting.cashier_permission)
db.permission.insert(permission_setting.team_archiving_permission)
if __name__ == '__main__':
db.user_account.ensure_index('id', unique=True)
db.user_data.ensure_index('id', unique=True)
db.permission.ensure_index('role', unique=True)
init_permission()