zitadel/internal/protoc/protoc-gen-authoption/templates/auth_method_mapping.go.tmpl

33 lines
828 B
Cheetah
Raw Normal View History

2020-03-23 10:53:12 +00:00
// Code generated by protoc-gen-authmethod. DO NOT EDIT.
package {{.File.GoPkg.Name}}
import (
"google.golang.org/grpc"
"github.com/caos/zitadel/internal/api/authz"
2020-03-25 09:54:45 +00:00
"github.com/caos/zitadel/internal/api/grpc/server/middleware"
2020-03-23 10:53:12 +00:00
)
{{ range $s := .File.Services }}
/**
* {{$s.Name}}
*/
const {{$s.Name}}_MethodPrefix = "{{$.File.Package}}.{{$s.Name}}"
var {{$s.Name}}_AuthMethods = authz.MethodMapping {
2020-03-23 10:53:12 +00:00
{{ range $m := $s.Method}}
{{ $mAuthOpt := option $m.Options "caos.zitadel.utils.v1.auth_option" }}
{{ if and $mAuthOpt $mAuthOpt.Permission }}
"/{{$.File.Package}}.{{$s.Name}}/{{.Name}}": authz.Option{
2020-03-23 10:53:12 +00:00
Permission: "{{$mAuthOpt.Permission}}",
CheckParam: "{{$mAuthOpt.CheckFieldName}}",
},
{{end}}
{{ end}}
}
{{ end }}