Skip to content
Snippets Groups Projects
Commit 0b5b0c54 authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

feat: add user to default groups

parent 7b8c6288
No related branches found
No related tags found
1 merge request!153Add user to default groups
...@@ -266,13 +266,25 @@ def task_manager(ch, method, properties, body): ...@@ -266,13 +266,25 @@ def task_manager(ch, method, properties, body):
# Send trigger message # Send trigger message
rc_rmq.publish_msg({"routing_key": routing_key, "msg": message}) rc_rmq.publish_msg({"routing_key": routing_key, "msg": message})
if task_name == "create_account" and success:
rc_rmq.publish_msg(
{
"routing_key": "group_member.add",
"msg": {
"groups": {"add": rcfg.default_groups},
"username": username,
"host": msg.get("host"),
"updated_by": msg.get("updated_by"),
"interface": msg.get("interface"),
},
}
)
logger.debug(f"Trigger message '{routing_key}' sent") logger.debug(f"Trigger message '{routing_key}' sent")
logger.debug("Previous level messages acknowledged") logger.debug("Previous level messages acknowledged")
# Send report to admin # Send report to admin
if completed or terminated: if completed or terminated:
notify_admin(username, current) notify_admin(username, current)
update_db(username, {"reported": True}) update_db(username, {"reported": True})
...@@ -295,7 +307,6 @@ def timeout_handler(signum, frame): ...@@ -295,7 +307,6 @@ def timeout_handler(signum, frame):
delta = current_time - tracking[user]["last_update"] delta = current_time - tracking[user]["last_update"]
if delta.seconds > timeout: if delta.seconds > timeout:
rc_rmq.publish_msg( rc_rmq.publish_msg(
{ {
"routing_key": "complete." + user, "routing_key": "complete." + user,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment