1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Removed REVIVE_FEATURE permission in favor of UPDATE_FEATURE

This commit is contained in:
Benjamin Ludewig 2018-12-19 12:22:48 +01:00 committed by Ivar Conradi Østhus
parent df7509e381
commit e81f4a01eb
3 changed files with 5 additions and 7 deletions

View File

@ -1,7 +1,6 @@
'use strict'; 'use strict';
const ADMIN = 'ADMIN'; const ADMIN = 'ADMIN';
const REVIVE_FEATURE = 'REVIVE_FEATURE';
const CREATE_FEATURE = 'CREATE_FEATURE'; const CREATE_FEATURE = 'CREATE_FEATURE';
const UPDATE_FEATURE = 'UPDATE_FEATURE'; const UPDATE_FEATURE = 'UPDATE_FEATURE';
const DELETE_FEATURE = 'DELETE_FEATURE'; const DELETE_FEATURE = 'DELETE_FEATURE';
@ -34,7 +33,6 @@ function requirePerms(prms) {
module.exports = { module.exports = {
requirePerms, requirePerms,
ADMIN, ADMIN,
REVIVE_FEATURE,
CREATE_FEATURE, CREATE_FEATURE,
UPDATE_FEATURE, UPDATE_FEATURE,
DELETE_FEATURE, DELETE_FEATURE,

View File

@ -5,7 +5,7 @@ const Controller = require('../controller');
const logger = require('../../logger')('/admin-api/archive.js'); const logger = require('../../logger')('/admin-api/archive.js');
const { FEATURE_REVIVED } = require('../../event-type'); const { FEATURE_REVIVED } = require('../../event-type');
const extractUser = require('../../extract-user'); const extractUser = require('../../extract-user');
const { REVIVE_FEATURE } = require('../../permissions'); const { UPDATE_FEATURE } = require('../../permissions');
class ArchiveController extends Controller { class ArchiveController extends Controller {
constructor(extendedPerms, { featureToggleStore, eventStore }) { constructor(extendedPerms, { featureToggleStore, eventStore }) {
@ -14,7 +14,7 @@ class ArchiveController extends Controller {
this.eventStore = eventStore; this.eventStore = eventStore;
this.get('/features', this.getArchivedFeatures); 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) { async getArchivedFeatures(req, res) {

View File

@ -5,7 +5,7 @@ const store = require('./../../../test/fixtures/store');
const permissions = require('../../../test/fixtures/permissions'); const permissions = require('../../../test/fixtures/permissions');
const supertest = require('supertest'); const supertest = require('supertest');
const getApp = require('../../app'); const getApp = require('../../app');
const { REVIVE_FEATURE } = require('../../permissions'); const { UPDATE_FEATURE } = require('../../permissions');
const { EventEmitter } = require('events'); const { EventEmitter } = require('events');
const eventBus = new EventEmitter(); const eventBus = new EventEmitter();
@ -67,7 +67,7 @@ test('should revive toggle', t => {
t.plan(0); t.plan(0);
const name = 'name1'; const name = 'name1';
const { request, base, archiveStore, perms } = getSetup(); const { request, base, archiveStore, perms } = getSetup();
perms.withPerms(REVIVE_FEATURE); perms.withPerms(UPDATE_FEATURE);
archiveStore.addArchivedFeature({ archiveStore.addArchivedFeature({
name, name,
strategies: [{ name: 'default' }], strategies: [{ name: 'default' }],
@ -80,7 +80,7 @@ test('should create event when reviving toggle', async t => {
t.plan(4); t.plan(4);
const name = 'name1'; const name = 'name1';
const { request, base, archiveStore, eventStore, perms } = getSetup(); const { request, base, archiveStore, eventStore, perms } = getSetup();
perms.withPerms(REVIVE_FEATURE); perms.withPerms(UPDATE_FEATURE);
archiveStore.addArchivedFeature({ archiveStore.addArchivedFeature({
name, name,
strategies: [{ name: 'default' }], strategies: [{ name: 'default' }],