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 :: data store that holds individual contact data
:: ::
/- store=contact-store, *resource /- store=contact-store, *resource
/+ default-agent, dbug, *migrate /+ default-agent, dbug, *migrate, contact
|% |%
+$ card card:agent:gall +$ card card:agent:gall
+$ state-4 +$ state-4
@ -29,6 +29,7 @@
|_ =bowl:gall |_ =bowl:gall
+* this . +* this .
def ~(. (default-agent this %|) bowl) def ~(. (default-agent this %|) bowl)
con ~(. contact bowl)
:: ::
++ on-init ++ on-init
=. rolodex (~(put by rolodex) our.bowl *contact:store) =. rolodex (~(put by rolodex) our.bowl *contact:store)
@ -216,6 +217,12 @@
:: ::
[%x %allowed-groups ~] [%x %allowed-groups ~]
``noun+!>(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 ++ 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] |= [rid=resource =ship]
^- ? ^- ?
=/ grp ~(. group bowl) =/ grp ~(. group bowl)
=/ shp (scry-for ? /allowed-ship/(scot %p ship)) :: if they are requesting our personal profile, check if we are
?: ?& scry-is-public :: either public, or if they are on the allowed-ships list.
=(rid [our.bowl %'']) :: this is used for direct messages and leap searches
::
?: ?& =(rid [our.bowl %''])
?| scry-is-public
(scry-for ? /allowed-ship/(scot %p ship))
== ==
%.y %.y
?: shp %.y :: if they are requesting our profile within a group, make sure we
?: ?& (~(has in scry-sharing) rid) :: 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) (~(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)
-- --

View File

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