| 1 | package equipo |
| 2 | |
| 3 | import ( |
| 4 | "amadan.net/oficina/equipo/internal/equipo/library" |
| 5 | "gorm.io/gorm" |
| 6 | ) |
| 7 | |
| 8 | type SpecialistInput = library.SpecialistInput |
| 9 | type ModelRef = library.ModelRef |
| 10 | type TemplateRef = library.TemplateRef |
| 11 | type TemplateDiff = library.TemplateDiff |
| 12 | type PlaybookInput = library.PlaybookInput |
| 13 | type Playbook = library.Playbook |
| 14 | |
| 15 | func (s *Store) libraryAt(tx *gorm.DB) *library.Store { |
| 16 | return library.New(tx, library.Dependencies{ |
| 17 | Authorize: func(tx *gorm.DB, a Actor) (library.Access, error) { |
| 18 | m, err := currentRunnerMember(tx, a.Address) |
| 19 | if err != nil { |
| 20 | return library.Access{}, err |
| 21 | } |
| 22 | var t Team |
| 23 | err = tx.First(&t).Error |
| 24 | return library.Access{TeamID: t.ID, Owner: m.Role == RoleOwner}, err |
| 25 | }, |
| 26 | TaskAccess: func(tx *gorm.DB, a Actor, id int64) error { _, err := bugAuthority(tx, a, id); return err }, |
| 27 | Audit: appendAudit, Copy: copyText, Catalog: library.Catalog, |
| 28 | |
| 29 | Referenced: library.UnstartedReference, |
| 30 | Invalid: ErrInvalid, Forbidden: ErrForbidden, NotFound: ErrNotFound, Conflict: ErrConflict, |
| 31 | }) |
| 32 | } |
| 33 | |