1057 |
1057 |
name varchar,
|
1058 |
1058 |
ascii_name varchar,
|
1059 |
1059 |
email varchar,
|
|
1060 |
phone varchar,
|
1060 |
1061 |
roles text[],
|
1061 |
1062 |
is_active bool,
|
1062 |
1063 |
is_admin bool,
|
... | ... | |
1081 |
1082 |
'id',
|
1082 |
1083 |
'name',
|
1083 |
1084 |
'email',
|
|
1085 |
'phone',
|
1084 |
1086 |
'roles',
|
1085 |
1087 |
'is_admin',
|
1086 |
1088 |
'anonymous',
|
... | ... | |
3077 |
3079 |
('id', 'serial'),
|
3078 |
3080 |
('name', 'varchar'),
|
3079 |
3081 |
('email', 'varchar'),
|
|
3082 |
('phone', 'varchar'),
|
3080 |
3083 |
('roles', 'varchar[]'),
|
3081 |
3084 |
('is_admin', 'bool'),
|
3082 |
3085 |
('anonymous', 'bool'),
|
... | ... | |
3104 |
3107 |
'name': self.name,
|
3105 |
3108 |
'ascii_name': self.ascii_name,
|
3106 |
3109 |
'email': self.email,
|
|
3110 |
'phone': self.phone,
|
3107 |
3111 |
'roles': self.roles,
|
3108 |
3112 |
'is_admin': self.is_admin,
|
3109 |
3113 |
'anonymous': self.anonymous,
|
... | ... | |
3200 |
3204 |
o.id,
|
3201 |
3205 |
o.name,
|
3202 |
3206 |
o.email,
|
|
3207 |
o.phone,
|
3203 |
3208 |
o.roles,
|
3204 |
3209 |
o.is_admin,
|
3205 |
3210 |
o.anonymous,
|
... | ... | |
3210 |
3215 |
ascii_name, # XXX what's this ? pylint: disable=unused-variable
|
3211 |
3216 |
o.deleted_timestamp,
|
3212 |
3217 |
o.is_active,
|
3213 |
|
) = (str_encode(x) for x in tuple(row[:13]))
|
|
3218 |
) = (str_encode(x) for x in tuple(row[:14]))
|
3214 |
3219 |
if o.last_seen:
|
3215 |
3220 |
o.last_seen = time.mktime(o.last_seen.timetuple())
|
3216 |
3221 |
if o.roles:
|
... | ... | |
3285 |
3290 |
|
3286 |
3291 |
return objects
|
3287 |
3292 |
|
|
3293 |
@classmethod
|
|
3294 |
@guard_postgres
|
|
3295 |
def get_users_with_phone(cls, phone):
|
|
3296 |
conn, cur = get_connection_and_cursor()
|
|
3297 |
|
|
3298 |
sql_statement = '''SELECT %s
|
|
3299 |
FROM %s
|
|
3300 |
WHERE deleted_timestamp IS NULL
|
|
3301 |
AND phone = %%(value)s''' % (
|
|
3302 |
', '.join([x[0] for x in cls._table_static_fields] + cls.get_data_fields()),
|
|
3303 |
cls._table_name,
|
|
3304 |
)
|
|
3305 |
cur.execute(sql_statement, {'value': phone})
|
|
3306 |
objects = cls.get_objects(cur)
|
|
3307 |
conn.commit()
|
|
3308 |
cur.close()
|
|
3309 |
|
|
3310 |
return objects
|
|
3311 |
|
3288 |
3312 |
@classmethod
|
3289 |
3313 |
@guard_postgres
|
3290 |
3314 |
def get_users_with_role(cls, role_id):
|
... | ... | |
4420 |
4444 |
# latest migration, number + description (description is not used
|
4421 |
4445 |
# programmaticaly but will make sure git conflicts if two migrations are
|
4422 |
4446 |
# separately added with the same number)
|
4423 |
|
SQL_LEVEL = (67, 're-migrate legacy tokens')
|
|
4447 |
SQL_LEVEL = (68, 'add user phone field')
|
4424 |
4448 |
|
4425 |
4449 |
|
4426 |
4450 |
def migrate_global_views(conn, cur):
|
... | ... | |
4599 |
4623 |
# 67: re-migrate legacy tokens
|
4600 |
4624 |
do_tokens_table()
|
4601 |
4625 |
migrate_legacy_tokens()
|
|
4626 |
if sql_level < 68:
|
|
4627 |
do_user_table()
|
4602 |
4628 |
if sql_level < 52:
|
4603 |
4629 |
# 2: introduction of formdef_id in views
|
4604 |
4630 |
# 5: add concerned_roles_array, is_at_endpoint and fts to views
|
4605 |
|
-
|