function to merge two users
This commit is contained in:
parent
6793c165b3
commit
5e8294b1c0
1 changed files with 19 additions and 0 deletions
|
@ -381,3 +381,22 @@ def has_capability(user, capability):
|
||||||
level = user.get_profile().get_level()
|
level = user.get_profile().get_level()
|
||||||
return level in settings.CONFIG['capabilities'][capability] \
|
return level in settings.CONFIG['capabilities'][capability] \
|
||||||
and settings.CONFIG['capabilities'][capability][level]
|
and settings.CONFIG['capabilities'][capability][level]
|
||||||
|
|
||||||
|
|
||||||
|
def merge_users(old, new):
|
||||||
|
old.annotations.all().update(user=new)
|
||||||
|
old.edits.all().update(user=new)
|
||||||
|
old.entities.all().update(user=new)
|
||||||
|
old.events.all().update(user=new)
|
||||||
|
old.files.all().update(user=new)
|
||||||
|
old.items.all().update(user=new)
|
||||||
|
old.lits.all().update(user=new)
|
||||||
|
old.places.all().update(user=new)
|
||||||
|
old.subscribed_edits.all().update(user=new)
|
||||||
|
old.subscribed_lists.all().update(user=new)
|
||||||
|
old.subscribed_texts.all().update(user=new)
|
||||||
|
old.texts.all().update(user=new)
|
||||||
|
old.volumes.all().update(user=new)
|
||||||
|
old.log_set.all().update(user=new)
|
||||||
|
old.changelog.all().update(user=new)
|
||||||
|
old.logentry_set.all().update(user=new)
|
||||||
|
|
Loading…
Reference in a new issue