mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
aclService: readState method
This commit is contained in:
parent
ad704c85eb
commit
ccbb8caecd
3 changed files with 51 additions and 0 deletions
11
acl/acl.go
11
acl/acl.go
|
@ -39,6 +39,7 @@ type AclService interface {
|
|||
RecordsAfter(ctx context.Context, spaceId, aclHead string) (result []*consensusproto.RawRecordWithId, err error)
|
||||
Permissions(ctx context.Context, identity crypto.PubKey, spaceId string) (res list.AclPermissions, err error)
|
||||
OwnerPubKey(ctx context.Context, spaceId string) (ownerIdentity crypto.PubKey, err error)
|
||||
ReadState(ctx context.Context, spaceId string, f func(s *list.AclState) error) (err error)
|
||||
app.ComponentRunnable
|
||||
}
|
||||
|
||||
|
@ -159,6 +160,16 @@ func (as *aclService) Permissions(ctx context.Context, identity crypto.PubKey, s
|
|||
return acl.AclState().Permissions(identity), nil
|
||||
}
|
||||
|
||||
func (as *aclService) ReadState(ctx context.Context, spaceId string, f func(s *list.AclState) error) (err error) {
|
||||
acl, err := as.get(ctx, spaceId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
acl.RLock()
|
||||
defer acl.RUnlock()
|
||||
return f(acl.AclState())
|
||||
}
|
||||
|
||||
func (as *aclService) Run(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue