metadata-store, various: update scry library

This commit is contained in:
Liam Fitzgerald 2021-01-13 14:05:22 +10:00
parent d724e933b3
commit 9b6ec09fe9
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
7 changed files with 24 additions and 39 deletions

View File

@ -278,7 +278,7 @@
=/ app-rid=resource
(path-to-resource path)
=/ group-rid=resource
(fall (group-from-app-resource:met %graph app-rid) [nobody %bad-group])
(fall (peek-group:met %graph app-rid) [nobody %bad-group])
=/ group=(unit group)
(scry-group:grp group-rid)
:- (add-graph app-rid mailbox)

View File

@ -25,13 +25,13 @@
^- ?
=/ grp ~(. group bowl)
=/ met ~(. metadata bowl)
=/ groups
(groups-from-resource:met [%graph resource])
?~ groups %.n
=/ group=(unit resource:res)
(peek-group:met [%graph resource])
?~ group %.n
?: requires-admin
(is-admin:grp src.bowl i.groups)
?| (is-member:grp src.bowl i.groups)
(is-admin:grp src.bowl i.groups)
(is-admin:grp src.bowl u.group)
?| (is-member:grp src.bowl u.group)
(is-admin:grp src.bowl u.group)
==
::
++ is-allowed-remove

View File

@ -192,7 +192,7 @@
|= rid=resource
^- (quip card _state)
=/ group-rid=(unit resource)
(group-from-app-resource:met %graph rid)
(peek-group:met %graph rid)
?~ group-rid
~& no-group+rid
`state
@ -217,12 +217,12 @@
rid=resource
==
=/ group=(unit resource)
(group-from-app-resource:met %graph rid)
(peek-group:met %graph rid)
?~ group
~& no-group+rid
`state
=/ metadata=(unit metadata:metadata-store)
(peek-metadata:met %graph u.group rid)
(peek-metadata:met %graph rid)
?~ metadata `state
abet:check:(abed:handle-update:ha rid nodes u.group module.u.metadata)
--

View File

@ -1,5 +1,6 @@
/- *metadata-store
/+ resource
^?
|%
++ associations-to-json
|= =associations

View File

@ -1,7 +1,7 @@
:: metadata: helpers for getting data from the metadata-store
::
/- *metadata-store
/+ res=resource
/+ resource
::
|_ =bowl:gall
++ app-paths-from-group
@ -22,38 +22,20 @@
?. =(app-name.md-resource app-name) ~
`resource.md-resource
::
++ peek-metadata
|= [app-name=term =group=resource:res =app=resource:res]
^- (unit metadata)
=/ group-cord=cord (scot %t (spat (en-path:res group-resource)))
=/ app-cord=cord (scot %t (spat (en-path:res app-resource)))
=/ our=cord (scot %p our.bowl)
=/ now=cord (scot %da now.bowl)
.^ (unit metadata)
++ peek-association
|= [app-name=term rid=resource]
.^ (unit association)
%gx (scot %p our.bowl) %metadata-store (scot %da now.bowl)
%metadata group-cord app-name app-cord /noun
%metadata app-name (en-path:resource rid) %noun
==
::
++ group-from-app-resource
++ peek-metadata
|= =md-resource
^- (unit resource:res)
=/ groups (groups-from-resource md-resource)
?~ groups ~
`i.groups
%+ bind (peek-association md-resource)
|=(association metadata)
::
++ groups-from-resource
++ peek-group
|= =md-resource
^- (list resource)
=; resources
%~ tap in
%+ ~(gut by resources)
md-resource
*(set resource)
.^ (jug ^md-resource resource)
%gy
(scot %p our.bowl)
%metadata-store
(scot %da now.bowl)
/resource-indices
==
%+ bind (peek-association md-resource)
|=(association group)
--

View File

@ -1,3 +1,4 @@
/- *metadata-store
/+ *metadata-json
|_ upd=metadata-update
++ grad %noun

View File

@ -1,4 +1,5 @@
/- *resource
^?
|%
::
+$ group-path path