mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
chg: [investigation] fix investigation by user + delete an obj from all investigation
This commit is contained in:
parent
91010dddf1
commit
860ad9b67d
1 changed files with 11 additions and 2 deletions
|
@ -270,7 +270,7 @@ def exists_investigation(investigation_uuid):
|
|||
|
||||
# created by user
|
||||
def get_user_all_investigations(user_id):
|
||||
return r_tracking.smembers('investigations:user:{user_id}')
|
||||
return r_tracking.smembers(f'investigations:user:{user_id}')
|
||||
|
||||
def is_object_investigated(obj_id, obj_type, subtype=''):
|
||||
return r_tracking.exists(f'obj:investigations:{obj_type}:{subtype}:{obj_id}')
|
||||
|
@ -278,6 +278,15 @@ def is_object_investigated(obj_id, obj_type, subtype=''):
|
|||
def get_obj_investigations(obj_id, obj_type, subtype=''):
|
||||
return r_tracking.smembers(f'obj:investigations:{obj_type}:{subtype}:{obj_id}')
|
||||
|
||||
def delete_obj_investigations(obj_id, obj_type, subtype=''):
|
||||
unregistred = False
|
||||
for investigation_uuid in get_obj_investigations(obj_id, obj_type, subtype=subtype):
|
||||
investigation = Investigation(investigation_uuid)
|
||||
investigation.unregister_object(obj_id, obj_type, subtype)
|
||||
unregistred = True
|
||||
return unregistred
|
||||
|
||||
|
||||
# # TODO: fix default threat_level analysis
|
||||
# # TODO: limit description + name
|
||||
# # TODO: sanityze tags
|
||||
|
@ -286,7 +295,7 @@ def create_investigation(user_id, date, name, threat_level, analysis, info, tags
|
|||
investigation_uuid = generate_uuid()
|
||||
r_tracking.sadd('investigations:all', investigation_uuid)
|
||||
# user map
|
||||
r_tracking.sadd('investigations:user:{user_id}', investigation_uuid)
|
||||
r_tracking.sadd(f'investigations:user:{user_id}', investigation_uuid)
|
||||
# metadata
|
||||
r_tracking.hset(f'investigations:data:{investigation_uuid}', 'creator_user', user_id)
|
||||
|
||||
|
|
Loading…
Reference in a new issue