Skip to content

Instantly share code, notes, and snippets.

@artpar
Created October 5, 2024 08:14
Show Gist options
  • Select an option

  • Save artpar/5c5cb090e015debdf00e14c9335d60cd to your computer and use it in GitHub Desktop.

Select an option

Save artpar/5c5cb090e015debdf00e14c9335d60cd to your computer and use it in GitHub Desktop.
daptin permission scene 1

customer object need permission UserRefer since the auth token invoking the permission is the same as user_account_id of this row

hundredx=# select 561441 | 8192; ?column?

569633 (1 row)

hundredx=# update customer set permission = 569633; UPDATE 6

each individual memory need to be added the "users" usergroup itself with permission GroupRefer hundredx=# select * from memory_memory_id_has_usergroup_usergroup_id; id | version | created_at | updated_at | reference_id | permission | memory_id | usergroup_id ----+---------+----------------------------+----------------------------+------------------------------------+------------+-----------+-------------- 1 | 1 | 2024-09-30 13:05:57.578833 | 2024-09-30 13:05:57.578835 | \x01924309a140749085ac959aca525568 | 561441 | 2 | 3 2 | 1 | 2024-09-30 13:05:57.580921 | 2024-09-30 13:05:57.580923 | \x01924309a1447edb9ade7c7b76d9361a | 561441 | 5 | 3 3 | 1 | 2024-09-30 13:05:57.584969 | 2024-09-30 13:05:57.584971 | \x01924309a14771cea904f1bee50c3766 | 561441 | 3 | 3 4 | 1 | 2024-09-30 13:05:57.590602 | 2024-09-30 13:05:57.590604 | \x01924309a14d7c33983538b8696c5a83 | 561441 | 4 | 3 5 | 1 | 2024-09-30 13:05:57.594577 | 2024-09-30 13:05:57.594578 | \x01924309a1517333915b0cba8f09ecff | 561441 | 1 | 3 (5 rows)

hundredx=# select 564441 | 1048576; ?column?

1613017

hundredx=# select 1613017 & 1048576; ?column?

1048576 (1 row)

hundredx=# update memory_memory_id_has_usergroup_usergroup_id set permission = 1613017; UPDATE 5

hundredx=# hundredx=# select id, reference_id, permission from world where table_name = 'customer_favourites_for_has_memory_favourites_of'; id | reference_id | permission ----+------------------------------------+------------ 73 | \x019241f34a38779597c49202eee8855e | 561441 (1 row)

hundredx=# select * from world_world_id_has_usergroup_usergroup_id; id | version | created_at | updated_at | reference_id | permission | world_id | usergroup_id ----+---------+----------------------------+----------------------------+------------------------------------+------------+----------+-------------- 1 | 1 | 2024-09-30 13:05:36.242266 | 2024-09-30 13:05:36.242268 | \x019243094ded73cc818b8dbb28765cbb | 1097728 | 32 | 3 (1 row)

this "join table" itself need to be added to the "users" usergroup (which i do via dashboard)

the new memory usergroup join table row permission need to be updated to add GroupRefer hundredx=# select * from world_world_id_has_usergroup_usergroup_id; id | version | created_at | updated_at | reference_id | permission | world_id | usergroup_id ----+---------+----------------------------+----------------------------+------------------------------------+------------+----------+-------------- 1 | 1 | 2024-09-30 13:05:36.242266 | 2024-09-30 13:05:36.242268 | \x019243094ded73cc818b8dbb28765cbb | 1097728 | 32 | 3 3 | 1 | 2024-10-04 13:16:33.754583 | 2024-10-04 13:16:33.754583 | \x019257acc65773fcb652645471d6aa38 | 561441 | 73 | 3 (2 rows)

hundredx=# hundredx=# hundredx=# update world_world_id_has_usergroup_usergroup_id set permission = 1048576 where id = 3; UPDATE 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment