support robots in findUsers api
This commit is contained in:
parent
7db8135b61
commit
a562ec428a
2 changed files with 6 additions and 4 deletions
|
@ -21,8 +21,9 @@ def parseCondition(condition, user):
|
|||
exclude = False
|
||||
|
||||
if k == 'level':
|
||||
if v in settings.CONFIG['userLevels']:
|
||||
v = settings.CONFIG['userLevels'].index(v)
|
||||
levels = ['robot'] + settings.CONFIG['userLevels']
|
||||
if v in levels:
|
||||
v = levels.index(v) - 1
|
||||
else:
|
||||
v = 0
|
||||
key = '%s%s' % (k, {
|
||||
|
|
|
@ -56,6 +56,8 @@ class SessionData(models.Model):
|
|||
self.browser = None
|
||||
if not self.system:
|
||||
self.system = None
|
||||
if ua.get('robot'):
|
||||
self.level = -1
|
||||
if self.ip:
|
||||
try:
|
||||
g = GeoIP()
|
||||
|
@ -82,7 +84,6 @@ class SessionData(models.Model):
|
|||
self.groupssort = ''.join([g.name for g in self.user.groups.all()])
|
||||
self.numberoflists = self.user.lists.count()
|
||||
else:
|
||||
self.level = 0
|
||||
self.groupssort = None
|
||||
super(SessionData, self).save(*args, **kwargs)
|
||||
|
||||
|
@ -124,7 +125,7 @@ class SessionData(models.Model):
|
|||
'ip': self.ip,
|
||||
'id': self.get_id(),
|
||||
'lastseen': self.lastseen,
|
||||
'level': 'guest',
|
||||
'level': ua.get('robot') and 'robot' or 'guest',
|
||||
'location': self.location,
|
||||
'newsletter': False,
|
||||
'notes': '',
|
||||
|
|
Loading…
Reference in a new issue