637 |
637 |
ascii_name varchar,
|
638 |
638 |
email varchar,
|
639 |
639 |
roles text[],
|
|
640 |
is_active bool,
|
640 |
641 |
is_admin bool,
|
641 |
642 |
anonymous bool,
|
642 |
643 |
verified_fields text[],
|
... | ... | |
650 |
651 |
|
651 |
652 |
needed_fields = set(['id', 'name', 'email', 'roles', 'is_admin',
|
652 |
653 |
'anonymous', 'name_identifiers', 'verified_fields',
|
653 |
|
'lasso_dump', 'last_seen', 'fts', 'ascii_name'])
|
|
654 |
'lasso_dump', 'last_seen', 'fts', 'ascii_name', 'is_active'])
|
654 |
655 |
|
655 |
656 |
from wcs.admin.settings import UserFieldsFormDef
|
656 |
657 |
formdef = UserFieldsFormDef()
|
... | ... | |
689 |
690 |
if not 'ascii_name' in existing_fields:
|
690 |
691 |
cur.execute('ALTER TABLE %s ADD COLUMN ascii_name varchar' % table_name)
|
691 |
692 |
|
|
693 |
if not 'is_active' in existing_fields:
|
|
694 |
cur.execute('ALTER TABLE %s ADD COLUMN is_active bool DEFAULT TRUE' % table_name)
|
|
695 |
|
692 |
696 |
# delete obsolete fields
|
693 |
697 |
for field in (existing_fields - needed_fields):
|
694 |
698 |
cur.execute('''ALTER TABLE %s DROP COLUMN %s''' % (table_name, field))
|
... | ... | |
1840 |
1844 |
('lasso_dump', 'text'),
|
1841 |
1845 |
('last_seen', 'timestamp'),
|
1842 |
1846 |
('ascii_name', 'varchar'),
|
|
1847 |
('is_active', 'bool'),
|
1843 |
1848 |
]
|
1844 |
1849 |
|
1845 |
1850 |
id = None
|
... | ... | |
1864 |
1869 |
'verified_fields': self.verified_fields,
|
1865 |
1870 |
'lasso_dump': self.lasso_dump,
|
1866 |
1871 |
'last_seen': None,
|
|
1872 |
'is_active': self.is_active,
|
1867 |
1873 |
}
|
1868 |
1874 |
if self.last_seen:
|
1869 |
1875 |
sql_dict['last_seen'] = datetime.datetime.fromtimestamp(self.last_seen),
|
... | ... | |
1931 |
1937 |
o = cls()
|
1932 |
1938 |
(o.id, o.name, o.email, o.roles, o.is_admin, o.anonymous,
|
1933 |
1939 |
o.name_identifiers, o.verified_fields, o.lasso_dump,
|
1934 |
|
o.last_seen, ascii_name) = [str_encode(x) for x in tuple(row[:11])]
|
|
1940 |
o.last_seen, ascii_name, o.is_active) = [str_encode(x) for x in tuple(row[:12])]
|
1935 |
1941 |
if o.last_seen:
|
1936 |
1942 |
o.last_seen = time.mktime(o.last_seen.timetuple())
|
1937 |
1943 |
if o.roles:
|
... | ... | |
2584 |
2590 |
# 31: add user_label to formdata
|
2585 |
2591 |
# 33: add anonymised field to global view
|
2586 |
2592 |
migrate_views(conn, cur)
|
2587 |
|
if sql_level < 21:
|
|
2593 |
if sql_level < 38:
|
2588 |
2594 |
# 3: introduction of _structured for user fields
|
2589 |
2595 |
# 4: removal of identification_token
|
2590 |
2596 |
# 12: (first part) add fts to users
|
2591 |
2597 |
# 16: add verified_fields to users
|
2592 |
2598 |
# 21: (first part) add ascii_name to users
|
|
2599 |
# 38: add is_active to users
|
2593 |
2600 |
do_user_table()
|
2594 |
2601 |
if sql_level < 6:
|
2595 |
2602 |
# 6: add actions_roles_array to tables and views
|