mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Move blacklist checking out of the Application model
This commit is contained in:
20
hr/tasks.py
Normal file
20
hr/tasks.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from django.conf import settings
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
from celery.decorators import task
|
||||
from hr.utils import blacklist_values
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
@task(ignore_result=True)
|
||||
def blacklist_check():
|
||||
log = blacklist_check.get_logger()
|
||||
|
||||
users = User.objects.filter(active=True)
|
||||
|
||||
for u in users:
|
||||
if users.groups.count() > 0:
|
||||
# Has groups
|
||||
val = blacklist_values(user)
|
||||
if len(val) > 0:
|
||||
# Report possible issue
|
||||
log.warn("Suspect User: %s, %s entries found" % (u.username, len(val)))
|
||||
Reference in New Issue
Block a user