contact: improved +is-allowed and added %contact-share mark

This commit is contained in:
Logan Allen 2021-02-02 17:04:28 -06:00
parent 33eabe2574
commit a728514aa5
4 changed files with 32 additions and 15 deletions

View File

@ -3,7 +3,7 @@
:: data store that holds individual contact data
::
/- store=contact-store, *resource
/+ default-agent, dbug, *migrate
/+ default-agent, dbug, *migrate, contact
|%
+$ card card:agent:gall
+$ state-4
@ -29,6 +29,7 @@
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
con ~(. contact bowl)
::
++ on-init
=. rolodex (~(put by rolodex) our.bowl *contact:store)
@ -216,6 +217,12 @@
::
[%x %allowed-groups ~]
``noun+!>(allowed-groups)
::
[%x %is-allowed @ ~]
=/ =ship (slav %p i.t.t.path)
~& ship
``json+!>(`json`b+(is-allowed:con [our.bowl %''] ship))
==
::
++ on-leave on-leave:def

View File

@ -173,4 +173,10 @@
==
--
--
::
++ share-dejs
=, dejs:format
|%
++ share (ot [%share (su ;~(pfix sig fed:ag))]~)
--
--

View File

@ -70,20 +70,21 @@
|= [rid=resource =ship]
^- ?
=/ grp ~(. group bowl)
=/ shp (scry-for ? /allowed-ship/(scot %p ship))
?: ?& scry-is-public
=(rid [our.bowl %''])
:: if they are requesting our personal profile, check if we are
:: either public, or if they are on the allowed-ships list.
:: this is used for direct messages and leap searches
::
?: ?& =(rid [our.bowl %''])
?| scry-is-public
(scry-for ? /allowed-ship/(scot %p ship))
==
%.y
?: shp %.y
?: ?& (~(has in scry-sharing) rid)
(~(has in (members:grp rid)) ship)
==
%.y
=/ allowed-groups ~(tap in (scry-for (set resource) /allowed-groups))
|-
?~ allowed-groups %.n
?: (~(has in (members:grp i.allowed-groups)) ship)
%.y
$(allowed-groups t.allowed-groups)
:: if they are requesting our profile within a group, make sure we
:: are the host of that group and that they are a member of the group
::
=/ allowed-groups (scry-for (set resource) /allowed-groups)
?& (~(has in allowed-groups) rid)
(~(has in scry-sharing) rid)
(~(has in (members:grp rid)) ship)
==
--

View File

@ -1,3 +1,5 @@
/+ *contact-store
::
|_ share=[%share =ship]
++ grad %noun
++ grow
@ -8,5 +10,6 @@
++ grab
|%
++ noun share
++ json share:share-dejs
--
--