mirror of
https://github.com/openziti/zrok.git
synced 2024-12-23 07:09:12 +01:00
access handler block (#432)
This commit is contained in:
parent
033d52c4c3
commit
c673a57304
@ -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()
|
||||
|
@ -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]
|
||||
|
@ -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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user