Require access to Still via method
This commit adds a safeguard to accessing the still from a specific component by requiring access via the component.GetStill method.
This commit is contained in:
parent
81fa84c244
commit
8235ea9105
63 changed files with 288 additions and 197 deletions
|
|
@ -10,13 +10,15 @@ import (
|
|||
// Locked checks if this WissKI is currently locked.
|
||||
// If an error occurs, the instance is considered not locked.
|
||||
func (lock *Locker) Locked(ctx context.Context) (locked bool) {
|
||||
table, err := lock.Malt.SQL.QueryTable(ctx, lock.Malt.LockTable)
|
||||
liquid := ingredient.GetLiquid(lock)
|
||||
|
||||
table, err := liquid.SQL.QueryTable(ctx, liquid.LockTable)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// check if this instance is locked
|
||||
table.Select("count(*) > 0").Where("slug = ?", lock.Slug).Find(&locked)
|
||||
table.Select("count(*) > 0").Where("slug = ?", liquid.Slug).Find(&locked)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue