Change logic to look through entry changes
This commit is contained in:
parent
9695074b3e
commit
d32afb6fc1
1 changed files with 8 additions and 4 deletions
|
@ -337,14 +337,18 @@ class Jarvis(Client):
|
||||||
for role in before.roles:
|
for role in before.roles:
|
||||||
if role not in after.roles:
|
if role not in after.roles:
|
||||||
reason = "N/A"
|
reason = "N/A"
|
||||||
if entry := find(lambda x: x.new_value == role.id, auditlog.entries):
|
for entry in auditlog.entries:
|
||||||
|
if find(lambda x: x.new_value == role.id, entry.changes):
|
||||||
reason = entry.reason
|
reason = entry.reason
|
||||||
|
break
|
||||||
removed_roles[role] = reason
|
removed_roles[role] = reason
|
||||||
for role in after.roles:
|
for role in after.roles:
|
||||||
if role not in before.roles:
|
if role not in before.roles:
|
||||||
reason = "N/A"
|
reason = "N/A"
|
||||||
if entry := find(lambda x: x.new_value == role.id, auditlog.entries):
|
for entry in auditlog.entries:
|
||||||
|
if find(lambda x: x.new_value == role.id, entry.changes):
|
||||||
reason = entry.reason
|
reason = entry.reason
|
||||||
|
break
|
||||||
new_roles[role] = reason
|
new_roles[role] = reason
|
||||||
|
|
||||||
new_text = "\n".join(f"{k} [{v}]" for k, v in new_roles.items()) or "None"
|
new_text = "\n".join(f"{k} [{v}]" for k, v in new_roles.items()) or "None"
|
||||||
|
|
Loading…
Add table
Reference in a new issue