2020-12-02 22:31:11 +03:00
|
|
|
/- *group, *metadata-store
|
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
|
2020-05-21 07:30:02 +03:00
|
|
|
++ scry-for
|
|
|
|
|* [=mold =path]
|
|
|
|
.^ mold
|
|
|
|
%gx
|
|
|
|
(scot %p our.bowl)
|
|
|
|
%group-store
|
|
|
|
(scot %da now.bowl)
|
|
|
|
(snoc `^path`path %noun)
|
|
|
|
==
|
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-path
|
|
|
|
|= =path
|
|
|
|
%+ scry-for
|
|
|
|
(unit group)
|
|
|
|
[%groups path]
|
|
|
|
::
|
|
|
|
++ scry-group
|
2020-06-08 10:53:16 +03:00
|
|
|
|= rid=resource
|
2020-05-21 07:30:02 +03:00
|
|
|
%- scry-group-path
|
2020-06-08 10:53:16 +03:00
|
|
|
(en-path:resource rid)
|
2020-05-25 08:52:54 +03:00
|
|
|
::
|
|
|
|
++ members
|
2020-06-08 10:53:16 +03:00
|
|
|
|= rid=resource
|
2020-05-25 08:52:54 +03:00
|
|
|
%- members-from-path
|
2020-06-08 10:53:16 +03:00
|
|
|
(en-path:resource rid)
|
2020-05-21 07:30:02 +03:00
|
|
|
::
|
|
|
|
++ members-from-path
|
|
|
|
|= =group-path
|
|
|
|
^- (set ship)
|
|
|
|
=- members:(fall - *group)
|
|
|
|
(scry-group-path group-path)
|
|
|
|
::
|
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-from-path
|
2020-05-21 07:30:02 +03:00
|
|
|
|= [=path =ship]
|
|
|
|
%+ scry-for
|
|
|
|
?
|
|
|
|
%+ welp
|
|
|
|
[%groups path]
|
|
|
|
/join/[(scot %p ship)]
|
2020-05-25 08:52:54 +03:00
|
|
|
::
|
|
|
|
++ can-join
|
2020-06-08 10:53:16 +03:00
|
|
|
|= [rid=resource =ship]
|
2020-05-25 08:52:54 +03:00
|
|
|
%+ can-join-from-path
|
2020-06-08 10:53:16 +03:00
|
|
|
(en-path:resource rid)
|
2020-05-25 08:52:54 +03:00
|
|
|
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)
|
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
++ is-managed-path
|
|
|
|
|= =path
|
2020-05-27 07:32:43 +03:00
|
|
|
^- ?
|
|
|
|
=/ group=(unit group)
|
|
|
|
(scry-group-path path)
|
|
|
|
?~ group %.n
|
|
|
|
!hidden.u.group
|
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
++ is-managed
|
2020-06-08 10:53:16 +03:00
|
|
|
|= rid=resource
|
2020-05-25 08:52:54 +03:00
|
|
|
%- is-managed-path
|
2020-06-08 10:53:16 +03:00
|
|
|
(en-path:resource rid)
|
2020-05-27 07:32:43 +03:00
|
|
|
::
|
2020-05-21 07:30:02 +03:00
|
|
|
--
|