Restrict /api/users to admin and loggedUsers
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
986c7e4c64
commit
0b924af8fe
4
users.go
4
users.go
@ -12,11 +12,11 @@ func init() {
|
|||||||
router.GET("/api/users", apiHandler(
|
router.GET("/api/users", apiHandler(
|
||||||
func(httprouter.Params, []byte) HTTPResponse {
|
func(httprouter.Params, []byte) HTTPResponse {
|
||||||
return formatApiResponse(getUsers())
|
return formatApiResponse(getUsers())
|
||||||
}))
|
}, adminRestricted))
|
||||||
router.GET("/api/users/:uid", apiHandler(userHandler(
|
router.GET("/api/users/:uid", apiHandler(userHandler(
|
||||||
func(u User, _ []byte) HTTPResponse {
|
func(u User, _ []byte) HTTPResponse {
|
||||||
return APIResponse{u}
|
return APIResponse{u}
|
||||||
})))
|
}), loggedUser))
|
||||||
router.PUT("/api/users/:uid", apiHandler(userHandler(updateUser), adminRestricted))
|
router.PUT("/api/users/:uid", apiHandler(userHandler(updateUser), adminRestricted))
|
||||||
router.DELETE("/api/users/:uid", apiHandler(userHandler(
|
router.DELETE("/api/users/:uid", apiHandler(userHandler(
|
||||||
func(u User, _ []byte) HTTPResponse {
|
func(u User, _ []byte) HTTPResponse {
|
||||||
|
Reference in New Issue
Block a user