mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 06:53:20 +02:00
fix bug on taking control of a device: set a lock for exclusive access (#650)
* fix bug on taking control of a device: set a lock for exclusive access Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * update the locking function Signed-off-by: Denis barbaron <denis.barbaron@orange.com> --------- Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright © 2019 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
* Copyright © 2019,2023 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
const apiutil = require('./apiutil')
|
||||
@@ -60,7 +60,9 @@ lockutil.unlockGroupAndDevice = function(lock) {
|
||||
}
|
||||
|
||||
lockutil.lockGenericDevice = function(req, res, lock, lockDevice) {
|
||||
return lockDevice(req.user.groups.subscribed, req.swagger.params.serial.value)
|
||||
return lockDevice(req.user.groups.subscribed,
|
||||
req.hasOwnProperty('body') ? req.body.serial : req.swagger.params.serial.value)
|
||||
|
||||
.then(function(stats) {
|
||||
return apiutil.computeStats(res, stats, 'device', lock)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user