perf: 优化 perms 缓存刷新

pull/7997/head v2.20.1
ibuler 2022-03-22 18:52:19 +08:00 committed by Jiangjie.Bai
parent a7d0e3ce70
commit a09a59e7b3
1 changed files with 2 additions and 0 deletions

View File

@ -224,6 +224,8 @@ class RoleManager(models.Manager):
RoleBinding.objects.bulk_create(items, ignore_conflicts=True)
except Exception as e:
logger.error('Create role binding error: {}'.format(e))
finally:
self.user.expire_users_rbac_perms_cache()
def set(self, roles):
self.clear()