From d3807c5a0d444c4caa58743e2ba1e38e998681ed Mon Sep 17 00:00:00 2001 From: Max Sum Date: Sun, 1 Dec 2019 00:48:43 +0800 Subject: [PATCH] union: fix epall and all policy --- backend/union/policy/epall.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/backend/union/policy/epall.go b/backend/union/policy/epall.go index e1c5f9d34..dc493151c 100644 --- a/backend/union/policy/epall.go +++ b/backend/union/policy/epall.go @@ -58,6 +58,18 @@ func (p *EpAll) Action(ctx context.Context, upstreams []*upstream.Fs, path strin return p.epall(ctx, upstreams, path) } +// ActionEntries is ACTION category policy but receving a set of candidate entries +func (p *EpAll) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error) { + if len(entries) == 0 { + return nil, fs.ErrorObjectNotFound + } + entries = filterROEntries(entries) + if len(entries) == 0 { + return nil, fs.ErrorPermissionDenied + } + return entries, nil +} + // Create category policy, governing the creation of files and directories func (p *EpAll) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error) { if len(upstreams) == 0 { @@ -69,4 +81,16 @@ func (p *EpAll) Create(ctx context.Context, upstreams []*upstream.Fs, path strin } upstreams, err := p.epall(ctx, upstreams, path) return upstreams, err +} + +// CreateEntries is CREATE category policy but receving a set of candidate entries +func (p *EpAll) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error) { + if len(entries) == 0 { + return nil, fs.ErrorObjectNotFound + } + entries = filterNCEntries(entries) + if len(entries) == 0 { + return nil, fs.ErrorPermissionDenied + } + return entries, nil } \ No newline at end of file