contacts + chat: move permission-hook syncing for managed groups to contact-view so everyone can depend on it

This commit is contained in:
Logan Allen 2020-03-01 16:38:46 -08:00
parent 8b2398b3e2
commit 5915840237
3 changed files with 40 additions and 21 deletions

View File

@ -207,7 +207,7 @@
~
%- zing
:~ (create-chat app-path.act security.act allow-history.act)
%- create-managed-group
%- create-group
:* group-path.act
security.act
members.act
@ -215,8 +215,6 @@
description.act
==
(create-metadata title.act description.act group-path.act app-path.act)
(create-security group-path.act security.act)
~[(permission-hook-poke [%add-owned group-path.act group-path.act])]
==
::
%delete
@ -229,9 +227,7 @@
==
::
?: (is-managed group-path) ~
:~ (permission-hook-poke [%remove group-path])
(permission-poke [%delete group-path])
(group-poke [%unbundle group-path])
:~ (group-poke [%unbundle group-path])
(metadata-hook-poke [%remove group-path])
==
==
@ -253,18 +249,34 @@
(chat-hook-poke [%add-owned path security history])
==
::
++ create-managed-group
++ create-group
|= [=path security=rw-security ships=(set ship) title=@t desc=@t]
^- (list card)
?^ (group-scry path) ~
:: do not create a managed group if this is a sig path or a blacklist
::
?: =(security %channel)
~[(group-poke [%bundle path])]
:~ (group-poke [%bundle path])
(create-security path security)
(permission-hook-poke [%add-owned path path])
==
?: (is-managed path)
~[(contact-view-poke [%create path ships title desc])]
:~ (group-poke [%bundle path])
(group-poke [%add ships path])
(create-security path security)
(permission-hook-poke [%add-owned path path])
==
::
++ create-security
|= [pax=path sec=rw-security]
^- card
?+ sec !!
%channel
(perm-group-hook-poke [%associate pax [[pax %black] ~ ~]])
::
%village
(perm-group-hook-poke [%associate pax [[pax %white] ~ ~]])
==
::
++ create-metadata
@ -284,17 +296,6 @@
(metadata-hook-poke [%add-owned group-path])
==
::
++ create-security
|= [pax=path sec=rw-security]
^- (list card)
?+ sec ~
%channel
~[(perm-group-hook-poke [%associate pax [[pax %black] ~ ~]])]
::
%village
~[(perm-group-hook-poke [%associate pax [[pax %white] ~ ~]])]
==
::
++ contact-view-poke
|= act=[%create =path ships=(set ship) title=@t description=@t]
^- card

View File

@ -6,7 +6,9 @@
*invite-store,
*contact-hook,
*metadata-store,
*metadata-hook
*metadata-hook,
*permission-group-hook,
*permission-hook
/+ *server, *contact-json, base64, default-agent
/= index
/^ octs
@ -137,6 +139,8 @@
(contact-hook-poke [%add-owned path.act])
(group-hook-poke [%add our.bol path.act])
(group-poke [%add (~(put in ships.act) our.bol) path.act])
(perm-group-hook-poke [%associate path.act [[path.act %white] ~ ~]])
(permission-hook-poke [%add-owned path.act path.act])
==
(create-metadata path.act title.act description.act)
::
@ -237,6 +241,20 @@
^- card
[%pass / %agent [our.bol %metadata-hook] %poke %metadata-hook-action !>(act)]
::
++ perm-group-hook-poke
|= act=permission-group-hook-action
^- card
:* %pass / %agent [our.bol %permission-group-hook]
%poke %permission-group-hook-action !>(act)
==
::
++ permission-hook-poke
|= act=permission-hook-action
^- card
:* %pass / %agent [our.bol %permission-hook]
%poke %permission-hook-action !>(act)
==
::
++ create-metadata
|= [=path title=@t description=@t]
^- (list card)

File diff suppressed because one or more lines are too long