mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
chg: [update] create default org + update trackers/retro_hunts/investigations creator_org
This commit is contained in:
parent
cbe09c87c4
commit
7bf609b0e8
2 changed files with 22 additions and 3 deletions
|
@ -90,6 +90,12 @@ class Investigation(object):
|
|||
def __init__(self, investigation_uuid):
|
||||
self.uuid = investigation_uuid
|
||||
|
||||
def _get_field(self, field):
|
||||
return r_tracking.hget(f'investigations:data:{self.uuid}', field)
|
||||
|
||||
def _set_field(self, field, value):
|
||||
r_tracking.hset(f'investigations:data:{self.uuid}', field, value)
|
||||
|
||||
def exists(self):
|
||||
return r_tracking.exists(f'investigations:data:{self.uuid}')
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ sys.path.append(os.environ['AIL_HOME'])
|
|||
# Import Project packages
|
||||
##################################
|
||||
from update.bin.ail_updater import AIL_Updater
|
||||
from lib import ail_orgs
|
||||
from lib import ail_users
|
||||
from lib import Investigations
|
||||
from lib.ConfigLoader import ConfigLoader
|
||||
|
@ -35,23 +36,35 @@ if __name__ == '__main__':
|
|||
|
||||
# USERS
|
||||
print('Updating Users ...')
|
||||
# Create Default Org
|
||||
org = ail_orgs.create_default_org()
|
||||
org_uuid = org.get_uuid()
|
||||
|
||||
for user_id in ail_users.get_users(): # TODO ORG
|
||||
ail_users.edit_user('admin@admin.test', user_id, org_uuid=org_uuid)
|
||||
r_serv_db.hset(f'ail:user:metadata:{user_id}', 'creator', 'admin@admin.test')
|
||||
r_serv_db.hset(f'ail:user:metadata:{user_id}', 'created_at', date)
|
||||
r_serv_db.hset(f'ail:user:metadata:{user_id}', 'last_edit', date)
|
||||
# ADD User to ORG
|
||||
org.add_user(user_id)
|
||||
|
||||
# INVESTIGATIONS
|
||||
print('Updating Investigations ...')
|
||||
for inv_uuid in Investigations.get_all_investigations(): # TODO Creator ORG
|
||||
for inv_uuid in Investigations.get_all_investigations():
|
||||
inv = Investigations.Investigation(inv_uuid)
|
||||
inv.set_level(1, None)
|
||||
inv._set_field('creator_org', org_uuid)
|
||||
|
||||
# TODO Trackers
|
||||
print('Updating Trackers ...')
|
||||
for tracker_uuid in Tracker.get_trackers():
|
||||
tracker = Tracker.Tracker(tracker_uuid)
|
||||
tracker._set_field('creator_org', org_uuid)
|
||||
|
||||
print('Updating Retro Hunts ...')
|
||||
for retro_hunt_uuid in Tracker.get_all_retro_hunt_tasks(): # TODO Creator ORG
|
||||
for retro_hunt_uuid in Tracker.get_all_retro_hunt_tasks():
|
||||
retro = Tracker.RetroHunt(retro_hunt_uuid)
|
||||
retro.set_level(1, None)
|
||||
retro._set_field('creator_org', org_uuid)
|
||||
|
||||
chats_viewer.fix_chats_with_messages()
|
||||
|
||||
|
|
Loading…
Reference in a new issue