diff --git a/forge/routes/api/device.js b/forge/routes/api/device.js index 550fff523f..e90e183714 100644 --- a/forge/routes/api/device.js +++ b/forge/routes/api/device.js @@ -768,7 +768,7 @@ module.exports = async function (app) { * @memberof module:forge/routes/api/device */ app.put('/:deviceId/mode', { - preHandler: app.needsPermission('device:edit'), + preHandler: app.needsPermission('device:editor'), schema: { summary: 'Set device mode', tags: ['Devices'], diff --git a/frontend/src/pages/device/index.vue b/frontend/src/pages/device/index.vue index 6b4f50f21e..330c1627fe 100644 --- a/frontend/src/pages/device/index.vue +++ b/frontend/src/pages/device/index.vue @@ -185,8 +185,8 @@ export default { isVisitingAdmin: function () { return this.teamMembership.role === Roles.Admin }, - isOwner: function () { - return this.teamMembership.role === Roles.Owner + isMember: function () { + return this.teamMembership.role === Roles.Member || this.teamMembership.role === Roles.Owner }, isDevModeAvailable: function () { return !!this.features.deviceEditor @@ -201,7 +201,7 @@ export default { return !this.isDevModeAvailable || !this.device || !this.agentSupportsDeviceAccess || - !this.isOwner + !this.isMember }, disableModeToggleReason: function () { if (!this.device) { @@ -210,8 +210,8 @@ export default { if (!this.agentSupportsDeviceAccess) { return 'Device Agent V0.8 or greater is required' } - if (!this.isOwner) { - return 'Only an owner can change the Device Mode' + if (!this.isMember) { + return 'Only an Owner or Member can change the Device Mode' } return undefined }, diff --git a/test/unit/forge/routes/api/device_spec.js b/test/unit/forge/routes/api/device_spec.js index 7cd27357ad..f6d4bf22a1 100644 --- a/test/unit/forge/routes/api/device_spec.js +++ b/test/unit/forge/routes/api/device_spec.js @@ -1284,7 +1284,7 @@ describe('Device API', async function () { settings.should.have.property('mode', 'developer') settings.should.have.property('editor') }) - it('team member can not set device to developer mode', async function () { + it('team member can set device to developer mode', async function () { const device = await createDevice({ name: 'Ad1', type: '', team: TestObjects.ATeam.hashid, as: TestObjects.tokens.alice }) const response = await app.inject({ method: 'PUT', @@ -1294,7 +1294,7 @@ describe('Device API', async function () { }, cookies: { sid: TestObjects.tokens.chris } }) - response.statusCode.should.equal(403) + response.statusCode.should.equal(200) }) }) })