@@ -67,6 +67,7 @@ import { convertPeripheralDeviceForGateway } from '../publications/peripheralDev
67
67
import { executePeripheralDeviceFunction } from './peripheralDevice/executeFunction'
68
68
import KoaRouter from '@koa/router'
69
69
import bodyParser from 'koa-bodyparser'
70
+ import { assertConnectionHasOneOfPermissions } from '../security/auth'
70
71
71
72
const apmNamespace = 'peripheralDevice'
72
73
export namespace ServerPeripheralDeviceAPI {
@@ -513,12 +514,11 @@ export namespace ServerPeripheralDeviceAPI {
513
514
} ,
514
515
} )
515
516
}
516
- export async function removePeripheralDevice (
517
- context : MethodContext ,
518
- deviceId : PeripheralDeviceId ,
519
- token ?: string
520
- ) : Promise < void > {
521
- const peripheralDevice = await checkAccessAndGetPeripheralDevice ( deviceId , token , context )
517
+ export async function removePeripheralDevice ( context : MethodContext , deviceId : PeripheralDeviceId ) : Promise < void > {
518
+ assertConnectionHasOneOfPermissions ( context . connection , 'configure' )
519
+
520
+ const peripheralDevice = await PeripheralDevices . findOneAsync ( deviceId )
521
+ if ( ! peripheralDevice ) throw new Meteor . Error ( 404 , `PeripheralDevice "${ deviceId } " not found` )
522
522
523
523
logger . info ( `Removing PeripheralDevice ${ peripheralDevice . _id } ` )
524
524
@@ -850,8 +850,8 @@ class ServerPeripheralDeviceAPIClass extends MethodContextAPI implements NewPeri
850
850
async testMethod ( deviceId : PeripheralDeviceId , deviceToken : string , returnValue : string , throwError ?: boolean ) {
851
851
return ServerPeripheralDeviceAPI . testMethod ( this , deviceId , deviceToken , returnValue , throwError )
852
852
}
853
- async removePeripheralDevice ( deviceId : PeripheralDeviceId , token ?: string ) {
854
- return ServerPeripheralDeviceAPI . removePeripheralDevice ( this , deviceId , token )
853
+ async removePeripheralDevice ( deviceId : PeripheralDeviceId ) {
854
+ return ServerPeripheralDeviceAPI . removePeripheralDevice ( this , deviceId )
855
855
}
856
856
857
857
// ------ Playout Gateway --------
0 commit comments