access handler block (#432)

This commit is contained in:
Michael Quigley 2024-03-01 15:50:54 -05:00
parent 033d52c4c3
commit c673a57304
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
3 changed files with 6 additions and 14 deletions

View File

@ -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()

View File

@ -134,6 +134,7 @@ func (h *shareHandler) Handle(params share.ShareParams, principal *rest_model_zr
BackendMode: params.Body.BackendMode,
BackendProxyEndpoint: &params.Body.BackendProxyEndpoint,
Reserved: reserved,
PermissionMode: store.OpenPermissionMode,
}
if len(params.Body.FrontendSelection) > 0 {
sshr.FrontendSelection = &params.Body.FrontendSelection[0]

View File

@ -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)
}