Skip to content
Snippets Groups Projects
Commit 329a9a1c authored by Harsha Kethineni's avatar Harsha Kethineni
Browse files

db upgrade group.roles->permissions

parent 80218b84
No related branches found
No related tags found
No related merge requests found
......@@ -1114,6 +1114,22 @@ def upgrade_to_30():
def upgrade_to_31():
config.db.sessions.update_many({'subject.firstname_hash': {'$exists': True}}, {'$unset': {'subject.firstname_hash':""}})
config.db.sessions.update_many({'subject.lastname_hash': {'$exists': True}}, {'$unset': {'subject.lastname_hash':""}})
def upgrade_to_32_closure(group):
result = config.db.groups.update_one({'_id': group['_id']}, {'$rename': {'roles': 'permissions'}})
if result.modified_count == 1:
return True
else:
return 'Parallel failed: update doc ' + str(job['_id']) + ' resulted modified ' + str(result.modified_count)
def upgrade_to_32():
"""
Changes group.roles -> groups.permissions
scitran/core #662
"""
cursor = config.db.groups.find({})
process_cursor(cursor, upgrade_to_30_closure)
def upgrade_to_32_closure(coll_item, coll):
permissions = coll_item.get('permissions', [])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment