feature: dynamic scope using input arguments #23

Merged
xdrm-brackets merged 4 commits from feature/dynamic-scope into 0.3.0 2021-05-19 12:06:20 +00:00
1 changed files with 5 additions and 7 deletions
Showing only changes of commit 2a17ba2f72 - Show all commits

View File

@ -59,16 +59,14 @@ func (s Handler) resolve(w http.ResponseWriter, r *http.Request) {
for b, perm := range list { for b, perm := range list {
scope[a][b] = perm scope[a][b] = perm
for name, value := range input.Data { for name, value := range input.Data {
if stringer, ok := value.(fmt.Stringer); ok {
scope[a][b] = strings.ReplaceAll( scope[a][b] = strings.ReplaceAll(
scope[a][b], scope[a][b],
fmt.Sprintf("[%s]", name), fmt.Sprintf("[%s]", name),
fmt.Sprintf("[%s]", stringer), fmt.Sprintf("[%v]", value),
) )
} }
} }
} }
}
var auth = api.Auth{ var auth = api.Auth{
Required: scope, Required: scope,