wisski-cloud-distillery/internal/dis/component/auth/scopes/news.go
2023-05-04 15:13:51 +02:00

37 lines
724 B
Go

package scopes
import (
"net/http"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/auth"
)
type ListNewsScope struct {
component.Base
Dependencies struct {
Auth *auth.Auth
}
}
var (
_ component.ScopeProvider = (*ListNewsScope)(nil)
)
const (
ScopeListNews Scope = "news.list"
)
func (*ListNewsScope) Scope() component.ScopeInfo {
return component.ScopeInfo{
Scope: ScopeListNews,
Description: "list news items",
DeniedMessage: "",
TakesParam: false,
}
}
func (lns *ListNewsScope) HasScope(param string, r *http.Request) (bool, error) {
// TODO: at the moment everyone has this permission
return true, nil
}