Implement logs model using Elasticsearch
- Implement logs model using Elasticsearch with tests - Implement transition model using both elasticsearch and database model - Add LOGS_MODEL configuration to choose which to use. Co-authored-by: Sida Chen <sidchen@redhat.com> Co-authored-by: Kenny Lee Sin Cheong <kenny.lee@redhat.com>
This commit is contained in:
parent
40c0352dd1
commit
035541c6f2
20 changed files with 1282 additions and 38 deletions
|
@ -643,6 +643,14 @@ def get_user_by_id(user_db_id):
|
|||
return None
|
||||
|
||||
|
||||
def get_user_map_by_ids(namespace_ids):
|
||||
id_user = {namespace_id: None for namespace_id in namespace_ids}
|
||||
users = User.select().where(User.id << namespace_ids, User.organization == False)
|
||||
for user in users:
|
||||
id_user[user.id] = user
|
||||
|
||||
return id_user
|
||||
|
||||
def get_namespace_user_by_user_id(namespace_user_db_id):
|
||||
try:
|
||||
return User.get(User.id == namespace_user_db_id, User.robot == False)
|
||||
|
@ -1068,6 +1076,10 @@ def list_namespace_geo_restrictions(namespace_name):
|
|||
.where(User.username == namespace_name))
|
||||
|
||||
|
||||
def get_minimum_user_id():
|
||||
return User.select(fn.Min(User.id)).tuples().get()[0]
|
||||
|
||||
|
||||
class LoginWrappedDBUser(UserMixin):
|
||||
def __init__(self, user_uuid, db_user=None):
|
||||
self._uuid = user_uuid
|
||||
|
|
Reference in a new issue