2025-01-06 13:18:31 +00:00
|
|
|
package handlers
|
2023-03-14 15:22:52 +00:00
|
|
|
|
|
|
|
import (
|
2024-12-03 01:18:04 +00:00
|
|
|
"github.com/thomiceli/opengist/internal/web/context"
|
2023-03-14 15:22:52 +00:00
|
|
|
)
|
|
|
|
|
2024-05-12 21:40:11 +00:00
|
|
|
type ContextAuthInfo struct {
|
2025-01-06 13:18:31 +00:00
|
|
|
Context *context.Context
|
2024-05-12 21:40:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (auth ContextAuthInfo) RequireLogin() (bool, error) {
|
2024-12-29 10:40:23 +00:00
|
|
|
return auth.Context.GetData("RequireLogin") == true, nil
|
2024-05-12 21:40:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (auth ContextAuthInfo) AllowGistsWithoutLogin() (bool, error) {
|
2024-12-29 10:40:23 +00:00
|
|
|
return auth.Context.GetData("AllowGistsWithoutLogin") == true, nil
|
2024-05-12 21:40:11 +00:00
|
|
|
}
|