mirror of
https://github.com/urbit/shrub.git
synced 2024-12-11 11:02:25 +03:00
Merge pull request #5489 from urbit/lf/fix-revoke
groups: fix permission handling
This commit is contained in:
commit
6c1ce45815
@ -326,7 +326,7 @@
|
||||
:_ this
|
||||
%+ turn ~(tap by associations)
|
||||
|= [=md-resource:metadata =association:metadata]
|
||||
%+ poke-our:pass:io %metadata-store
|
||||
%+ poke-our:pass:io:hc %metadata-store
|
||||
:- %metadata-update-2
|
||||
!> ^- update:metadata
|
||||
[%remove resource md-resource]
|
||||
|
@ -1,6 +1,6 @@
|
||||
:: metadata-push-hook [landscape]:
|
||||
::
|
||||
/- *group, *invite-store, store=metadata-store
|
||||
/- *group, *invite-store, store=metadata-store, group-store
|
||||
/+ default-agent, verb, dbug, grpl=group, push-hook,
|
||||
resource, mdl=metadata, gral=graph, agentio
|
||||
~% %group-hook-top ..part ~
|
||||
@ -29,6 +29,14 @@
|
||||
--
|
||||
::
|
||||
::
|
||||
=+
|
||||
^= hook-core
|
||||
|_ =bowl:gall
|
||||
+* io ~(. agentio bowl)
|
||||
pass pass:io
|
||||
++ watch-groups (~(watch-our pass /groups) %group-store /groups)
|
||||
--
|
||||
::
|
||||
=| state-zero
|
||||
=* state -
|
||||
%- agent:dbug
|
||||
@ -43,11 +51,20 @@
|
||||
met ~(. mdl bowl)
|
||||
gra ~(. gral bowl)
|
||||
io ~(. agentio bowl)
|
||||
hc ~(. hook-core bowl)
|
||||
pass pass:io
|
||||
::
|
||||
++ on-init on-init:def
|
||||
++ on-save !>(~)
|
||||
++ on-load on-load:def
|
||||
++ on-init
|
||||
:_ this
|
||||
~[watch-groups:hc]
|
||||
::
|
||||
++ on-save !>(state)
|
||||
++ on-load
|
||||
|= =vase
|
||||
=+ !<(old=versioned-state vase)
|
||||
?: ?=([%0 ~] old) `this
|
||||
:_ this
|
||||
~[watch-groups:hc]
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
@ -82,7 +99,44 @@
|
||||
==
|
||||
--
|
||||
::
|
||||
++ on-agent on-agent:def
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
?. ?=([%groups ~] wire)
|
||||
(on-agent:def wire sign)
|
||||
?+ -.sign (on-agent:def wire sign)
|
||||
%kick :_(this ~[watch-groups:hc])
|
||||
::
|
||||
%fact
|
||||
?. =(p.cage.sign %group-update-0) `this
|
||||
=+ !<(=update:group-store q.cage.sign)
|
||||
?. ?=(%remove-members -.update) `this
|
||||
|^
|
||||
=/ graphs=(set resource)
|
||||
(hosting-graphs resource.update)
|
||||
:_ this
|
||||
%+ weld
|
||||
(turn ~(tap in graphs) (cury revoke %graph-push-hook))
|
||||
?. =(entity.resource.update our.bowl) ~
|
||||
(revoke %metadata-push-hook resource.update)^~
|
||||
::
|
||||
++ revoke
|
||||
|= [=dude:gall rid=resource]
|
||||
=/ =action:push-hook [%revoke ships.update rid]
|
||||
=/ =cage push-hook-action+!>(action)
|
||||
(poke-our:pass dude cage)
|
||||
::
|
||||
++ hosting-graphs
|
||||
|= rid=resource
|
||||
^- (set resource)
|
||||
=/ graphs=associations:store
|
||||
(app-metadata-for-group:met resource.update %graph)
|
||||
%- ~(gas in *(set resource))
|
||||
%+ murn ~(tap in ~(key by graphs))
|
||||
|= [app=term graph=resource]
|
||||
?. =(our.bowl entity.graph) ~
|
||||
`graph
|
||||
--
|
||||
==
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
++ on-peek on-peek:def
|
||||
|
@ -432,7 +432,7 @@
|
||||
::
|
||||
++ tr-emis
|
||||
|= caz=(list card)
|
||||
tr-core(cards (welp (flop cards) cards))
|
||||
tr-core(cards (welp (flop caz) cards))
|
||||
::
|
||||
++ tr-ap-og
|
||||
|= ap=_^?(|.(*(quip card _pull-hook)))
|
||||
|
@ -423,11 +423,14 @@
|
||||
::
|
||||
++ revoke
|
||||
|= [ships=(set ship) rid=resource]
|
||||
=/ pax=path
|
||||
=/ ver-pax=path
|
||||
[%resource %ver (en-path:resource rid)]
|
||||
=/ unver-pax=path
|
||||
[%resource (en-path:resource rid)]
|
||||
:_ state
|
||||
%+ murn
|
||||
(incoming-subscriptions pax)
|
||||
%+ welp (incoming-subscriptions unver-pax)
|
||||
(incoming-subscriptions ver-pax)
|
||||
|= [her=ship =path]
|
||||
^- (unit card)
|
||||
?. (~(has in ships) her)
|
||||
|
@ -22,9 +22,20 @@
|
||||
:- %pull-hook-action
|
||||
!> ^- action:pull-hook
|
||||
[%remove rid]
|
||||
;< ~ bind:m (raw-poke-our %contact-pull-hook pull-hook-act)
|
||||
;< ~ bind:m (raw-poke-our %metadata-pull-hook pull-hook-act)
|
||||
;< ~ bind:m (raw-poke-our %group-pull-hook pull-hook-act)
|
||||
;< ~ bind:m (raw-poke-our %group-store %group-update-0 !>([%remove-group rid ~]))
|
||||
;< ~ bind:m (cleanup-md:view rid)
|
||||
=/ leave=cage
|
||||
:- %group-update-0
|
||||
!> ^- update:store
|
||||
[%remove-members rid (silt our.bowl ~)]
|
||||
=/ remove=cage
|
||||
:- %group-update-0
|
||||
!> ^- update:store
|
||||
[%remove-group rid ~]
|
||||
;< ~ bind:m
|
||||
(raw-poke-our %group-push-hook leave)
|
||||
;< ~ bind:m
|
||||
(raw-poke-our %group-pull-hook pull-hook-act)
|
||||
;< ~ bind:m
|
||||
(raw-poke-our %contact-pull-hook pull-hook-act)
|
||||
;< ~ bind:m
|
||||
(raw-poke-our %group-store remove)
|
||||
(pure:m !>(~))
|
||||
|
Loading…
Reference in New Issue
Block a user