From e81f4a01eb9c9a8a4f551fa91d6f95936f0c2683 Mon Sep 17 00:00:00 2001 From: Benjamin Ludewig Date: Wed, 19 Dec 2018 12:22:48 +0100 Subject: [PATCH] Removed REVIVE_FEATURE permission in favor of UPDATE_FEATURE --- lib/permissions.js | 2 -- lib/routes/admin-api/archive.js | 4 ++-- lib/routes/admin-api/archive.test.js | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/permissions.js b/lib/permissions.js index a8fc39ad4b..18f4aba937 100644 --- a/lib/permissions.js +++ b/lib/permissions.js @@ -1,7 +1,6 @@ 'use strict'; const ADMIN = 'ADMIN'; -const REVIVE_FEATURE = 'REVIVE_FEATURE'; const CREATE_FEATURE = 'CREATE_FEATURE'; const UPDATE_FEATURE = 'UPDATE_FEATURE'; const DELETE_FEATURE = 'DELETE_FEATURE'; @@ -34,7 +33,6 @@ function requirePerms(prms) { module.exports = { requirePerms, ADMIN, - REVIVE_FEATURE, CREATE_FEATURE, UPDATE_FEATURE, DELETE_FEATURE, diff --git a/lib/routes/admin-api/archive.js b/lib/routes/admin-api/archive.js index 4bab99547a..138d4ef0b3 100644 --- a/lib/routes/admin-api/archive.js +++ b/lib/routes/admin-api/archive.js @@ -5,7 +5,7 @@ const Controller = require('../controller'); const logger = require('../../logger')('/admin-api/archive.js'); const { FEATURE_REVIVED } = require('../../event-type'); const extractUser = require('../../extract-user'); -const { REVIVE_FEATURE } = require('../../permissions'); +const { UPDATE_FEATURE } = require('../../permissions'); class ArchiveController extends Controller { constructor(extendedPerms, { featureToggleStore, eventStore }) { @@ -14,7 +14,7 @@ class ArchiveController extends Controller { this.eventStore = eventStore; this.get('/features', this.getArchivedFeatures); - this.post('/revive/:name', this.reviveFeatureToggle, REVIVE_FEATURE); + this.post('/revive/:name', this.reviveFeatureToggle, UPDATE_FEATURE); } async getArchivedFeatures(req, res) { diff --git a/lib/routes/admin-api/archive.test.js b/lib/routes/admin-api/archive.test.js index d625b83f43..11c030b389 100644 --- a/lib/routes/admin-api/archive.test.js +++ b/lib/routes/admin-api/archive.test.js @@ -5,7 +5,7 @@ const store = require('./../../../test/fixtures/store'); const permissions = require('../../../test/fixtures/permissions'); const supertest = require('supertest'); const getApp = require('../../app'); -const { REVIVE_FEATURE } = require('../../permissions'); +const { UPDATE_FEATURE } = require('../../permissions'); const { EventEmitter } = require('events'); const eventBus = new EventEmitter(); @@ -67,7 +67,7 @@ test('should revive toggle', t => { t.plan(0); const name = 'name1'; const { request, base, archiveStore, perms } = getSetup(); - perms.withPerms(REVIVE_FEATURE); + perms.withPerms(UPDATE_FEATURE); archiveStore.addArchivedFeature({ name, strategies: [{ name: 'default' }], @@ -80,7 +80,7 @@ test('should create event when reviving toggle', async t => { t.plan(4); const name = 'name1'; const { request, base, archiveStore, eventStore, perms } = getSetup(); - perms.withPerms(REVIVE_FEATURE); + perms.withPerms(UPDATE_FEATURE); archiveStore.addArchivedFeature({ name, strategies: [{ name: 'default' }],