From c673a5730447d224a241cfbda0bb3a0913c20f90 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 1 Mar 2024 15:50:54 -0500 Subject: [PATCH] access handler block (#432) --- controller/access.go | 5 +++++ controller/share.go | 1 + controller/store/shareTest.go | 14 -------------- 3 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 controller/store/shareTest.go diff --git a/controller/access.go b/controller/access.go index 3d84323a..19e27717 100644 --- a/controller/access.go +++ b/controller/access.go @@ -57,6 +57,11 @@ func (h *accessHandler) Handle(params share.AccessParams, principal *rest_model_ return share.NewAccessNotFound() } + if shr.PermissionMode != store.OpenPermissionMode { + logrus.Errorf("closed permission mode selected") + return share.NewAccessNotFound() + } + if err := h.checkLimits(shr, trx); err != nil { logrus.Errorf("cannot access limited share for '%v': %v", principal.Email, err) return share.NewAccessNotFound() diff --git a/controller/share.go b/controller/share.go index f2b73758..ec506820 100644 --- a/controller/share.go +++ b/controller/share.go @@ -134,6 +134,7 @@ func (h *shareHandler) Handle(params share.ShareParams, principal *rest_model_zr BackendMode: params.Body.BackendMode, BackendProxyEndpoint: ¶ms.Body.BackendProxyEndpoint, Reserved: reserved, + PermissionMode: store.OpenPermissionMode, } if len(params.Body.FrontendSelection) > 0 { sshr.FrontendSelection = ¶ms.Body.FrontendSelection[0] diff --git a/controller/store/shareTest.go b/controller/store/shareTest.go deleted file mode 100644 index 530a63a2..00000000 --- a/controller/store/shareTest.go +++ /dev/null @@ -1,14 +0,0 @@ -package store - -import ( - "github.com/stretchr/testify/assert" - "testing" -) - -func TestShareDefaultPermissionMode(t *testing.T) { - shr := &Share{} - assert.Equal(t, OpenPermissionMode, shr.PermissionMode) - - var shr2 Share - assert.Equal(t, OpenPermissionMode, shr2.PermissionMode) -}