feat: add permissions reevaluation request

Token master can't manage members directly, so it must request
reevaluation from the control node.

fixes: status-im/status-desktop#13778
This commit is contained in:
Patryk Osmaczko 2024-03-06 09:33:52 +01:00 committed by osmaczko
parent 1de61d1933
commit b02e3b19e2
8 changed files with 357 additions and 126 deletions

View File

@ -101,6 +101,31 @@ func TestCalculateRolesAndHighestRole(t *testing.T) {
},
expectedRolesOrder: []protobuf.CommunityTokenPermission_Type{protobuf.CommunityTokenPermission_BECOME_TOKEN_OWNER, protobuf.CommunityTokenPermission_BECOME_TOKEN_MASTER, protobuf.CommunityTokenPermission_BECOME_ADMIN, protobuf.CommunityTokenPermission_BECOME_MEMBER},
},
{
name: "scenario with multiple channel permissions",
permissions: map[string]*PermissionTokenCriteriaResult{
"1": {
Role: protobuf.CommunityTokenPermission_CAN_VIEW_CHANNEL,
TokenRequirements: []TokenRequirementResponse{
{Satisfied: true},
},
},
"2": {
Role: protobuf.CommunityTokenPermission_CAN_VIEW_CHANNEL,
TokenRequirements: []TokenRequirementResponse{
{Satisfied: false},
},
},
"3": {
Role: protobuf.CommunityTokenPermission_CAN_VIEW_AND_POST_CHANNEL,
TokenRequirements: []TokenRequirementResponse{
{Satisfied: true},
},
},
},
expectedRolesOrder: []protobuf.CommunityTokenPermission_Type{protobuf.CommunityTokenPermission_CAN_VIEW_AND_POST_CHANNEL, protobuf.CommunityTokenPermission_CAN_VIEW_CHANNEL, protobuf.CommunityTokenPermission_BECOME_MEMBER},
expectedHighestRole: protobuf.CommunityTokenPermission_CAN_VIEW_AND_POST_CHANNEL,
},
}
for _, tc := range testCases {

View File

@ -73,36 +73,36 @@ var (
)
type Manager struct {
persistence *Persistence
encryptor *encryption.Protocol
ensSubscription chan []*ens.VerificationRecord
subscriptions []chan *Subscription
ensVerifier *ens.Verifier
ownerVerifier OwnerVerifier
identity *ecdsa.PrivateKey
installationID string
accountsManager account.Manager
tokenManager TokenManager
collectiblesManager CollectiblesManager
logger *zap.Logger
stdoutLogger *zap.Logger
transport *transport.Transport
timesource common.TimeSource
quit chan struct{}
torrentConfig *params.TorrentConfig
torrentClient *torrent.Client
walletConfig *params.WalletConfig
communityTokensService communitytokens.ServiceInterface
historyArchiveTasksWaitGroup sync.WaitGroup
historyArchiveTasks sync.Map // stores `chan struct{}`
periodicMembersReevaluationTasks sync.Map // stores `chan struct{}`
torrentTasks map[string]metainfo.Hash
historyArchiveDownloadTasks map[string]*HistoryArchiveDownloadTask
stopped bool
RekeyInterval time.Duration
PermissionChecker PermissionChecker
keyDistributor KeyDistributor
communityLock *CommunityLock
persistence *Persistence
encryptor *encryption.Protocol
ensSubscription chan []*ens.VerificationRecord
subscriptions []chan *Subscription
ensVerifier *ens.Verifier
ownerVerifier OwnerVerifier
identity *ecdsa.PrivateKey
installationID string
accountsManager account.Manager
tokenManager TokenManager
collectiblesManager CollectiblesManager
logger *zap.Logger
stdoutLogger *zap.Logger
transport *transport.Transport
timesource common.TimeSource
quit chan struct{}
torrentConfig *params.TorrentConfig
torrentClient *torrent.Client
walletConfig *params.WalletConfig
communityTokensService communitytokens.ServiceInterface
historyArchiveTasksWaitGroup sync.WaitGroup
historyArchiveTasks sync.Map // stores `chan struct{}`
membersReevaluationTasks sync.Map // stores `membersReevaluationTask`
torrentTasks map[string]metainfo.Hash
historyArchiveDownloadTasks map[string]*HistoryArchiveDownloadTask
stopped bool
RekeyInterval time.Duration
PermissionChecker PermissionChecker
keyDistributor KeyDistributor
communityLock *CommunityLock
}
type CommunityLock struct {
@ -172,6 +172,12 @@ func (t *HistoryArchiveDownloadTask) Cancel() {
close(t.CancelChan)
}
type membersReevaluationTask struct {
lastSuccessTime time.Time
onDemandRequestTime time.Time
mutex sync.Mutex
}
type managerOptions struct {
accountsManager account.Manager
tokenManager TokenManager
@ -1069,37 +1075,101 @@ func (m *Manager) ReevaluateMembers(community *Community) (map[protobuf.Communit
}
func (m *Manager) ReevaluateMembersPeriodically(communityID types.HexBytes) {
if _, exists := m.periodicMembersReevaluationTasks.Load(communityID.String()); exists {
logger := m.logger.Named("reevaluate members loop").With(zap.String("communityID", communityID.String()))
if _, exists := m.membersReevaluationTasks.Load(communityID.String()); exists {
return
}
cancel := make(chan struct{})
m.periodicMembersReevaluationTasks.Store(communityID.String(), cancel)
m.membersReevaluationTasks.Store(communityID.String(), &membersReevaluationTask{})
defer m.membersReevaluationTasks.Delete(communityID.String())
ticker := time.NewTicker(memberPermissionsCheckInterval)
type criticalError struct {
error
}
reevaluateMembers := func() (err error) {
t, exists := m.membersReevaluationTasks.Load(communityID.String())
if !exists {
return criticalError{
error: errors.New("missing task"),
}
}
task, ok := t.(*membersReevaluationTask)
if !ok {
return criticalError{
error: errors.New("invalid task type"),
}
}
task.mutex.Lock()
defer task.mutex.Unlock()
// Ensure reevaluation is performed not more often than once per minute.
if task.lastSuccessTime.After(time.Now().Add(-1 * time.Minute)) {
return nil
}
if task.lastSuccessTime.Before(time.Now().Add(-memberPermissionsCheckInterval)) ||
task.lastSuccessTime.Before(task.onDemandRequestTime) {
community, err := m.GetByID(communityID)
if err != nil {
if err == ErrOrgNotFound {
return criticalError{
error: err,
}
}
return err
}
err = m.ReevaluateCommunityMembersPermissions(community)
if err != nil {
return err
}
task.lastSuccessTime = time.Now()
}
return nil
}
ticker := time.NewTicker(10 * time.Second)
defer ticker.Stop()
logger.Debug("loop started")
defer logger.Debug("loop stopped")
for {
select {
case <-ticker.C:
community, err := m.GetByID(communityID)
err := reevaluateMembers()
if err != nil {
m.logger.Debug("can't validate member permissions, community was not found", zap.Error(err))
m.periodicMembersReevaluationTasks.Delete(communityID.String())
logger.Error("reevaluation failed", zap.Error(err))
if _, isCritical := err.(*criticalError); isCritical {
return
}
}
if err = m.ReevaluateCommunityMembersPermissions(community); err != nil {
m.logger.Debug("failed to check member permissions", zap.Error(err))
continue
}
case <-cancel:
m.periodicMembersReevaluationTasks.Delete(communityID.String())
case <-m.quit:
return
}
}
}
func (m *Manager) ScheduleMembersReevaluation(communityID types.HexBytes) error {
t, exists := m.membersReevaluationTasks.Load(communityID.String())
if !exists {
return errors.New("reevaluation task doesn't exist")
}
task, ok := t.(*membersReevaluationTask)
if !ok {
return errors.New("invalid task type")
}
task.mutex.Lock()
defer task.mutex.Unlock()
task.onDemandRequestTime = time.Now()
return nil
}
func (m *Manager) DeleteCommunityTokenPermission(request *requests.DeleteCommunityTokenPermission) (*Community, *CommunityChanges, error) {
community, err := m.GetByID(request.CommunityID)
if err != nil {

View File

@ -2384,6 +2384,23 @@ func (m *Messenger) DeleteCommunityTokenPermission(request *requests.DeleteCommu
return response, nil
}
func (m *Messenger) HandleCommunityReevaluatePermissionsRequest(state *ReceivedMessageState, request *protobuf.CommunityReevaluatePermissionsRequest, statusMessage *v1protocol.StatusMessage) error {
community, err := m.communitiesManager.GetByID(request.CommunityId)
if err != nil {
return err
}
if !community.IsControlNode() {
return communities.ErrNotControlNode
}
if !community.IsMemberTokenMaster(statusMessage.SigPubKey()) {
return communities.ErrNotAuthorized
}
return m.communitiesManager.ScheduleMembersReevaluation(request.CommunityId)
}
func (m *Messenger) ReevaluateCommunityMembersPermissions(request *requests.ReevaluateCommunityMembersPermissions) (*MessengerResponse, error) {
if err := request.Validate(); err != nil {
return nil, err
@ -2394,14 +2411,37 @@ func (m *Messenger) ReevaluateCommunityMembersPermissions(request *requests.Reev
return nil, err
}
if err = m.communitiesManager.ReevaluateCommunityMembersPermissions(community); err != nil {
return nil, err
if community.IsControlNode() {
err = m.communitiesManager.ScheduleMembersReevaluation(request.CommunityID)
if err != nil {
return nil, err
}
} else if community.IsTokenMaster() {
reevaluateRequest := &protobuf.CommunityReevaluatePermissionsRequest{
CommunityId: request.CommunityID,
}
encodedMessage, err := proto.Marshal(reevaluateRequest)
if err != nil {
return nil, err
}
rawMessage := common.RawMessage{
Payload: encodedMessage,
CommunityID: request.CommunityID,
SkipEncryptionLayer: true,
MessageType: protobuf.ApplicationMetadataMessage_COMMUNITY_REEVALUATE_PERMISSIONS_REQUEST,
PubsubTopic: community.PubsubTopic(),
}
_, err = m.SendMessageToControlNode(community, rawMessage)
if err != nil {
return nil, err
}
} else {
return nil, communities.ErrNotAuthorized
}
response := &MessengerResponse{}
response.AddCommunity(community)
return response, nil
return &MessengerResponse{}, nil
}
func (m *Messenger) EditCommunity(request *requests.EditCommunity) (*MessengerResponse, error) {

View File

@ -250,6 +250,9 @@ func (m *Messenger) dispatchToHandler(messageState *ReceivedMessageState, protoB
case protobuf.ApplicationMetadataMessage_COMMUNITY_PUBLIC_STORENODES_INFO:
return m.handleCommunityPublicStorenodesInfoProtobuf(messageState, protoBytes, msg, filter)
case protobuf.ApplicationMetadataMessage_COMMUNITY_REEVALUATE_PERMISSIONS_REQUEST:
return m.handleCommunityReevaluatePermissionsRequestProtobuf(messageState, protoBytes, msg, filter)
default:
m.logger.Info("protobuf type not found", zap.String("type", string(msg.ApplicationLayer.Type)))
return errors.New("protobuf type not found")
@ -1796,3 +1799,21 @@ func (m *Messenger) handleCommunityPublicStorenodesInfoProtobuf(messageState *Re
}
func (m *Messenger) handleCommunityReevaluatePermissionsRequestProtobuf(messageState *ReceivedMessageState, protoBytes []byte, msg *v1protocol.StatusMessage, filter transport.Filter) error {
m.logger.Info("handling CommunityReevaluatePermissionsRequest")
p := &protobuf.CommunityReevaluatePermissionsRequest{}
err := proto.Unmarshal(protoBytes, p)
if err != nil {
return err
}
m.outputToCSV(msg.TransportLayer.Message.Timestamp, msg.ApplicationLayer.ID, messageState.CurrentMessageState.Contact.ID, filter.ContentTopic, filter.ChatID, msg.ApplicationLayer.Type, p)
return m.HandleCommunityReevaluatePermissionsRequest(messageState, p, msg)
}

View File

@ -105,6 +105,7 @@ const (
ApplicationMetadataMessage_COMMUNITY_USER_KICKED ApplicationMetadataMessage_Type = 81
ApplicationMetadataMessage_SYNC_PROFILE_SHOWCASE_PREFERENCES ApplicationMetadataMessage_Type = 82
ApplicationMetadataMessage_COMMUNITY_PUBLIC_STORENODES_INFO ApplicationMetadataMessage_Type = 83
ApplicationMetadataMessage_COMMUNITY_REEVALUATE_PERMISSIONS_REQUEST ApplicationMetadataMessage_Type = 84
)
// Enum value maps for ApplicationMetadataMessage_Type.
@ -190,6 +191,7 @@ var (
81: "COMMUNITY_USER_KICKED",
82: "SYNC_PROFILE_SHOWCASE_PREFERENCES",
83: "COMMUNITY_PUBLIC_STORENODES_INFO",
84: "COMMUNITY_REEVALUATE_PERMISSIONS_REQUEST",
}
ApplicationMetadataMessage_Type_value = map[string]int32{
"UNKNOWN": 0,
@ -272,6 +274,7 @@ var (
"COMMUNITY_USER_KICKED": 81,
"SYNC_PROFILE_SHOWCASE_PREFERENCES": 82,
"COMMUNITY_PUBLIC_STORENODES_INFO": 83,
"COMMUNITY_REEVALUATE_PERMISSIONS_REQUEST": 84,
}
)
@ -373,8 +376,8 @@ var File_application_metadata_message_proto protoreflect.FileDescriptor
var file_application_metadata_message_proto_rawDesc = []byte{
0x0a, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0xed,
0x14, 0x0a, 0x1a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x9b,
0x15, 0x0a, 0x1a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a,
0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70,
@ -383,7 +386,7 @@ var file_application_metadata_message_proto_rawDesc = []byte{
0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41,
0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04,
0x74, 0x79, 0x70, 0x65, 0x22, 0xd7, 0x13, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a,
0x74, 0x79, 0x70, 0x65, 0x22, 0x85, 0x14, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a,
0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x48,
0x41, 0x54, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e,
0x43, 0x4f, 0x4e, 0x54, 0x41, 0x43, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x02,
@ -533,16 +536,19 @@ var file_application_metadata_message_proto_rawDesc = []byte{
0x46, 0x45, 0x52, 0x45, 0x4e, 0x43, 0x45, 0x53, 0x10, 0x52, 0x12, 0x24, 0x0a, 0x20, 0x43, 0x4f,
0x4d, 0x4d, 0x55, 0x4e, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x53,
0x54, 0x4f, 0x52, 0x45, 0x4e, 0x4f, 0x44, 0x45, 0x53, 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x53,
0x22, 0x04, 0x08, 0x0e, 0x10, 0x0e, 0x22, 0x04, 0x08, 0x41, 0x10, 0x41, 0x22, 0x04, 0x08, 0x42,
0x10, 0x42, 0x2a, 0x1d, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c,
0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x43, 0x48, 0x41,
0x54, 0x2a, 0x22, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x49, 0x54, 0x59,
0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41,
0x54, 0x49, 0x4f, 0x4e, 0x53, 0x2a, 0x27, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x41, 0x43, 0x54, 0x49,
0x56, 0x49, 0x54, 0x59, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x49,
0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x42, 0x0d,
0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x12, 0x2c, 0x0a, 0x28, 0x43, 0x4f, 0x4d, 0x4d, 0x55, 0x4e, 0x49, 0x54, 0x59, 0x5f, 0x52, 0x45,
0x45, 0x56, 0x41, 0x4c, 0x55, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x45, 0x52, 0x4d, 0x49, 0x53, 0x53,
0x49, 0x4f, 0x4e, 0x53, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x54, 0x22, 0x04,
0x08, 0x0e, 0x10, 0x0e, 0x22, 0x04, 0x08, 0x41, 0x10, 0x41, 0x22, 0x04, 0x08, 0x42, 0x10, 0x42,
0x2a, 0x1d, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x41, 0x54,
0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x43, 0x48, 0x41, 0x54, 0x2a,
0x22, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x49, 0x54, 0x59, 0x5f, 0x43,
0x45, 0x4e, 0x54, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49,
0x4f, 0x4e, 0x53, 0x2a, 0x27, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, 0x49,
0x54, 0x59, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x5f, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49,
0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x42, 0x0d, 0x5a, 0x0b,
0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (

View File

@ -101,5 +101,6 @@ message ApplicationMetadataMessage {
COMMUNITY_USER_KICKED = 81;
SYNC_PROFILE_SHOWCASE_PREFERENCES = 82;
COMMUNITY_PUBLIC_STORENODES_INFO = 83;
COMMUNITY_REEVALUATE_PERMISSIONS_REQUEST = 84;
}
}

View File

@ -2323,6 +2323,53 @@ func (x *Storenode) GetDeletedAt() int64 {
return 0
}
type CommunityReevaluatePermissionsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CommunityId []byte `protobuf:"bytes,1,opt,name=community_id,json=communityId,proto3" json:"community_id,omitempty"`
}
func (x *CommunityReevaluatePermissionsRequest) Reset() {
*x = CommunityReevaluatePermissionsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_communities_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CommunityReevaluatePermissionsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CommunityReevaluatePermissionsRequest) ProtoMessage() {}
func (x *CommunityReevaluatePermissionsRequest) ProtoReflect() protoreflect.Message {
mi := &file_communities_proto_msgTypes[27]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CommunityReevaluatePermissionsRequest.ProtoReflect.Descriptor instead.
func (*CommunityReevaluatePermissionsRequest) Descriptor() ([]byte, []int) {
return file_communities_proto_rawDescGZIP(), []int{27}
}
func (x *CommunityReevaluatePermissionsRequest) GetCommunityId() []byte {
if x != nil {
return x.CommunityId
}
return nil
}
var File_communities_proto protoreflect.FileDescriptor
var file_communities_proto_rawDesc = []byte{
@ -2771,8 +2818,13 @@ var file_communities_proto_rawDesc = []byte{
0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72,
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65,
0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x64, 0x65, 0x6c, 0x65,
0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x4a, 0x0a, 0x25, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69,
0x74, 0x79, 0x52, 0x65, 0x65, 0x76, 0x61, 0x6c, 0x75, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x6d,
0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21,
0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x49,
0x64, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -2788,85 +2840,86 @@ func file_communities_proto_rawDescGZIP() []byte {
}
var file_communities_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
var file_communities_proto_msgTypes = make([]protoimpl.MessageInfo, 37)
var file_communities_proto_msgTypes = make([]protoimpl.MessageInfo, 38)
var file_communities_proto_goTypes = []interface{}{
(CommunityMember_Roles)(0), // 0: protobuf.CommunityMember.Roles
(CommunityMember_ChannelRole)(0), // 1: protobuf.CommunityMember.ChannelRole
(CommunityPermissions_Access)(0), // 2: protobuf.CommunityPermissions.Access
(CommunityTokenPermission_Type)(0), // 3: protobuf.CommunityTokenPermission.Type
(*Grant)(nil), // 4: protobuf.Grant
(*CommunityMember)(nil), // 5: protobuf.CommunityMember
(*CommunityTokenMetadata)(nil), // 6: protobuf.CommunityTokenMetadata
(*CommunityPermissions)(nil), // 7: protobuf.CommunityPermissions
(*TokenCriteria)(nil), // 8: protobuf.TokenCriteria
(*CommunityTokenPermission)(nil), // 9: protobuf.CommunityTokenPermission
(*CommunityDescription)(nil), // 10: protobuf.CommunityDescription
(*CommunityBanInfo)(nil), // 11: protobuf.CommunityBanInfo
(*CommunityAdminSettings)(nil), // 12: protobuf.CommunityAdminSettings
(*CommunityChat)(nil), // 13: protobuf.CommunityChat
(*CommunityCategory)(nil), // 14: protobuf.CommunityCategory
(*RevealedAccount)(nil), // 15: protobuf.RevealedAccount
(*CommunityRequestToJoin)(nil), // 16: protobuf.CommunityRequestToJoin
(*CommunityEditSharedAddresses)(nil), // 17: protobuf.CommunityEditSharedAddresses
(*CommunityCancelRequestToJoin)(nil), // 18: protobuf.CommunityCancelRequestToJoin
(*CommunityUserKicked)(nil), // 19: protobuf.CommunityUserKicked
(*CommunityRequestToJoinResponse)(nil), // 20: protobuf.CommunityRequestToJoinResponse
(*CommunityRequestToLeave)(nil), // 21: protobuf.CommunityRequestToLeave
(*CommunityMessageArchiveMagnetlink)(nil), // 22: protobuf.CommunityMessageArchiveMagnetlink
(*WakuMessage)(nil), // 23: protobuf.WakuMessage
(*WakuMessageArchiveMetadata)(nil), // 24: protobuf.WakuMessageArchiveMetadata
(*WakuMessageArchive)(nil), // 25: protobuf.WakuMessageArchive
(*WakuMessageArchiveIndexMetadata)(nil), // 26: protobuf.WakuMessageArchiveIndexMetadata
(*WakuMessageArchiveIndex)(nil), // 27: protobuf.WakuMessageArchiveIndex
(*CommunityPublicStorenodesInfo)(nil), // 28: protobuf.CommunityPublicStorenodesInfo
(*CommunityStorenodes)(nil), // 29: protobuf.CommunityStorenodes
(*Storenode)(nil), // 30: protobuf.Storenode
nil, // 31: protobuf.CommunityTokenMetadata.ContractAddressesEntry
nil, // 32: protobuf.TokenCriteria.ContractAddressesEntry
nil, // 33: protobuf.CommunityDescription.MembersEntry
nil, // 34: protobuf.CommunityDescription.ChatsEntry
nil, // 35: protobuf.CommunityDescription.CategoriesEntry
nil, // 36: protobuf.CommunityDescription.TokenPermissionsEntry
nil, // 37: protobuf.CommunityDescription.BannedMembersEntry
nil, // 38: protobuf.CommunityDescription.PrivateDataEntry
nil, // 39: protobuf.CommunityChat.MembersEntry
nil, // 40: protobuf.WakuMessageArchiveIndex.ArchivesEntry
(CommunityTokenType)(0), // 41: protobuf.CommunityTokenType
(*ChatIdentity)(nil), // 42: protobuf.ChatIdentity
(*Shard)(nil), // 43: protobuf.Shard
(CommunityMember_Roles)(0), // 0: protobuf.CommunityMember.Roles
(CommunityMember_ChannelRole)(0), // 1: protobuf.CommunityMember.ChannelRole
(CommunityPermissions_Access)(0), // 2: protobuf.CommunityPermissions.Access
(CommunityTokenPermission_Type)(0), // 3: protobuf.CommunityTokenPermission.Type
(*Grant)(nil), // 4: protobuf.Grant
(*CommunityMember)(nil), // 5: protobuf.CommunityMember
(*CommunityTokenMetadata)(nil), // 6: protobuf.CommunityTokenMetadata
(*CommunityPermissions)(nil), // 7: protobuf.CommunityPermissions
(*TokenCriteria)(nil), // 8: protobuf.TokenCriteria
(*CommunityTokenPermission)(nil), // 9: protobuf.CommunityTokenPermission
(*CommunityDescription)(nil), // 10: protobuf.CommunityDescription
(*CommunityBanInfo)(nil), // 11: protobuf.CommunityBanInfo
(*CommunityAdminSettings)(nil), // 12: protobuf.CommunityAdminSettings
(*CommunityChat)(nil), // 13: protobuf.CommunityChat
(*CommunityCategory)(nil), // 14: protobuf.CommunityCategory
(*RevealedAccount)(nil), // 15: protobuf.RevealedAccount
(*CommunityRequestToJoin)(nil), // 16: protobuf.CommunityRequestToJoin
(*CommunityEditSharedAddresses)(nil), // 17: protobuf.CommunityEditSharedAddresses
(*CommunityCancelRequestToJoin)(nil), // 18: protobuf.CommunityCancelRequestToJoin
(*CommunityUserKicked)(nil), // 19: protobuf.CommunityUserKicked
(*CommunityRequestToJoinResponse)(nil), // 20: protobuf.CommunityRequestToJoinResponse
(*CommunityRequestToLeave)(nil), // 21: protobuf.CommunityRequestToLeave
(*CommunityMessageArchiveMagnetlink)(nil), // 22: protobuf.CommunityMessageArchiveMagnetlink
(*WakuMessage)(nil), // 23: protobuf.WakuMessage
(*WakuMessageArchiveMetadata)(nil), // 24: protobuf.WakuMessageArchiveMetadata
(*WakuMessageArchive)(nil), // 25: protobuf.WakuMessageArchive
(*WakuMessageArchiveIndexMetadata)(nil), // 26: protobuf.WakuMessageArchiveIndexMetadata
(*WakuMessageArchiveIndex)(nil), // 27: protobuf.WakuMessageArchiveIndex
(*CommunityPublicStorenodesInfo)(nil), // 28: protobuf.CommunityPublicStorenodesInfo
(*CommunityStorenodes)(nil), // 29: protobuf.CommunityStorenodes
(*Storenode)(nil), // 30: protobuf.Storenode
(*CommunityReevaluatePermissionsRequest)(nil), // 31: protobuf.CommunityReevaluatePermissionsRequest
nil, // 32: protobuf.CommunityTokenMetadata.ContractAddressesEntry
nil, // 33: protobuf.TokenCriteria.ContractAddressesEntry
nil, // 34: protobuf.CommunityDescription.MembersEntry
nil, // 35: protobuf.CommunityDescription.ChatsEntry
nil, // 36: protobuf.CommunityDescription.CategoriesEntry
nil, // 37: protobuf.CommunityDescription.TokenPermissionsEntry
nil, // 38: protobuf.CommunityDescription.BannedMembersEntry
nil, // 39: protobuf.CommunityDescription.PrivateDataEntry
nil, // 40: protobuf.CommunityChat.MembersEntry
nil, // 41: protobuf.WakuMessageArchiveIndex.ArchivesEntry
(CommunityTokenType)(0), // 42: protobuf.CommunityTokenType
(*ChatIdentity)(nil), // 43: protobuf.ChatIdentity
(*Shard)(nil), // 44: protobuf.Shard
}
var file_communities_proto_depIdxs = []int32{
0, // 0: protobuf.CommunityMember.roles:type_name -> protobuf.CommunityMember.Roles
15, // 1: protobuf.CommunityMember.revealed_accounts:type_name -> protobuf.RevealedAccount
1, // 2: protobuf.CommunityMember.channel_role:type_name -> protobuf.CommunityMember.ChannelRole
31, // 3: protobuf.CommunityTokenMetadata.contract_addresses:type_name -> protobuf.CommunityTokenMetadata.ContractAddressesEntry
41, // 4: protobuf.CommunityTokenMetadata.tokenType:type_name -> protobuf.CommunityTokenType
32, // 3: protobuf.CommunityTokenMetadata.contract_addresses:type_name -> protobuf.CommunityTokenMetadata.ContractAddressesEntry
42, // 4: protobuf.CommunityTokenMetadata.tokenType:type_name -> protobuf.CommunityTokenType
2, // 5: protobuf.CommunityPermissions.access:type_name -> protobuf.CommunityPermissions.Access
32, // 6: protobuf.TokenCriteria.contract_addresses:type_name -> protobuf.TokenCriteria.ContractAddressesEntry
41, // 7: protobuf.TokenCriteria.type:type_name -> protobuf.CommunityTokenType
33, // 6: protobuf.TokenCriteria.contract_addresses:type_name -> protobuf.TokenCriteria.ContractAddressesEntry
42, // 7: protobuf.TokenCriteria.type:type_name -> protobuf.CommunityTokenType
3, // 8: protobuf.CommunityTokenPermission.type:type_name -> protobuf.CommunityTokenPermission.Type
8, // 9: protobuf.CommunityTokenPermission.token_criteria:type_name -> protobuf.TokenCriteria
33, // 10: protobuf.CommunityDescription.members:type_name -> protobuf.CommunityDescription.MembersEntry
34, // 10: protobuf.CommunityDescription.members:type_name -> protobuf.CommunityDescription.MembersEntry
7, // 11: protobuf.CommunityDescription.permissions:type_name -> protobuf.CommunityPermissions
42, // 12: protobuf.CommunityDescription.identity:type_name -> protobuf.ChatIdentity
34, // 13: protobuf.CommunityDescription.chats:type_name -> protobuf.CommunityDescription.ChatsEntry
35, // 14: protobuf.CommunityDescription.categories:type_name -> protobuf.CommunityDescription.CategoriesEntry
43, // 12: protobuf.CommunityDescription.identity:type_name -> protobuf.ChatIdentity
35, // 13: protobuf.CommunityDescription.chats:type_name -> protobuf.CommunityDescription.ChatsEntry
36, // 14: protobuf.CommunityDescription.categories:type_name -> protobuf.CommunityDescription.CategoriesEntry
12, // 15: protobuf.CommunityDescription.admin_settings:type_name -> protobuf.CommunityAdminSettings
36, // 16: protobuf.CommunityDescription.token_permissions:type_name -> protobuf.CommunityDescription.TokenPermissionsEntry
37, // 16: protobuf.CommunityDescription.token_permissions:type_name -> protobuf.CommunityDescription.TokenPermissionsEntry
6, // 17: protobuf.CommunityDescription.community_tokens_metadata:type_name -> protobuf.CommunityTokenMetadata
37, // 18: protobuf.CommunityDescription.banned_members:type_name -> protobuf.CommunityDescription.BannedMembersEntry
38, // 19: protobuf.CommunityDescription.privateData:type_name -> protobuf.CommunityDescription.PrivateDataEntry
39, // 20: protobuf.CommunityChat.members:type_name -> protobuf.CommunityChat.MembersEntry
38, // 18: protobuf.CommunityDescription.banned_members:type_name -> protobuf.CommunityDescription.BannedMembersEntry
39, // 19: protobuf.CommunityDescription.privateData:type_name -> protobuf.CommunityDescription.PrivateDataEntry
40, // 20: protobuf.CommunityChat.members:type_name -> protobuf.CommunityChat.MembersEntry
7, // 21: protobuf.CommunityChat.permissions:type_name -> protobuf.CommunityPermissions
42, // 22: protobuf.CommunityChat.identity:type_name -> protobuf.ChatIdentity
43, // 22: protobuf.CommunityChat.identity:type_name -> protobuf.ChatIdentity
15, // 23: protobuf.CommunityRequestToJoin.revealed_accounts:type_name -> protobuf.RevealedAccount
15, // 24: protobuf.CommunityEditSharedAddresses.revealed_accounts:type_name -> protobuf.RevealedAccount
10, // 25: protobuf.CommunityRequestToJoinResponse.community:type_name -> protobuf.CommunityDescription
43, // 26: protobuf.CommunityRequestToJoinResponse.shard:type_name -> protobuf.Shard
44, // 26: protobuf.CommunityRequestToJoinResponse.shard:type_name -> protobuf.Shard
24, // 27: protobuf.WakuMessageArchive.metadata:type_name -> protobuf.WakuMessageArchiveMetadata
23, // 28: protobuf.WakuMessageArchive.messages:type_name -> protobuf.WakuMessage
24, // 29: protobuf.WakuMessageArchiveIndexMetadata.metadata:type_name -> protobuf.WakuMessageArchiveMetadata
40, // 30: protobuf.WakuMessageArchiveIndex.archives:type_name -> protobuf.WakuMessageArchiveIndex.ArchivesEntry
41, // 30: protobuf.WakuMessageArchiveIndex.archives:type_name -> protobuf.WakuMessageArchiveIndex.ArchivesEntry
30, // 31: protobuf.CommunityStorenodes.storenodes:type_name -> protobuf.Storenode
5, // 32: protobuf.CommunityDescription.MembersEntry.value:type_name -> protobuf.CommunityMember
13, // 33: protobuf.CommunityDescription.ChatsEntry.value:type_name -> protobuf.CommunityChat
@ -3215,6 +3268,18 @@ func file_communities_proto_init() {
return nil
}
}
file_communities_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CommunityReevaluatePermissionsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -3222,7 +3287,7 @@ func file_communities_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_communities_proto_rawDesc,
NumEnums: 4,
NumMessages: 37,
NumMessages: 38,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -253,3 +253,6 @@ message Storenode {
int64 deleted_at = 8;
}
message CommunityReevaluatePermissionsRequest {
bytes community_id = 1;
}