cloudapi: add EnsureJobChannel() middleware to verify job channel
Add `EnsureJobChannel()` middleware method, intended for `compose/<id>` endpoints. Its purpose is to ensure that the tenant channel set in the request `echo.Context` matches the tenant channel associated with the compose. In case of mismatch, `404` is returned. Add `JobChannel()` method to the worker server implementation for requesting channel associated with the job.
This commit is contained in:
parent
c5e1c15cca
commit
fc7d090498
2 changed files with 37 additions and 0 deletions
|
|
@ -410,6 +410,11 @@ func (s *Server) OSBuildKojiJob(id uuid.UUID, job *OSBuildKojiJob) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) JobChannel(id uuid.UUID) (string, error) {
|
||||
_, _, _, channel, err := s.jobs.Job(id)
|
||||
return channel, err
|
||||
}
|
||||
|
||||
// JobType returns the type of the job
|
||||
func (s *Server) JobType(id uuid.UUID) (string, error) {
|
||||
jobType, _, _, _, err := s.jobs.Job(id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue