dont record changes from other users

increase protocol version to block outdated users.
This commit is contained in:
j 2016-01-08 23:19:00 +05:30
commit 031665bc24
3 changed files with 12 additions and 5 deletions

View file

@ -60,6 +60,7 @@ class Changelog(db.Model):
state.db.session.commit()
#if state.nodes:
# state.nodes.queue('peered', 'pushChanges', [c.json()])
logger.debug('record change: %s', c.json())
@classmethod
def record_ts(cls, user, ts, action, *args):
@ -76,6 +77,7 @@ class Changelog(db.Model):
state.db.session.commit()
#if state.nodes:
# state.nodes.queue('peered', 'pushChanges', [c.json()])
logger.debug('record change: %s', c.json())
@classmethod
def apply_changes(cls, user, changes):
@ -168,6 +170,10 @@ class Changelog(db.Model):
if i.timestamp > timestamp:
logger.debug('ignore edititem change %s %s %s', timestamp, itemid, meta)
return True
if state.user() in i.users:
logger.debug('ignore edititem events for own items %s %s %s', timestamp, itemid, meta)
logger.debug('----------------------item.modified: %s', i.modifed)
return True
primary = None
if 'primaryid' in meta:
primary = meta['primaryid']
@ -294,7 +300,7 @@ class Changelog(db.Model):
if not m or m.timestamp < timestamp:
if not m:
m = Metadata.get_or_create(key, value)
if m.edit(data):
if m.edit(data, False):
m.update_items()
user.clear_smart_list_cache()
return True