mirror of
https://github.com/thomiceli/opengist.git
synced 2025-07-10 01:48:02 +02:00
Refactor server code (#407)
This commit is contained in:
17
internal/web/handlers/auth.go
Normal file
17
internal/web/handlers/auth.go
Normal file
@ -0,0 +1,17 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"github.com/thomiceli/opengist/internal/web/context"
|
||||
)
|
||||
|
||||
type ContextAuthInfo struct {
|
||||
Context *context.Context
|
||||
}
|
||||
|
||||
func (auth ContextAuthInfo) RequireLogin() (bool, error) {
|
||||
return auth.Context.GetData("RequireLogin") == true, nil
|
||||
}
|
||||
|
||||
func (auth ContextAuthInfo) AllowGistsWithoutLogin() (bool, error) {
|
||||
return auth.Context.GetData("AllowGistsWithoutLogin") == true, nil
|
||||
}
|
Reference in New Issue
Block a user