remove svn kwds
[plcapi.git] / db-config.d / 001-admin_user
1 # -*-python-*-
2 #################### 
3 # Create/update the default administrator account (should be person_id 2).
4
5 admin = { 'person_id': 2,
6           'first_name': "Default",
7           'last_name': "Administrator",
8           'email': plc['root_user'],
9           'password': plc['root_password'] }
10 persons = GetPersons([admin['person_id']])
11 if not persons:
12     person_id = AddPerson(admin)
13     if person_id != admin['person_id']:
14         # Huh? Someone deleted the account manually from the database.
15         DeletePerson(person_id)
16         raise Exception, "Someone deleted the \"%s %s\" account from the database!" % \
17               (admin['first_name'], admin['last_name'])
18     UpdatePerson(person_id, { 'enabled': True })
19 else:
20     person_id = persons[0]['person_id']
21     UpdatePerson(person_id, admin)
22