mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-17 19:59:29 +00:00
if the account is already disabled, skip it
This commit is contained in:
@@ -26,10 +26,11 @@ class RemoveInvalidUsers():
|
|||||||
# Check each service account and disable access if they're not allowed
|
# Check each service account and disable access if they're not allowed
|
||||||
for servacc in ServiceAccount.objects.filter(user=user):
|
for servacc in ServiceAccount.objects.filter(user=user):
|
||||||
if not (set(user.groups.all()) & set(servacc.service.groups.all())):
|
if not (set(user.groups.all()) & set(servacc.service.groups.all())):
|
||||||
self._logger.info("User %s is not in allowed group for %s, deleting account" % (user.username, servacc.service))
|
if servacc.active:
|
||||||
servacc.active = 0
|
self._logger.info("User %s is not in allowed group for %s, deleting account" % (user.username, servacc.service))
|
||||||
servacc.save()
|
servacc.active = 0
|
||||||
servacc.user.message_set.create(message="Your %s account has been disabled due to lack of permissions. If this is incorrect, check your API keys." % (servacc.service))
|
servacc.save()
|
||||||
|
servacc.user.message_set.create(message="Your %s account has been disabled due to lack of permissions. If this is incorrect, check your API keys." % (servacc.service))
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if not servacc.active:
|
if not servacc.active:
|
||||||
|
|||||||
Reference in New Issue
Block a user