mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-09 09:35:03 +09:00
Merge pull request #173 from anyproto/GO-2971-revoke-invites-multiple
GO-2971: Revoke invites
This commit is contained in:
commit
c9b61a37f5
2 changed files with 22 additions and 0 deletions
|
@ -36,6 +36,7 @@ type AclSpaceClient interface {
|
|||
ChangePermissions(ctx context.Context, permChange list.PermissionChangesPayload) (err error)
|
||||
RequestSelfRemove(ctx context.Context) (err error)
|
||||
RevokeInvite(ctx context.Context, inviteRecordId string) (err error)
|
||||
RevokeAllInvites(ctx context.Context) (err error)
|
||||
AddAccounts(ctx context.Context, add list.AccountsAddPayload) (err error)
|
||||
}
|
||||
|
||||
|
@ -115,6 +116,20 @@ func (c *aclSpaceClient) RemoveAccounts(ctx context.Context, payload list.Accoun
|
|||
return c.sendRecordAndUpdate(ctx, c.spaceId, res)
|
||||
}
|
||||
|
||||
func (c *aclSpaceClient) RevokeAllInvites(ctx context.Context) (err error) {
|
||||
c.acl.Lock()
|
||||
payload := list.BatchRequestPayload{
|
||||
InviteRevokes: c.acl.AclState().InviteIds(),
|
||||
}
|
||||
res, err := c.acl.RecordBuilder().BuildBatchRequest(payload)
|
||||
if err != nil {
|
||||
c.acl.Unlock()
|
||||
return
|
||||
}
|
||||
c.acl.Unlock()
|
||||
return c.sendRecordAndUpdate(ctx, c.spaceId, res)
|
||||
}
|
||||
|
||||
func (c *aclSpaceClient) StopSharing(ctx context.Context, readKeyChange list.ReadKeyChangePayload) (err error) {
|
||||
c.acl.Lock()
|
||||
var (
|
||||
|
|
|
@ -111,6 +111,13 @@ func TestAclExecutor(t *testing.T) {
|
|||
{"a.batch::remove:e,y;add:z,rw,mz|u,r,mu;revoke:inv1Id;approve:l,r;approve:p,adm;decline:s", nil},
|
||||
{"p.remove::l", nil},
|
||||
{"s.join::inv1Id", ErrNoSuchInvite},
|
||||
{"p.invite::i1", nil},
|
||||
{"p.invite::i2", nil},
|
||||
{"r.join::i1", nil},
|
||||
{"q.join::i2", nil},
|
||||
{"p.batch::revoke:i1;revoke:i2", nil},
|
||||
{"f.join::i1", ErrNoSuchInvite},
|
||||
{"f.join::i2", ErrNoSuchInvite},
|
||||
}
|
||||
for _, cmd := range cmds {
|
||||
err := a.Execute(cmd.cmd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue