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

38 lines
830 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 ListInstancesScope struct {
component.Base
Dependencies struct {
Auth *auth.Auth
}
}
var (
_ component.ScopeProvider = (*ListInstancesScope)(nil)
)
const (
ScopeInstanceDirectory Scope = "instances.directory"
)
func (*ListInstancesScope) Scope() component.ScopeInfo {
return component.ScopeInfo{
Scope: ScopeInstanceDirectory,
Description: "get a public directory of instances",
DeniedMessage: "",
TakesParam: false,
}
}
func (lis *ListInstancesScope) HasScope(param string, r *http.Request) (bool, error) {
// TODO: at the moment everyone has this permission
// this should change in the future!
return true, nil
}