@@ -67,6 +67,7 @@ import { convertPeripheralDeviceForGateway } from '../publications/peripheralDev
6767import { executePeripheralDeviceFunction } from './peripheralDevice/executeFunction'
6868import KoaRouter from '@koa/router'
6969import bodyParser from 'koa-bodyparser'
70+ import { assertConnectionHasOneOfPermissions } from '../security/auth'
7071
7172const apmNamespace = 'peripheralDevice'
7273export namespace ServerPeripheralDeviceAPI {
@@ -513,12 +514,11 @@ export namespace ServerPeripheralDeviceAPI {
513514 } ,
514515 } )
515516 }
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` )
522522
523523 logger . info ( `Removing PeripheralDevice ${ peripheralDevice . _id } ` )
524524
@@ -850,8 +850,8 @@ class ServerPeripheralDeviceAPIClass extends MethodContextAPI implements NewPeri
850850 async testMethod ( deviceId : PeripheralDeviceId , deviceToken : string , returnValue : string , throwError ?: boolean ) {
851851 return ServerPeripheralDeviceAPI . testMethod ( this , deviceId , deviceToken , returnValue , throwError )
852852 }
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 )
855855 }
856856
857857 // ------ Playout Gateway --------
0 commit comments