forked from TrueCloudLab/frostfs-node
[#69] object/acl: Rename BasicChecker to Service
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
2b2f5d457b
commit
e5898c9ca8
2 changed files with 16 additions and 17 deletions
|
@ -291,7 +291,7 @@ func initObjectService(c *cfg) {
|
||||||
|
|
||||||
objectGRPC.RegisterObjectServiceServer(c.cfgGRPC.server,
|
objectGRPC.RegisterObjectServiceServer(c.cfgGRPC.server,
|
||||||
objectTransportGRPC.New(
|
objectTransportGRPC.New(
|
||||||
acl.NewBasicChecker(
|
acl.New(
|
||||||
acl.NewSenderClassifier(
|
acl.NewSenderClassifier(
|
||||||
c.cfgNetmap.wrapper,
|
c.cfgNetmap.wrapper,
|
||||||
c.cfgNetmap.wrapper,
|
c.cfgNetmap.wrapper,
|
||||||
|
|
|
@ -14,15 +14,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// BasicChecker checks basic ACL rules.
|
// Service checks basic ACL rules.
|
||||||
BasicChecker struct {
|
Service struct {
|
||||||
containers core.Source
|
containers core.Source
|
||||||
sender SenderClassifier
|
sender SenderClassifier
|
||||||
next object.Service
|
next object.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
putStreamBasicChecker struct {
|
putStreamBasicChecker struct {
|
||||||
source *BasicChecker
|
source *Service
|
||||||
next object.PutObjectStreamer
|
next object.PutObjectStreamer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,23 +54,22 @@ var (
|
||||||
ErrBasicAccessDenied = errors.New("access denied by basic acl")
|
ErrBasicAccessDenied = errors.New("access denied by basic acl")
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewBasicChecker is a constructor for basic ACL checker of object requests.
|
// New is a constructor for object ACL checking service.
|
||||||
func NewBasicChecker(
|
func New(
|
||||||
c SenderClassifier,
|
c SenderClassifier,
|
||||||
cnr core.Source,
|
cnr core.Source,
|
||||||
next object.Service) BasicChecker {
|
next object.Service) Service {
|
||||||
|
|
||||||
return BasicChecker{
|
return Service{
|
||||||
containers: cnr,
|
containers: cnr,
|
||||||
sender: c,
|
sender: c,
|
||||||
next: next,
|
next: next,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b BasicChecker) Get(
|
func (b Service) Get(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *object.GetRequest) (object.GetObjectStreamer, error) {
|
request *object.GetRequest) (object.GetObjectStreamer, error) {
|
||||||
|
|
||||||
cid, err := getContainerIDFromRequest(request)
|
cid, err := getContainerIDFromRequest(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -98,7 +97,7 @@ func (b BasicChecker) Get(
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b BasicChecker) Put(ctx context.Context) (object.PutObjectStreamer, error) {
|
func (b Service) Put(ctx context.Context) (object.PutObjectStreamer, error) {
|
||||||
streamer, err := b.next.Put(ctx)
|
streamer, err := b.next.Put(ctx)
|
||||||
|
|
||||||
return putStreamBasicChecker{
|
return putStreamBasicChecker{
|
||||||
|
@ -107,7 +106,7 @@ func (b BasicChecker) Put(ctx context.Context) (object.PutObjectStreamer, error)
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b BasicChecker) Head(
|
func (b Service) Head(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *object.HeadRequest) (*object.HeadResponse, error) {
|
request *object.HeadRequest) (*object.HeadResponse, error) {
|
||||||
|
|
||||||
|
@ -133,7 +132,7 @@ func (b BasicChecker) Head(
|
||||||
return b.next.Head(ctx, request)
|
return b.next.Head(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b BasicChecker) Search(
|
func (b Service) Search(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *object.SearchRequest) (object.SearchObjectStreamer, error) {
|
request *object.SearchRequest) (object.SearchObjectStreamer, error) {
|
||||||
|
|
||||||
|
@ -162,7 +161,7 @@ func (b BasicChecker) Search(
|
||||||
return searchStreamBasicChecker{stream}, err
|
return searchStreamBasicChecker{stream}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b BasicChecker) Delete(
|
func (b Service) Delete(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *object.DeleteRequest) (*object.DeleteResponse, error) {
|
request *object.DeleteRequest) (*object.DeleteResponse, error) {
|
||||||
|
|
||||||
|
@ -188,7 +187,7 @@ func (b BasicChecker) Delete(
|
||||||
return b.next.Delete(ctx, request)
|
return b.next.Delete(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b BasicChecker) GetRange(
|
func (b Service) GetRange(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *object.GetRangeRequest) (object.GetRangeObjectStreamer, error) {
|
request *object.GetRangeRequest) (object.GetRangeObjectStreamer, error) {
|
||||||
|
|
||||||
|
@ -215,7 +214,7 @@ func (b BasicChecker) GetRange(
|
||||||
return getRangeStreamBasicChecker{stream}, err
|
return getRangeStreamBasicChecker{stream}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b BasicChecker) GetRangeHash(
|
func (b Service) GetRangeHash(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
request *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||||
|
|
||||||
|
@ -307,7 +306,7 @@ func (g getStreamBasicChecker) Recv() (*object.GetResponse, error) {
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b BasicChecker) findRequestInfo(
|
func (b Service) findRequestInfo(
|
||||||
req metaWithToken,
|
req metaWithToken,
|
||||||
cid *container.ID,
|
cid *container.ID,
|
||||||
op acl.Operation) (info requestInfo, err error) {
|
op acl.Operation) (info requestInfo, err error) {
|
||||||
|
|
Loading…
Reference in a new issue