2021-01-28 09:13:57 +03:00
|
|
|
/- *group
|
2020-06-08 10:53:16 +03:00
|
|
|
/+ store=group-store, resource
|
2020-06-24 03:28:57 +03:00
|
|
|
::
|
2020-05-21 07:30:02 +03:00
|
|
|
|_ =bowl:gall
|
2020-05-29 04:53:14 +03:00
|
|
|
+$ card card:agent:gall
|
2021-02-02 07:31:16 +03:00
|
|
|
::
|
|
|
|
++ resource-for-update
|
|
|
|
|= =vase
|
|
|
|
^- (list resource)
|
|
|
|
=/ =update:store !<(update:store vase)
|
|
|
|
?: ?=(%initial -.update)
|
|
|
|
~
|
|
|
|
~[resource.update]
|
|
|
|
::
|
2020-05-21 07:30:02 +03:00
|
|
|
++ scry-for
|
|
|
|
|* [=mold =path]
|
2021-01-28 09:13:57 +03:00
|
|
|
=. path
|
|
|
|
(snoc path %noun)
|
2020-05-21 07:30:02 +03:00
|
|
|
.^ mold
|
|
|
|
%gx
|
|
|
|
(scot %p our.bowl)
|
|
|
|
%group-store
|
|
|
|
(scot %da now.bowl)
|
2021-01-28 09:13:57 +03:00
|
|
|
path
|
2020-05-21 07:30:02 +03:00
|
|
|
==
|
2020-05-29 04:53:14 +03:00
|
|
|
++ scry-tag
|
2020-06-08 10:53:16 +03:00
|
|
|
|= [rid=resource =tag]
|
2020-05-29 04:53:14 +03:00
|
|
|
^- (unit (set ship))
|
|
|
|
=/ group
|
2020-06-08 10:53:16 +03:00
|
|
|
(scry-group rid)
|
2020-05-29 04:53:14 +03:00
|
|
|
?~ group
|
|
|
|
~
|
|
|
|
`(~(gut by tags.u.group) tag ~)
|
2020-05-21 07:30:02 +03:00
|
|
|
::
|
|
|
|
++ scry-group
|
2020-06-08 10:53:16 +03:00
|
|
|
|= rid=resource
|
2021-01-28 09:13:57 +03:00
|
|
|
%+ scry-for ,(unit group)
|
|
|
|
`path`groups+(en-path:resource rid)
|
2020-05-25 08:52:54 +03:00
|
|
|
::
|
2021-02-02 00:28:52 +03:00
|
|
|
++ scry-groups
|
|
|
|
.^ ,(set resource)
|
|
|
|
%gy
|
|
|
|
(scot %p our.bowl)
|
|
|
|
%group-store
|
|
|
|
(scot %da now.bowl)
|
|
|
|
/groups/noun
|
|
|
|
==
|
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
++ members
|
2020-06-08 10:53:16 +03:00
|
|
|
|= rid=resource
|
2021-01-28 09:13:57 +03:00
|
|
|
=; =group
|
|
|
|
members.group
|
|
|
|
(fall (scry-group rid) *group)
|
2020-05-21 07:30:02 +03:00
|
|
|
::
|
2020-07-02 05:17:28 +03:00
|
|
|
++ is-member
|
2021-01-12 07:26:19 +03:00
|
|
|
|= [=ship group=resource]
|
2020-05-21 07:30:02 +03:00
|
|
|
^- ?
|
|
|
|
=- (~(has in -) ship)
|
2021-01-12 07:26:19 +03:00
|
|
|
(members group)
|
2020-09-18 23:09:06 +03:00
|
|
|
::
|
|
|
|
++ is-admin
|
2021-01-12 07:26:19 +03:00
|
|
|
|= [=ship group=resource]
|
2020-09-18 23:09:06 +03:00
|
|
|
^- ?
|
2021-01-12 07:26:19 +03:00
|
|
|
=/ tags tags:(fall (scry-group group) *^group)
|
2020-09-18 23:09:06 +03:00
|
|
|
=/ admins=(set ^ship) (~(gut by tags) %admin ~)
|
|
|
|
(~(has in admins) ship)
|
2020-05-27 07:32:43 +03:00
|
|
|
:: +role-for-ship: get role for user
|
2020-05-21 07:30:02 +03:00
|
|
|
::
|
2020-05-27 07:32:43 +03:00
|
|
|
:: Returns ~ if no such group exists or user is not
|
|
|
|
:: a member of the group. Returns [~ ~] if the user
|
|
|
|
:: is a member with no additional role.
|
2020-05-21 07:30:02 +03:00
|
|
|
++ role-for-ship
|
2020-06-08 10:53:16 +03:00
|
|
|
|= [rid=resource =ship]
|
2020-05-27 07:32:43 +03:00
|
|
|
^- (unit (unit role-tag))
|
2020-05-21 07:30:02 +03:00
|
|
|
=/ grp=(unit group)
|
2020-06-08 10:53:16 +03:00
|
|
|
(scry-group rid)
|
2020-05-21 07:30:02 +03:00
|
|
|
?~ grp ~
|
|
|
|
=* group u.grp
|
|
|
|
=* policy policy.group
|
2020-05-27 09:19:29 +03:00
|
|
|
=* tags tags.group
|
2020-05-21 07:30:02 +03:00
|
|
|
=/ admins=(set ^ship)
|
2020-05-27 09:19:29 +03:00
|
|
|
(~(gut by tags) %admin ~)
|
2020-05-21 07:30:02 +03:00
|
|
|
?: (~(has in admins) ship)
|
2020-05-27 07:32:43 +03:00
|
|
|
``%admin
|
2020-05-21 07:30:02 +03:00
|
|
|
=/ mods
|
2020-05-27 09:19:29 +03:00
|
|
|
(~(gut by tags) %moderator ~)
|
2020-05-21 07:30:02 +03:00
|
|
|
?: (~(has in mods) ship)
|
2020-05-27 07:32:43 +03:00
|
|
|
``%moderator
|
2020-05-21 07:30:02 +03:00
|
|
|
=/ janitors
|
2020-05-27 09:19:29 +03:00
|
|
|
(~(gut by tags) %janitor ~)
|
2020-05-21 07:30:02 +03:00
|
|
|
?: (~(has in janitors) ship)
|
2020-05-27 07:32:43 +03:00
|
|
|
``%janitor
|
2020-05-21 07:30:02 +03:00
|
|
|
?: (~(has in members.group) ship)
|
2020-05-27 07:32:43 +03:00
|
|
|
[~ ~]
|
2020-05-21 07:30:02 +03:00
|
|
|
~
|
2020-09-18 23:09:06 +03:00
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
++ can-join
|
2020-06-08 10:53:16 +03:00
|
|
|
|= [rid=resource =ship]
|
2021-01-28 09:13:57 +03:00
|
|
|
%+ scry-for ,?
|
|
|
|
^- path
|
|
|
|
:- %groups
|
|
|
|
(weld (en-path:resource rid) /join/(scot %p ship))
|
2020-05-29 04:53:14 +03:00
|
|
|
::
|
2021-01-26 05:42:44 +03:00
|
|
|
++ get-tagged-ships
|
|
|
|
|= [rid=resource =tag]
|
|
|
|
^- (set ship)
|
|
|
|
=/ grp=(unit group)
|
|
|
|
(scry-group rid)
|
|
|
|
?~ grp ~
|
|
|
|
(~(get ju tags.u.grp) tag)
|
|
|
|
::
|
2021-01-28 09:13:57 +03:00
|
|
|
++ is-managed
|
|
|
|
|= rid=resource
|
2020-05-27 07:32:43 +03:00
|
|
|
=/ group=(unit group)
|
2021-01-28 09:13:57 +03:00
|
|
|
(scry-group rid)
|
2020-05-27 07:32:43 +03:00
|
|
|
?~ group %.n
|
|
|
|
!hidden.u.group
|
|
|
|
::
|
2020-05-21 07:30:02 +03:00
|
|
|
--
|