Make requests read only when account disabled
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -37,6 +37,12 @@ func UserSession(authService *authz.Service) gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
// If the request is not GET and disabled, deny it
|
||||
if ctx.Request.Method != "GET" && !user.Active {
|
||||
ctx.JSON(http.StatusForbidden, gin.H{"error": "User is disabled"})
|
||||
ctx.Abort()
|
||||
}
|
||||
|
||||
// Get user session
|
||||
userSession, err := authService.GetUserAuthProfile(ctx, sessionId)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user