Skip to content

Instantly share code, notes, and snippets.

@tacryt-socryp
Created August 14, 2019 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tacryt-socryp/13568cde42434320e739cea9491daa10 to your computer and use it in GitHub Desktop.
Save tacryt-socryp/13568cde42434320e739cea9491daa10 to your computer and use it in GitHub Desktop.
UP: Userspace architecture example
:: hooks/associate-groups-permissions.hoon
|%
+$ state
$% [%0 state-zero]
==
::
+$ group-path path
+$ permission-path path
::
+$ state-zero
$: assocation=(map group-path (set permission-path))
==
::
+$ association-action
$% $: %associate
=group-path
permission-paths=(set permission-path)
=permission
==
$: %dissociate
=group-path
permission-paths=(set permission-path)
==
==
::
--
::
|_ [bol=bowl:gall state]
::
++ this .
::
:: +peek
:: /permissions/:pax (pax is optional, if ~ receive set of keys)
:: /affiliation/:ship
::
++ peek .
::
++ poke-association-action
::
--
:: service/groups.hoon
|%
+$ state
$% [%0 state-zero]
==
::
+$ state-zero
$: groups=(map @tas group)
member=(map ship (set path))
==
::
+$ group
$% [%members members=(set ship)]
[%subgroups groups=(map @tas group)]
==
::
+$ group-action
$% [%add member=(set ship) group=path]
[%remove member=(set ship) group=path]
[%bundle group=path]
[%unbundle group=path]
==
::
+$ group-diff
$% [%add member=(set ship) group=path]
[%remove member=(set ship) group=path]
[%bundle group=path]
[%unbundle group=path]
==
::
--
::
|_ [bol=bowl:gall state]
::
++ this .
::
:: +peek
:: /groups/:pax (pax is optional, if ~ receive set of keys)
:: /member/:ship
::
::
++ peek .
::
++ poke-group-action
::
--
:: service/permissions.hoon
|%
+$ state
$% [%0 state-zero]
==
::
+$ permission
$% [%white (set ship)]
[%black (set ship)]
==
::
+$ state-zero
$: permissions=(map path permission)
affiliation=(map ship (set path))
==
::
+$ permission-action
$% [%create pax=path =permission]
[%add pax=path ships=(set ship)]
[%remove pax=path ships=(set ship)]
[%allow pax=path ships=(set ship)]
[%deny pax=path ships(set ship)]
[%delete pax=path]
==
::
--
::
|_ [bol=bowl:gall state]
::
++ this .
::
:: +peek
:: /permissions/:pax (pax is optional, if ~ receive set of keys)
:: /affiliation/:ship
::
++ peek .
::
++ poke-permission-action
::
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment