Allow owner/admin to delete messages of a community (#2958)

This commit is contained in:
frank 2022-12-02 19:34:02 +08:00 committed by GitHub
parent 8865a0e4b0
commit 684e9654de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 620 additions and 144 deletions

View File

@ -1 +1 @@
0.115.4
0.115.5

View File

@ -183,48 +183,50 @@ func (o *Community) MarshalJSON() ([]byte, error) {
return nil, errors.New("member identity not set")
}
communityItem := struct {
ID types.HexBytes `json:"id"`
Admin bool `json:"admin"`
Verified bool `json:"verified"`
Joined bool `json:"joined"`
Spectated bool `json:"spectated"`
RequestedAccessAt int `json:"requestedAccessAt"`
Name string `json:"name"`
Description string `json:"description"`
IntroMessage string `json:"introMessage"`
OutroMessage string `json:"outroMessage"`
Tags []CommunityTag `json:"tags"`
Chats map[string]CommunityChat `json:"chats"`
Categories map[string]CommunityCategory `json:"categories"`
Images map[string]images.IdentityImage `json:"images"`
Permissions *protobuf.CommunityPermissions `json:"permissions"`
Members map[string]*protobuf.CommunityMember `json:"members"`
CanRequestAccess bool `json:"canRequestAccess"`
CanManageUsers bool `json:"canManageUsers"`
CanJoin bool `json:"canJoin"`
Color string `json:"color"`
RequestedToJoinAt uint64 `json:"requestedToJoinAt,omitempty"`
IsMember bool `json:"isMember"`
Muted bool `json:"muted"`
CommunityAdminSettings CommunityAdminSettings `json:"adminSettings"`
Encrypted bool `json:"encrypted"`
BanList []string `json:"banList"`
ID types.HexBytes `json:"id"`
Admin bool `json:"admin"`
Verified bool `json:"verified"`
Joined bool `json:"joined"`
Spectated bool `json:"spectated"`
RequestedAccessAt int `json:"requestedAccessAt"`
Name string `json:"name"`
Description string `json:"description"`
IntroMessage string `json:"introMessage"`
OutroMessage string `json:"outroMessage"`
Tags []CommunityTag `json:"tags"`
Chats map[string]CommunityChat `json:"chats"`
Categories map[string]CommunityCategory `json:"categories"`
Images map[string]images.IdentityImage `json:"images"`
Permissions *protobuf.CommunityPermissions `json:"permissions"`
Members map[string]*protobuf.CommunityMember `json:"members"`
CanRequestAccess bool `json:"canRequestAccess"`
CanManageUsers bool `json:"canManageUsers"`
CanDeleteMessageForEveryone bool `json:"canDeleteMessageForEveryone"`
CanJoin bool `json:"canJoin"`
Color string `json:"color"`
RequestedToJoinAt uint64 `json:"requestedToJoinAt,omitempty"`
IsMember bool `json:"isMember"`
Muted bool `json:"muted"`
CommunityAdminSettings CommunityAdminSettings `json:"adminSettings"`
Encrypted bool `json:"encrypted"`
BanList []string `json:"banList"`
}{
ID: o.ID(),
Admin: o.IsAdmin(),
Verified: o.config.Verified,
Chats: make(map[string]CommunityChat),
Categories: make(map[string]CommunityCategory),
Joined: o.config.Joined,
Spectated: o.config.Spectated,
CanRequestAccess: o.CanRequestAccess(o.config.MemberIdentity),
CanJoin: o.canJoin(),
CanManageUsers: o.CanManageUsers(o.config.MemberIdentity),
RequestedToJoinAt: o.RequestedToJoinAt(),
IsMember: o.isMember(),
Muted: o.config.Muted,
Tags: o.Tags(),
Encrypted: o.Encrypted(),
ID: o.ID(),
Admin: o.IsAdmin(),
Verified: o.config.Verified,
Chats: make(map[string]CommunityChat),
Categories: make(map[string]CommunityCategory),
Joined: o.config.Joined,
Spectated: o.config.Spectated,
CanRequestAccess: o.CanRequestAccess(o.config.MemberIdentity),
CanJoin: o.canJoin(),
CanManageUsers: o.CanManageUsers(o.config.MemberIdentity),
CanDeleteMessageForEveryone: o.CanDeleteMessageForEveryone(o.config.MemberIdentity),
RequestedToJoinAt: o.RequestedToJoinAt(),
IsMember: o.isMember(),
Muted: o.config.Muted,
Tags: o.Tags(),
Encrypted: o.Encrypted(),
}
if o.config.CommunityDescription != nil {
for id, c := range o.config.CommunityDescription.Categories {
@ -801,6 +803,64 @@ func (o *Community) BanUserFromCommunity(pk *ecdsa.PublicKey) (*protobuf.Communi
return o.config.CommunityDescription, nil
}
func (o *Community) AddRoleToMember(pk *ecdsa.PublicKey, role protobuf.CommunityMember_Roles) (*protobuf.CommunityDescription, error) {
o.mutex.Lock()
defer o.mutex.Unlock()
if o.config.PrivateKey == nil {
return nil, ErrNotAdmin
}
updated := false
member := o.getMember(pk)
if member != nil {
roles := make(map[protobuf.CommunityMember_Roles]bool)
roles[role] = true
if !o.hasMemberPermission(member, roles) {
member.Roles = append(member.Roles, role)
o.config.CommunityDescription.Members[common.PubkeyToHex(pk)] = member
updated = true
}
}
if updated {
o.increaseClock()
}
return o.config.CommunityDescription, nil
}
func (o *Community) RemoveRoleFromMember(pk *ecdsa.PublicKey, role protobuf.CommunityMember_Roles) (*protobuf.CommunityDescription, error) {
o.mutex.Lock()
defer o.mutex.Unlock()
if o.config.PrivateKey == nil {
return nil, ErrNotAdmin
}
updated := false
member := o.getMember(pk)
if member != nil {
roles := make(map[protobuf.CommunityMember_Roles]bool)
roles[role] = true
if o.hasMemberPermission(member, roles) {
var newRoles []protobuf.CommunityMember_Roles
for _, r := range member.Roles {
if r != role {
newRoles = append(newRoles, r)
}
}
member.Roles = newRoles
o.config.CommunityDescription.Members[common.PubkeyToHex(pk)] = member
updated = true
}
}
if updated {
o.increaseClock()
}
return o.config.CommunityDescription, nil
}
func (o *Community) Edit(description *protobuf.CommunityDescription) {
o.config.CommunityDescription.Identity.DisplayName = description.Identity.DisplayName
o.config.CommunityDescription.Identity.Description = description.Identity.Description
@ -1104,6 +1164,12 @@ func adminRolePermissions() map[protobuf.CommunityMember_Roles]bool {
return roles
}
func canDeleteMessageForEveryonePermissions() map[protobuf.CommunityMember_Roles]bool {
roles := adminRolePermissions()
roles[protobuf.CommunityMember_ROLE_MODERATE_CONTENT] = true
return roles
}
func (o *Community) validateRequestToJoinWithChatID(request *protobuf.CommunityRequestToJoin) error {
chat, ok := o.config.CommunityDescription.Chats[request.ChatId]
@ -1490,6 +1556,22 @@ func (o *Community) CanManageUsers(pk *ecdsa.PublicKey) bool {
return o.hasPermission(pk, roles)
}
func (o *Community) CanDeleteMessageForEveryone(pk *ecdsa.PublicKey) bool {
o.mutex.Lock()
defer o.mutex.Unlock()
if o.IsAdmin() {
return true
}
if !o.hasMember(pk) {
return false
}
roles := canDeleteMessageForEveryonePermissions()
return o.hasPermission(pk, roles)
}
func (o *Community) isMember() bool {
return o.hasMember(o.config.MemberIdentity)
}

View File

@ -28,3 +28,4 @@ var ErrNotAuthorized = errors.New("not authorized")
var ErrAlreadyMember = errors.New("already a member")
var ErrAlreadyJoined = errors.New("already joined")
var ErrInvalidMessage = errors.New("invalid community description message")
var ErrMemberNotFound = errors.New("member not found")

View File

@ -1278,6 +1278,74 @@ func (m *Manager) UnbanUserFromCommunity(request *requests.UnbanUserFromCommunit
return community, nil
}
func (m *Manager) AddRoleToMember(request *requests.AddRoleToMember) (*Community, error) {
id := request.CommunityID
publicKey, err := common.HexToPubkey(request.User.String())
if err != nil {
return nil, err
}
community, err := m.GetByID(id)
if err != nil {
return nil, err
}
if community == nil {
return nil, ErrOrgNotFound
}
if !community.hasMember(publicKey) {
return nil, ErrMemberNotFound
}
_, err = community.AddRoleToMember(publicKey, request.Role)
if err != nil {
return nil, err
}
err = m.persistence.SaveCommunity(community)
if err != nil {
return nil, err
}
m.publish(&Subscription{Community: community})
return community, nil
}
func (m *Manager) RemoveRoleFromMember(request *requests.RemoveRoleFromMember) (*Community, error) {
id := request.CommunityID
publicKey, err := common.HexToPubkey(request.User.String())
if err != nil {
return nil, err
}
community, err := m.GetByID(id)
if err != nil {
return nil, err
}
if community == nil {
return nil, ErrOrgNotFound
}
if !community.hasMember(publicKey) {
return nil, ErrMemberNotFound
}
_, err = community.RemoveRoleFromMember(publicKey, request.Role)
if err != nil {
return nil, err
}
err = m.persistence.SaveCommunity(community)
if err != nil {
return nil, err
}
m.publish(&Subscription{Community: community})
return community, nil
}
func (m *Manager) BanUserFromCommunity(request *requests.BanUserFromCommunity) (*Community, error) {
id := request.CommunityID

View File

@ -592,7 +592,7 @@ func (db sqlitePersistence) MessageByChatID(chatID string, currCursor string, li
// This new column values can also be returned as a cursor for subsequent requests.
where := fmt.Sprintf(`
WHERE
NOT(m1.hide) AND m1.local_chat_id = ? %s
NOT(m1.hide) AND m1.local_chat_id = ? %s AND NOT(m1.deleted)
ORDER BY cursor DESC
LIMIT ?`, cursorWhere)

View File

@ -1331,6 +1331,34 @@ func (m *Messenger) BanUserFromCommunity(request *requests.BanUserFromCommunity)
return response, nil
}
func (m *Messenger) AddRoleToMember(request *requests.AddRoleToMember) (*MessengerResponse, error) {
if err := request.Validate(); err != nil {
return nil, err
}
community, err := m.communitiesManager.AddRoleToMember(request)
if err != nil {
return nil, err
}
response := &MessengerResponse{}
response.AddCommunity(community)
return response, nil
}
func (m *Messenger) RemoveRoleFromMember(request *requests.RemoveRoleFromMember) (*MessengerResponse, error) {
if err := request.Validate(); err != nil {
return nil, err
}
community, err := m.communitiesManager.RemoveRoleFromMember(request)
if err != nil {
return nil, err
}
response := &MessengerResponse{}
response.AddCommunity(community)
return response, nil
}
func (m *Messenger) findCommunityInfoFromDB(communityID string) (*communities.Community, error) {
id, err := hexutil.Decode(communityID)
if err != nil {

View File

@ -0,0 +1,177 @@
package protocol
import (
"context"
"testing"
"github.com/stretchr/testify/suite"
"go.uber.org/zap"
"github.com/ethereum/go-ethereum/crypto"
gethbridge "github.com/status-im/status-go/eth-node/bridge/geth"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/communities"
"github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/tt"
"github.com/status-im/status-go/waku"
)
func TestMessengerDeleteMessageForEveryoneSuite(t *testing.T) {
suite.Run(t, new(MessengerDeleteMessageForEveryoneSuite))
}
type MessengerDeleteMessageForEveryoneSuite struct {
suite.Suite
admin *Messenger
moderator *Messenger
bob *Messenger
shh types.Waku
logger *zap.Logger
}
func (s *MessengerDeleteMessageForEveryoneSuite) SetupTest() {
s.logger = tt.MustCreateTestLogger()
config := waku.DefaultConfig
config.MinimumAcceptedPoW = 0
shh := waku.New(&config, s.logger)
s.shh = gethbridge.NewGethWakuWrapper(shh)
s.Require().NoError(shh.Start())
s.admin = s.newMessenger()
s.bob = s.newMessenger()
s.moderator = s.newMessenger()
_, err := s.admin.Start()
s.Require().NoError(err)
_, err = s.bob.Start()
s.Require().NoError(err)
_, err = s.moderator.Start()
s.Require().NoError(err)
}
func (s *MessengerDeleteMessageForEveryoneSuite) TearDownTest() {
s.Require().NoError(s.admin.Shutdown())
s.Require().NoError(s.bob.Shutdown())
_ = s.logger.Sync()
}
func (s *MessengerDeleteMessageForEveryoneSuite) newMessenger() *Messenger {
privateKey, err := crypto.GenerateKey()
s.Require().NoError(err)
messenger, err := newMessengerWithKey(s.shh, privateKey, s.logger, nil)
s.Require().NoError(err)
return messenger
}
func (s *MessengerDeleteMessageForEveryoneSuite) TestDeleteMessageForEveryone() {
community := s.createCommunity()
communityChat := s.createCommunityChat(community)
s.inviteAndJoin(community, s.moderator)
s.inviteAndJoin(community, s.bob)
response, err := s.admin.AddRoleToMember(&requests.AddRoleToMember{
CommunityID: community.ID(),
User: common.PubkeyToHexBytes(s.moderator.IdentityPublicKey()),
Role: protobuf.CommunityMember_ROLE_MODERATE_CONTENT,
})
s.Require().NoError(err)
s.Require().Len(response.Communities(), 1)
community = response.Communities()[0]
ctx := context.Background()
inputMessage := &common.Message{}
inputMessage.ChatId = communityChat.ID
inputMessage.ContentType = protobuf.ChatMessage_TEXT_PLAIN
inputMessage.Text = "some text"
_, err = s.bob.SendChatMessage(ctx, inputMessage)
s.Require().NoError(err)
response, err = WaitOnMessengerResponse(s.moderator, func(response *MessengerResponse) bool {
return len(response.Messages()) > 0
}, "messages not received")
s.Require().NoError(err)
message := response.Messages()[0]
s.Require().Equal(inputMessage.Text, message.Text)
_, err = s.moderator.DeleteMessageAndSend(ctx, message.ID)
s.Require().NoError(err)
_, err = WaitOnMessengerResponse(s.bob, func(response *MessengerResponse) bool {
return len(response.RemovedMessages()) > 0
}, "removed messages not received")
s.Require().NoError(err)
message, err = s.bob.MessageByID(message.ID)
s.Require().NoError(err)
s.Require().True(message.Deleted)
}
func (s *MessengerDeleteMessageForEveryoneSuite) createCommunity() *communities.Community {
description := &requests.CreateCommunity{
Membership: protobuf.CommunityPermissions_NO_MEMBERSHIP,
Name: "status",
Color: "#ffffff",
Description: "status community description",
}
response, err := s.admin.CreateCommunity(description, false)
s.Require().NoError(err)
s.Require().NotNil(response)
s.Require().Len(response.Communities(), 1)
s.Require().Len(response.Chats(), 0)
return response.Communities()[0]
}
func (s *MessengerDeleteMessageForEveryoneSuite) createCommunityChat(community *communities.Community) *Chat {
orgChat := &protobuf.CommunityChat{
Permissions: &protobuf.CommunityPermissions{
Access: protobuf.CommunityPermissions_NO_MEMBERSHIP,
},
Identity: &protobuf.ChatIdentity{
DisplayName: "status-core",
Emoji: "",
Description: "status-core community chatToModerator",
},
}
response, err := s.admin.CreateCommunityChat(community.ID(), orgChat)
s.Require().NoError(err)
s.Require().NotNil(response)
s.Require().Len(response.Communities(), 1)
s.Require().Len(response.Chats(), 1)
return response.Chats()[0]
}
func (s *MessengerDeleteMessageForEveryoneSuite) inviteAndJoin(community *communities.Community, target *Messenger) {
response, err := s.admin.InviteUsersToCommunity(&requests.InviteUsersToCommunity{
CommunityID: community.ID(),
Users: []types.HexBytes{common.PubkeyToHexBytes(&target.identity.PublicKey)},
})
s.Require().NoError(err)
s.Require().NotNil(response)
s.Require().Len(response.Communities(), 1)
community = response.Communities()[0]
s.Require().True(community.HasMember(&target.identity.PublicKey))
_, err = WaitOnMessengerResponse(target, func(response *MessengerResponse) bool {
return len(response.Communities()) > 0
}, "community not received")
s.Require().NoError(err)
response, err = target.JoinCommunity(context.Background(), community.ID())
s.Require().NoError(err)
s.Require().NotNil(response)
s.Require().Len(response.Communities(), 1)
s.Require().True(response.Communities()[0].Joined())
s.Require().Len(response.Chats(), 1)
s.Require().NoError(target.SaveChat(response.Chats()[0]))
response, err = WaitOnMessengerResponse(target, func(response *MessengerResponse) bool {
return len(response.Messages()) > 0
}, "message 'You have been invited to community' not received")
s.Require().NoError(err)
}

View File

@ -103,7 +103,7 @@ func (s *MessengerDeleteMessageSuite) TestDeleteMessage() {
// Main instance user attempts to delete the message it received from theirMessenger
_, err = s.m.DeleteMessageAndSend(context.Background(), ogMessage.ID)
s.Require().Equal(ErrInvalidEditOrDeleteAuthor, err)
s.Require().ErrorContains(err, "Chat not found")
}
func (s *MessengerDeleteMessageSuite) TestDeleteMessagePreviousLastMessage() {

View File

@ -1257,9 +1257,22 @@ func (m *Messenger) HandleDeleteMessage(state *ReceivedMessageState, deleteMessa
return errors.New("chat not found")
}
// Check edit is valid
var canDeleteMessageForEveryone = false
if originalMessage.From != deleteMessage.From {
return errors.New("invalid delete, not the right author")
if chat.ChatType == ChatTypeCommunityChat {
fromPublicKey, err := common.HexToPubkey(deleteMessage.From)
if err != nil {
return err
}
canDeleteMessageForEveryone = m.CanDeleteMessageForEveryone(chat.CommunityID, fromPublicKey)
if !canDeleteMessageForEveryone {
return ErrInvalidDeletePermission
}
}
// Check edit is valid
if !canDeleteMessageForEveryone {
return errors.New("invalid delete, not the right author")
}
}
// Update message and return it

View File

@ -2,8 +2,11 @@ package protocol
import (
"context"
"crypto/ecdsa"
"errors"
"go.uber.org/zap"
"github.com/golang/protobuf/proto"
"github.com/status-im/status-go/protocol/common"
@ -14,6 +17,7 @@ import (
var ErrInvalidEditOrDeleteAuthor = errors.New("sender is not the author of the message")
var ErrInvalidDeleteTypeAuthor = errors.New("message type cannot be deleted")
var ErrInvalidEditContentType = errors.New("only text or emoji messages can be replaced")
var ErrInvalidDeletePermission = errors.New("don't have enough permission to delete")
func (m *Messenger) EditMessage(ctx context.Context, request *requests.EditMessage) (*MessengerResponse, error) {
err := request.Validate()
@ -86,22 +90,44 @@ func (m *Messenger) EditMessage(ctx context.Context, request *requests.EditMessa
return response, nil
}
func (m *Messenger) CanDeleteMessageForEveryone(communityID string, publicKey *ecdsa.PublicKey) bool {
if communityID != "" {
community, err := m.communitiesManager.GetByIDString(communityID)
if err != nil {
m.logger.Error("failed to find community", zap.String("communityID", communityID), zap.Error(err))
return false
}
return community.CanDeleteMessageForEveryone(publicKey)
}
return false
}
func (m *Messenger) DeleteMessageAndSend(ctx context.Context, messageID string) (*MessengerResponse, error) {
message, err := m.persistence.MessageByID(messageID)
if err != nil {
return nil, err
}
if message.From != common.PubkeyToHex(&m.identity.PublicKey) {
return nil, ErrInvalidEditOrDeleteAuthor
}
// A valid added chat is required.
chat, ok := m.allChats.Load(message.ChatId)
if !ok {
return nil, errors.New("Chat not found")
}
var canDeleteMessageForEveryone = false
if message.From != common.PubkeyToHex(&m.identity.PublicKey) {
if message.MessageType == protobuf.MessageType_COMMUNITY_CHAT {
communityID := chat.CommunityID
canDeleteMessageForEveryone = m.CanDeleteMessageForEveryone(communityID, &m.identity.PublicKey)
if !canDeleteMessageForEveryone {
return nil, ErrInvalidDeletePermission
}
}
if !canDeleteMessageForEveryone {
return nil, ErrInvalidEditOrDeleteAuthor
}
}
// Only certain types of messages can be deleted
if message.ContentType != protobuf.ChatMessage_TEXT_PLAIN &&
message.ContentType != protobuf.ChatMessage_STICKER &&

View File

@ -23,21 +23,24 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type CommunityMember_Roles int32
const (
CommunityMember_UNKNOWN_ROLE CommunityMember_Roles = 0
CommunityMember_ROLE_ALL CommunityMember_Roles = 1
CommunityMember_ROLE_MANAGE_USERS CommunityMember_Roles = 2
CommunityMember_UNKNOWN_ROLE CommunityMember_Roles = 0
CommunityMember_ROLE_ALL CommunityMember_Roles = 1
CommunityMember_ROLE_MANAGE_USERS CommunityMember_Roles = 2
CommunityMember_ROLE_MODERATE_CONTENT CommunityMember_Roles = 3
)
var CommunityMember_Roles_name = map[int32]string{
0: "UNKNOWN_ROLE",
1: "ROLE_ALL",
2: "ROLE_MANAGE_USERS",
3: "ROLE_MODERATE_CONTENT",
}
var CommunityMember_Roles_value = map[string]int32{
"UNKNOWN_ROLE": 0,
"ROLE_ALL": 1,
"ROLE_MANAGE_USERS": 2,
"UNKNOWN_ROLE": 0,
"ROLE_ALL": 1,
"ROLE_MANAGE_USERS": 2,
"ROLE_MODERATE_CONTENT": 3,
}
func (x CommunityMember_Roles) String() string {
@ -1255,92 +1258,93 @@ func init() {
}
var fileDescriptor_f937943d74c1cd8b = []byte{
// 1382 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4b, 0x6f, 0x1b, 0xb7,
0x16, 0xce, 0xe8, 0x61, 0x49, 0x47, 0x92, 0x23, 0x33, 0x89, 0x3d, 0x71, 0x1e, 0x56, 0xe6, 0xde,
0x0b, 0x38, 0xb8, 0xb8, 0x0a, 0xe2, 0xe0, 0x02, 0x41, 0x1f, 0x49, 0x14, 0x47, 0x48, 0xd5, 0xd8,
0x72, 0x42, 0xd9, 0x4d, 0x9b, 0x45, 0x07, 0xd4, 0x0c, 0x2d, 0x13, 0x1e, 0x71, 0xd4, 0x21, 0x25,
0x54, 0x5d, 0x74, 0xdd, 0x9f, 0x50, 0x74, 0xdb, 0x4d, 0x57, 0xfd, 0x0b, 0x5d, 0x74, 0xd5, 0x4d,
0xf7, 0xdd, 0xf5, 0xa7, 0x14, 0xe4, 0x3c, 0x34, 0x7a, 0x39, 0x01, 0x82, 0x02, 0x5d, 0x89, 0xe7,
0xf0, 0x9c, 0xef, 0xbc, 0x79, 0x46, 0xb0, 0xe1, 0xf8, 0x83, 0xc1, 0x88, 0x33, 0xc9, 0xa8, 0x68,
0x0c, 0x03, 0x5f, 0xfa, 0xa8, 0xa8, 0x7f, 0x7a, 0xa3, 0xd3, 0xed, 0x2b, 0xce, 0x19, 0x91, 0x36,
0x73, 0x29, 0x97, 0x4c, 0x4e, 0xc2, 0x6b, 0x6b, 0x0c, 0xf9, 0xe7, 0x01, 0xe1, 0x12, 0xdd, 0x81,
0x4a, 0xac, 0x3c, 0xb1, 0x99, 0x6b, 0x1a, 0x75, 0x63, 0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5, 0x5a, 0xbb, 0xb6, 0x14, 0x01,
0x27, 0x62, 0xd6, 0xaf, 0x06, 0xec, 0x2c, 0x62, 0xb7, 0xb9, 0x4b, 0xbf, 0x7e, 0x87, 0x5c, 0xbd,
0xbf, 0xcb, 0x9b, 0xb0, 0xe6, 0x9f, 0x9e, 0x0a, 0x2a, 0xa3, 0xec, 0x46, 0x94, 0xaa, 0x82, 0x60,
0xdf, 0xd0, 0xe8, 0x2f, 0x93, 0x3e, 0xcf, 0xf7, 0x48, 0x2e, 0xe9, 0x11, 0xeb, 0x77, 0x03, 0xb6,
0x56, 0x44, 0x81, 0x5e, 0x40, 0x31, 0xfa, 0x82, 0x8c, 0x77, 0xfd, 0xbd, 0x8b, 0x7c, 0xd4, 0x4a,
0x8d, 0x88, 0x88, 0xd6, 0x7e, 0x02, 0xb0, 0x7d, 0x0a, 0xd5, 0x99, 0xab, 0x25, 0x5b, 0xf4, 0xf1,
0xec, 0x16, 0xbd, 0xfb, 0x56, 0x63, 0x49, 0x56, 0xa6, 0x5b, 0xf5, 0x69, 0xf5, 0x4d, 0xb9, 0x71,
0xef, 0xc3, 0x58, 0xb3, 0xb7, 0xa6, 0x4f, 0x0f, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x35, 0x39,
0x1e, 0x9e, 0xde, 0x0e, 0x00, 0x00,
// 1396 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcd, 0x6f, 0x1b, 0x45,
0x14, 0xef, 0xfa, 0x23, 0xb6, 0x9f, 0xed, 0xd4, 0x99, 0x36, 0xc9, 0x36, 0xfd, 0x88, 0xbb, 0x80,
0x94, 0x0a, 0xe1, 0xaa, 0xa9, 0x90, 0x2a, 0xbe, 0x5a, 0x37, 0xb5, 0x8a, 0x69, 0x62, 0xb7, 0x13,
0x87, 0xd2, 0x1e, 0x58, 0x4d, 0x76, 0x27, 0xce, 0x28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4f, 0x00, 0xb6, 0x4e, 0xa0, 0x3a, 0xf5, 0x69, 0xc1, 0x16, 0x7d, 0x38, 0xbd, 0x45,
0xef, 0xbc, 0xd1, 0x58, 0x92, 0x95, 0xc9, 0x56, 0x7d, 0x5c, 0x7d, 0x5d, 0x6e, 0xdc, 0xfd, 0x34,
0xd6, 0x3c, 0x5e, 0xd1, 0xa7, 0xfb, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x01, 0x61, 0xde, 0x61,
0xf9, 0x0e, 0x00, 0x00,
}

View File

@ -17,6 +17,7 @@ message CommunityMember {
UNKNOWN_ROLE = 0;
ROLE_ALL = 1;
ROLE_MANAGE_USERS = 2;
ROLE_MODERATE_CONTENT = 3;
}
repeated Roles roles = 1;
}

View File

@ -0,0 +1,34 @@
package requests
import (
"errors"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/protocol/protobuf"
)
var ErrAddRoleToMemberInvalidCommunityID = errors.New("add-role-to-member: invalid community id")
var ErrAddRoleToMemberInvalidUser = errors.New("add-role-to-member: invalid user id")
var ErrAddRoleToMemberInvalidRole = errors.New("add-role-to-member: invalid role")
type AddRoleToMember struct {
CommunityID types.HexBytes `json:"communityId"`
User types.HexBytes `json:"user"`
Role protobuf.CommunityMember_Roles `json:"role"`
}
func (a *AddRoleToMember) Validate() error {
if len(a.CommunityID) == 0 {
return ErrAddRoleToMemberInvalidCommunityID
}
if len(a.User) == 0 {
return ErrAddRoleToMemberInvalidUser
}
if a.Role == protobuf.CommunityMember_UNKNOWN_ROLE {
return ErrAddRoleToMemberInvalidRole
}
return nil
}

View File

@ -0,0 +1,34 @@
package requests
import (
"errors"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/protocol/protobuf"
)
var ErrRemoveRoleFromMemberInvalidCommunityID = errors.New("remove-role-from-member: invalid community id")
var ErrRemoveRoleFromMemberInvalidUser = errors.New("remove-role-from-member: invalid user id")
var ErrRemoveRoleFromMemberInvalidRole = errors.New("remove-role-from-member: invalid role")
type RemoveRoleFromMember struct {
CommunityID types.HexBytes `json:"communityId"`
User types.HexBytes `json:"user"`
Role protobuf.CommunityMember_Roles `json:"role"`
}
func (r *RemoveRoleFromMember) Validate() error {
if len(r.CommunityID) == 0 {
return ErrRemoveRoleFromMemberInvalidCommunityID
}
if len(r.User) == 0 {
return ErrRemoveRoleFromMemberInvalidUser
}
if r.Role == protobuf.CommunityMember_UNKNOWN_ROLE {
return ErrRemoveRoleFromMemberInvalidRole
}
return nil
}

View File

@ -472,6 +472,14 @@ func (api *PublicAPI) UnbanUserFromCommunity(request *requests.UnbanUserFromComm
return api.service.messenger.UnbanUserFromCommunity(request)
}
func (api *PublicAPI) AddRoleToMember(request *requests.AddRoleToMember) (*protocol.MessengerResponse, error) {
return api.service.messenger.AddRoleToMember(request)
}
func (api *PublicAPI) RemoveRoleFromMember(request *requests.RemoveRoleFromMember) (*protocol.MessengerResponse, error) {
return api.service.messenger.RemoveRoleFromMember(request)
}
// MyPendingRequestsToJoin returns the pending requests for the logged in user
func (api *PublicAPI) MyPendingRequestsToJoin() ([]*communities.RequestToJoin, error) {
return api.service.messenger.MyPendingRequestsToJoin()