status-go/protocol/communities
Pascal Precht 248e4a7f24 refactor: EventSenders forward RequestToJoin decision to control node
This is a bigger change in how community membership requests are handled
among admins, token masters, owners, and control nodes.

Prior to this commit, all privileged users, also known as
`EventSenders`, were able to accept and reject community membership
requests and those changes would be applied by all users.

This commit changes this behaviour such that:

1. EventSenders can make a decision (accept, reject), but merely forward
   their decision to the control node, which ultimately has to confirm
   it
2. EventSenders are no longer removing or adding members to and from
   communities
3. When an eventsender signaled a decision, the membership request will
   enter a pending state (acceptedPending or rejectedPending)
4. Once a decision was made by one eventsender, no other eventsender can
   override that decision

This implementation is covered with a bunch of tests:

- Ensure that decision made by event sender is shared with other event
  senders
  - `testAcceptMemberRequestToJoinResponseSharedWithOtherEventSenders()`
  - `testRejectMemberRequestToJoinResponseSharedWithOtherEventSenders()`
- Ensure memebrship request stays pending, until control node has
  confirmed decision by event senders
  - `testAcceptMemberRequestToJoinNotConfirmedByControlNode()`
  - `testRejectMemberRequestToJoinNotConfirmedByControlNode()`
- Ensure that decision made by event sender cannot be overriden by other
  event senders
  - `testEventSenderCannotOverrideRequestToJoinState()`

These test cases live in three test suites for different event sender
types respectively

- `OwnerWithoutCommunityKeyCommunityEventsSuite`
- `TokenMasterCommunityEventsSuite`
- `AdminCommunityEventsSuite`

In addition to the changes mentioned above, there's also a smaller
changes that ensures membership requests to *not* attached revealed wallet
addresses when the requests are sent to event senders (in addition to
control nodes).

Requests send to a control node will still include revealed addresses as
the control node needs them to verify token permissions.

This commit does not yet handle the case of event senders attempting to
kick and ban members.

Similar to accepting and rejecting membership requests, kicking and
banning need a new pending state. However, we don't track such state in
local databases yet so those two cases will be handled in future commit
to not have this commit grow larger.
2023-08-08 14:46:03 +02:00
..
migrations Handle organisation membership requests 2020-12-23 17:20:55 +01:00
adaptors.go refactor: improve wrapped community description naming 2023-08-02 20:57:19 +02:00
community.go refactor: EventSenders forward RequestToJoin decision to control node 2023-08-08 14:46:03 +02:00
community_categories.go chore: make the owner without the community private key behave like a… (#3788) 2023-07-26 14:16:50 +02:00
community_categories_test.go feat: community admin permission functionality (#3569) 2023-06-14 10:15:46 -04:00
community_changes.go feat: add CommunityEncryptionKeyActions and its evaluation logic 2023-07-20 17:17:46 +02:00
community_encryption_key_action.go feat: introduce channel-level encryption 2023-07-27 11:35:59 +02:00
community_encryption_key_action_test.go feat: introduce channel-level encryption 2023-07-27 11:35:59 +02:00
community_event.go refactor: EventSenders forward RequestToJoin decision to control node 2023-08-08 14:46:03 +02:00
community_event_message.go refactor: EventSenders forward RequestToJoin decision to control node 2023-08-08 14:46:03 +02:00
community_test.go chore: remove community invitations 2023-08-05 11:49:00 +02:00
errors.go chore: Added TokenMaster permission token type (#3848) 2023-08-04 12:28:46 +02:00
manager.go refactor: EventSenders forward RequestToJoin decision to control node 2023-08-08 14:46:03 +02:00
manager_test.go chore: Added TokenMaster permission token type (#3848) 2023-08-04 12:28:46 +02:00
persistence.go refactor: EventSenders forward RequestToJoin decision to control node 2023-08-08 14:46:03 +02:00
persistence_test.go refactor: improve wrapped community description naming 2023-08-02 20:57:19 +02:00
persistence_test_helpers.go refactor to remove rekeyedAt and use group current key 2023-07-24 17:18:42 +01:00
request_to_join.go refactor: EventSenders forward RequestToJoin decision to control node 2023-08-08 14:46:03 +02:00
request_to_join_test.go Sync Communities (#2253) 2021-08-06 16:40:23 +01:00
request_to_leave.go feat: introduce and distribute RequestToLeave community 2022-08-26 11:25:33 +02:00
utils.go Add chainIds to revealed accounts in memberhsip requests 2023-06-12 10:49:29 +02:00
validator.go feat: community tags (#2708) 2022-06-24 09:40:12 -04:00