shrub/pkg/arvo/sur/group.hoon

95 lines
2.3 KiB
Plaintext
Raw Normal View History

2020-05-21 07:30:02 +03:00
^?
2020-05-15 01:50:04 +03:00
|%
:: $group-id: unique identifier for a group
::
+$ group-id [=ship =term]
:: $groups: a mapping from group-ids to groups
::
+$ groups (map group-id group)
2020-05-27 09:19:29 +03:00
:: $group-tag: an identifier used by groups
::
:: These tags should have precise semantics, as they are shared across all
:: apps.
::
+$ group-tag ?(role-tag)
2020-05-15 01:50:04 +03:00
:: $tag: an identifier used to identify a subset of members
::
:: Tags may be used and recognised differently across apps.
:: for example, you could use tags like `%author`, `%bot`, `%flagged`...
2020-05-15 01:50:04 +03:00
::
2020-05-27 09:19:29 +03:00
+$ tag $@(group-tag [app=term tag=term])
:: $role-tag: a kind of $group-tag that identifies a privileged user
2020-05-15 01:50:04 +03:00
::
:: These roles are
:: %admin: Administrator, can do everything except delete the group
:: %moderator: Moderator, can add/remove/ban users
:: %janitor: Has no special meaning inside group-store,
:: but may be given additional privileges in other apps.
2020-05-27 07:32:43 +03:00
::
2020-05-21 07:30:02 +03:00
+$ role-tag
2020-05-27 07:32:43 +03:00
?(%admin %moderator %janitor)
2020-05-27 09:19:29 +03:00
:: $tags: a mapping from a $tag to the members it identifies
2020-05-15 01:50:04 +03:00
::
2020-05-27 09:19:29 +03:00
+$ tags (jug tag ship)
2020-05-15 01:50:04 +03:00
:: $group: description of a group of users
::
2020-05-27 07:32:43 +03:00
:: .members: members of the group
:: .tag-queries: a map of tags to subsets of members
2020-05-27 07:32:43 +03:00
:: .policy: permissions for the group
:: .hidden: is group unmanaged
2020-05-15 01:50:04 +03:00
+$ group
$: members=(set ship)
2020-05-27 09:19:29 +03:00
=tags
2020-05-15 01:50:04 +03:00
=policy
2020-05-27 07:32:43 +03:00
hidden=_&
2020-05-15 01:50:04 +03:00
==
:: $policy: access control for a group
::
++ policy
=< policy
|%
::
+$ policy
$% invite
open
==
:: $diff: change group policy
+$ diff
$% [%invite diff:invite]
[%open diff:open]
2020-05-15 01:50:04 +03:00
[%replace =policy]
==
:: $invite: allow only invited ships
++ invite
=< invite-policy
|%
::
+$ invite-policy
[%invite pending=(set ship)]
:: $diff: add or remove invites
::
+$ diff
$% [%add-invites invitees=(set ship)]
[%remove-invites invitees=(set ship)]
==
--
:: $open: allow all unbanned ships of approriate rank
::
++ open
=< open-policy
|%
::
+$ open-policy
[%open ban-ranks=(set rank:title) banned=(set ship)]
2020-05-15 01:50:04 +03:00
:: $diff: ban or allow ranks and ships
::
+$ diff
$% [%allow-ranks ranks=(set rank:title)]
[%ban-ranks ranks=(set rank:title)]
2020-05-15 01:50:04 +03:00
[%ban-ships ships=(set ship)]
[%allow-ships ships=(set ship)]
==
--
--
--