Add option to enforce strict compatibility

Some plugins check for token length. Since PushBits uses longer tokens by default for better security, these plugins are
incompatible. With this patch, users can decide if they want an application to have a short token, so that said plugins
can talk to PushBits again.
This commit is contained in:
eikendev 2021-02-08 00:34:33 +01:00
parent fb90808288
commit d7721e827b
No known key found for this signature in database
GPG key ID: A1BDB1B28C8EF694
8 changed files with 106 additions and 30 deletions

View file

@ -19,6 +19,9 @@ func successOrAbort(ctx *gin.Context, code int, err error) bool {
func isCurrentUser(ctx *gin.Context, ID uint) bool {
user := authentication.GetUser(ctx)
if user == nil {
return false
}
if user.ID != ID {
ctx.AbortWithError(http.StatusForbidden, errors.New("only owner can delete application"))