Update web handler (fixed)
This commit is contained in:
parent
81f76f09ce
commit
e21471a193
8 changed files with 31 additions and 14 deletions
6
go.mod
6
go.mod
|
@ -18,7 +18,7 @@ module code.vikunja.io/api
|
|||
|
||||
require (
|
||||
cloud.google.com/go v0.34.0 // indirect
|
||||
code.vikunja.io/web v0.0.0-20190324123058-62b466dd1311
|
||||
code.vikunja.io/web v0.0.0-20190329170935-7dc1f4191c49
|
||||
github.com/BurntSushi/toml v0.3.1 // indirect
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
|
||||
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf
|
||||
|
@ -64,10 +64,10 @@ require (
|
|||
github.com/urfave/cli v1.20.0 // indirect
|
||||
github.com/valyala/fasttemplate v1.0.1 // indirect
|
||||
github.com/ziutek/mymysql v1.5.4 // indirect
|
||||
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576
|
||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
|
||||
golang.org/x/net v0.0.0-20181217023233-e147a9138326 // indirect
|
||||
golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc // indirect
|
||||
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65 // indirect
|
||||
golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081 // indirect
|
||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||
|
|
6
go.sum
6
go.sum
|
@ -13,6 +13,8 @@ code.vikunja.io/web v0.0.0-20190324105229-0933ac082307 h1:t2E9v+k56RbvM5WNJF5BFF
|
|||
code.vikunja.io/web v0.0.0-20190324105229-0933ac082307/go.mod h1:PmGEu9qI7nbEKDn38H0SWgCoGO4GLdbjdlnWSzFi2PA=
|
||||
code.vikunja.io/web v0.0.0-20190324123058-62b466dd1311 h1:3VRszH3NCTNUh+8y2ImA50ALJiE1e9KNoowv9y8mzvA=
|
||||
code.vikunja.io/web v0.0.0-20190324123058-62b466dd1311/go.mod h1:PmGEu9qI7nbEKDn38H0SWgCoGO4GLdbjdlnWSzFi2PA=
|
||||
code.vikunja.io/web v0.0.0-20190329170935-7dc1f4191c49 h1:onS7evj9KeCnf/3kNGlY1pXCT1BDay3WlbFddH6bwIE=
|
||||
code.vikunja.io/web v0.0.0-20190329170935-7dc1f4191c49/go.mod h1:PmGEu9qI7nbEKDn38H0SWgCoGO4GLdbjdlnWSzFi2PA=
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4=
|
||||
|
@ -185,6 +187,8 @@ golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b h1:Elez2XeF2p9uyVj0yEUDqQ
|
|||
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576 h1:aUX/1G2gFSs4AsJJg2cL3HuoRhCSCz733FE5GUSuaT4=
|
||||
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c h1:Vj5n4GlwjmQteupaxJ9+0FNOmBrHfq7vN4btdGoDZgI=
|
||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3 h1:x/bBzNauLQAlE3fLku/xy92Y8QwKX5HZymrMz2IiKFc=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
|
@ -209,6 +213,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
|
|||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc h1:4gbWbmmPFp4ySWICouJl6emP0MyS31yy9SrTlAGFT+g=
|
||||
golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65 h1:hOY+O8MxdkPV10pNf7/XEHaySCiPKxixMKUshfHsGn0=
|
||||
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081 h1:QJP9sxq2/KbTxFnGduVryxJOt6r/UVGyom3tLaqu7tc=
|
||||
|
|
4
vendor/code.vikunja.io/web/handler/create.go
generated
vendored
4
vendor/code.vikunja.io/web/handler/create.go
generated
vendored
|
@ -42,11 +42,11 @@ func (c *WebHandler) CreateWeb(ctx echo.Context) error {
|
|||
}
|
||||
|
||||
// Check rights
|
||||
canRead, err := currentStruct.CanCreate(currentAuth)
|
||||
canCreate, err := currentStruct.CanCreate(currentAuth)
|
||||
if err != nil {
|
||||
return HandleHTTPError(err, ctx)
|
||||
}
|
||||
if canRead {
|
||||
if !canCreate {
|
||||
config.LoggingProvider.Noticef("Tried to create while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden)
|
||||
}
|
||||
|
|
4
vendor/code.vikunja.io/web/handler/delete.go
generated
vendored
4
vendor/code.vikunja.io/web/handler/delete.go
generated
vendored
|
@ -44,8 +44,8 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
|
|||
if err != nil {
|
||||
return HandleHTTPError(err, ctx)
|
||||
}
|
||||
if canDelete {
|
||||
config.LoggingProvider.Noticef("Tried to create while not having the rights for it (User: %v)", currentAuth)
|
||||
if !canDelete {
|
||||
config.LoggingProvider.Noticef("Tried to delete while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden)
|
||||
}
|
||||
|
||||
|
|
4
vendor/code.vikunja.io/web/handler/read_one.go
generated
vendored
4
vendor/code.vikunja.io/web/handler/read_one.go
generated
vendored
|
@ -39,8 +39,8 @@ func (c *WebHandler) ReadOneWeb(ctx echo.Context) error {
|
|||
if err != nil {
|
||||
return HandleHTTPError(err, ctx)
|
||||
}
|
||||
if canRead {
|
||||
config.LoggingProvider.Noticef("Tried to create while not having the rights for it (User: %v)", currentAuth)
|
||||
if !canRead {
|
||||
config.LoggingProvider.Noticef("Tried to read while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden, "You don't have the right to see this")
|
||||
}
|
||||
|
||||
|
|
4
vendor/code.vikunja.io/web/handler/update.go
generated
vendored
4
vendor/code.vikunja.io/web/handler/update.go
generated
vendored
|
@ -45,8 +45,8 @@ func (c *WebHandler) UpdateWeb(ctx echo.Context) error {
|
|||
if err != nil {
|
||||
return HandleHTTPError(err, ctx)
|
||||
}
|
||||
if canUpdate {
|
||||
config.LoggingProvider.Noticef("Tried to create while not having the rights for it (User: %v)", currentAuth)
|
||||
if !canUpdate {
|
||||
config.LoggingProvider.Noticef("Tried to update while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden)
|
||||
}
|
||||
|
||||
|
|
11
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
11
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
|
@ -294,6 +294,13 @@ func GetsockoptTimeval(fd, level, opt int) (*Timeval, error) {
|
|||
return &tv, err
|
||||
}
|
||||
|
||||
func GetsockoptUint64(fd, level, opt int) (value uint64, err error) {
|
||||
var n uint64
|
||||
vallen := _Socklen(8)
|
||||
err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
|
||||
return n, err
|
||||
}
|
||||
|
||||
func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
|
||||
var rsa RawSockaddrAny
|
||||
var len _Socklen = SizeofSockaddrAny
|
||||
|
@ -351,6 +358,10 @@ func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) {
|
|||
return setsockopt(fd, level, opt, unsafe.Pointer(tv), unsafe.Sizeof(*tv))
|
||||
}
|
||||
|
||||
func SetsockoptUint64(fd, level, opt int, value uint64) (err error) {
|
||||
return setsockopt(fd, level, opt, unsafe.Pointer(&value), 8)
|
||||
}
|
||||
|
||||
func Socket(domain, typ, proto int) (fd int, err error) {
|
||||
if domain == AF_INET6 && SocketDisableIPv6 {
|
||||
return -1, EAFNOSUPPORT
|
||||
|
|
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
|
@ -1,4 +1,4 @@
|
|||
# code.vikunja.io/web v0.0.0-20190324123058-62b466dd1311
|
||||
# code.vikunja.io/web v0.0.0-20190329170935-7dc1f4191c49
|
||||
code.vikunja.io/web
|
||||
code.vikunja.io/web/handler
|
||||
# github.com/BurntSushi/toml v0.3.1
|
||||
|
@ -154,7 +154,7 @@ github.com/urfave/cli
|
|||
github.com/valyala/bytebufferpool
|
||||
# github.com/valyala/fasttemplate v1.0.1
|
||||
github.com/valyala/fasttemplate
|
||||
# golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576
|
||||
# golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
|
||||
golang.org/x/crypto/bcrypt
|
||||
golang.org/x/crypto/acme/autocert
|
||||
golang.org/x/crypto/blowfish
|
||||
|
@ -164,7 +164,7 @@ golang.org/x/lint/golint
|
|||
golang.org/x/lint
|
||||
# golang.org/x/net v0.0.0-20181217023233-e147a9138326
|
||||
golang.org/x/net/idna
|
||||
# golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc
|
||||
# golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65
|
||||
golang.org/x/sys/unix
|
||||
# golang.org/x/text v0.3.0
|
||||
golang.org/x/text/transform
|
||||
|
|
Loading…
Reference in a new issue