1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-24 01:18:01 +02:00

feat: global events requires admin role

This commit is contained in:
Ivar Conradi Østhus 2021-05-04 22:11:30 +02:00
parent 28b186150d
commit 01ab4e1604
No known key found for this signature in database
GPG Key ID: 31AC596886B0BD09
3 changed files with 4 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import { handleErrors } from './util';
import { IUnleashConfig } from '../../types/option'; import { IUnleashConfig } from '../../types/option';
import { IUnleashServices } from '../../types/services'; import { IUnleashServices } from '../../types/services';
import EventService from '../../services/event-service'; import EventService from '../../services/event-service';
import { ADMIN } from '../../types/permissions';
const Controller = require('../controller'); const Controller = require('../controller');
@ -20,7 +21,7 @@ export default class EventController extends Controller {
) { ) {
super(config); super(config);
this.eventService = eventService; this.eventService = eventService;
this.get('/', this.getEvents); this.get('/', this.getEvents, ADMIN);
this.get('/:name', this.getEventsForToggle); this.get('/:name', this.getEventsForToggle);
} }

View File

@ -35,7 +35,7 @@ test.serial('creates new feature toggle with createdBy', async t => {
}) })
.expect(201); .expect(201);
await request.get('/api/admin/events').expect(res => { await request.get('/api/admin/events/com.test.Username').expect(res => {
t.is(res.body.events[0].createdBy, 'user@mail.com'); t.is(res.body.events[0].createdBy, 'user@mail.com');
}); });
}); });

View File

@ -61,7 +61,7 @@ test.serial('creates new feature toggle with createdBy', async t => {
}) })
.expect(201); .expect(201);
await request.get('/api/admin/events').expect(res => { await request.get('/api/admin/events/com.test.Username').expect(res => {
t.is(res.body.events[0].createdBy, email); t.is(res.body.events[0].createdBy, email);
}); });
}); });