Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
2 changes: 2 additions & 0 deletions cortexes/drive-perm-migr/axon/axon.opts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
2 changes: 2 additions & 0 deletions cortexes/drive-perm-migr/axon/blob.opts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
1 change: 1 addition & 0 deletions cortexes/drive-perm-migr/axon/cell.guid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b433e9fc9d8cfa11488eb5a6f24652e8
1 change: 1 addition & 0 deletions cortexes/drive-perm-migr/axon/cookie.secret
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ca57bd774cdc25b2570188c0239d0b6f
Binary file not shown.
2 changes: 2 additions & 0 deletions cortexes/drive-perm-migr/axon/slabs/cell.opts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
1 change: 1 addition & 0 deletions cortexes/drive-perm-migr/cell.guid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0b54edc05d0f28a72f4c09586840f22c
1 change: 1 addition & 0 deletions cortexes/drive-perm-migr/cookie.secret
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
48de8c872563136ecbbfbcb4f27e2db2
1 change: 1 addition & 0 deletions cortexes/drive-perm-migr/jsonstor/cell.guid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
537480abc98569d8638fff2a36d13055
1 change: 1 addition & 0 deletions cortexes/drive-perm-migr/jsonstor/cookie.secret
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b715beb742c663019ccc896dd84472e3
Binary file not shown.
2 changes: 2 additions & 0 deletions cortexes/drive-perm-migr/jsonstor/slabs/cell.opts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
2 changes: 2 additions & 0 deletions cortexes/drive-perm-migr/slabs/cell.opts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
2 changes: 2 additions & 0 deletions cortexes/drive-perm-migr/slabs/graphs.opts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
2 changes: 2 additions & 0 deletions cortexes/drive-perm-migr/slabs/nexus.opts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
2 changes: 2 additions & 0 deletions cortexes/drive-perm-migr/slabs/queues.opts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- {}
...
80 changes: 80 additions & 0 deletions scripts/gen-drive-perm-cortex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import asyncio
import shutil

import synapse.common as s_common
import synapse.cortex as s_cortex

import synapse.lib.cell as s_cell
import synapse.lib.version as s_version

import synapse.tools.backup as s_backup

async def main():
maxver = (2, 213, 0)
if s_version.version > maxver:
verstr = '.'.join(map(str, maxver))
mesg = f'This regression cortex MUST be generated with a cortex LTE {verstr}, not {s_version.verstring}.'
raise s_exc.BadVersion(mesg=mesg, curv=s_version.verstring, maxver=maxver)

name = 'drive-perm-migr'
tmpdir = f'/tmp/{name}'
modldir = f'cortexes/{name}'

shutil.rmtree(tmpdir, ignore_errors=True)
shutil.rmtree(modldir, ignore_errors=True)

async with await s_cortex.Cortex.anit(tmpdir) as core:
ldog = await core.auth.addRole('littledog')
bdog = await core.auth.addRole('bigdog')

louis = await core.auth.addUser('lewis')
tim = await core.auth.addUser('tim')
mj = await core.auth.addUser('mj')

await core.addUserRole(tim.iden, ldog.iden)
await core.addUserRole(louis.iden, bdog.iden)

name = 'driveitemdefaultperms'
info = {
'name': name,
'iden': s_common.guid((name,)),
'version': (0, 1, 0)
}
await core.addDriveItem(info)

name = 'permfolder'
info = {
'name': name,
'iden': s_common.guid((name,)),
'version': (1, 0, 0),
'perm': {
'users': {
tim.iden: s_cell.PERM_ADMIN
},
'roles': {}
}
}
await core.addDriveItem(info)

name = 'driveitemwithperms'
info = {
'name': name,
'iden': s_common.guid((name,)),
'perm': {
'users': {
mj.iden: s_cell.PERM_ADMIN,
},
'roles': {
ldog.iden: s_cell.PERM_READ,
bdog.iden: s_cell.PERM_EDIT,
},
'default': s_cell.PERM_DENY
},
'version': (0, 1, 0)
}
await core.addDriveItem(info, path='permfolder')

s_backup.backup(tmpdir, modldir)

if __name__ == '__main__':
asyncio.run(main())