mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-10-09 16:25:40 +02:00
Always require a client for running a worker (#52)
* Always require a client for running a worker * Actually validate roles * Delete worker Fixes #46 * Update internal/worker/worker.go Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com> --------- Co-authored-by: Nikolay Edigaryev <edigaryev@gmail.com>
This commit is contained in:
co-authored by
Nikolay Edigaryev
parent
af074f499d
commit
362ea85b4f
@@ -26,6 +26,14 @@ func (controller *Controller) createServiceAccount(ctx *gin.Context) responder.R
|
||||
return responder.Code(http.StatusPreconditionFailed)
|
||||
}
|
||||
|
||||
// validate roles
|
||||
for _, role := range serviceAccount.Roles {
|
||||
_, err := v1.NewServiceAccountRole(string(role))
|
||||
if err != nil {
|
||||
return responder.Code(http.StatusPreconditionFailed)
|
||||
}
|
||||
}
|
||||
|
||||
if serviceAccount.Token == "" {
|
||||
serviceAccount.Token = uuid.New().String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user