From c02ab50a0a5674fae4576b758e837ed3a1266b25 Mon Sep 17 00:00:00 2001 From: sadnub Date: Sun, 10 Apr 2022 10:46:47 -0400 Subject: [PATCH] clear role cache on save --- api/tacticalrmm/accounts/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/tacticalrmm/accounts/models.py b/api/tacticalrmm/accounts/models.py index 1eff1bb8..0ee137e0 100644 --- a/api/tacticalrmm/accounts/models.py +++ b/api/tacticalrmm/accounts/models.py @@ -197,6 +197,12 @@ class Role(BaseAuditModel): def __str__(self): return self.name + def save(self, *args, **kwargs) -> None: + + # delete cache on save + cache.delete(f"{ROLE_CACHE_PREFIX}{self.name}") + super(BaseAuditModel, self).save(*args, **kwargs) + @staticmethod def serialize(role): # serializes the agent and returns json