mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-27 00:19:39 +01:00
feat: global events requires admin role
This commit is contained in:
parent
28b186150d
commit
01ab4e1604
@ -4,6 +4,7 @@ import { handleErrors } from './util';
|
||||
import { IUnleashConfig } from '../../types/option';
|
||||
import { IUnleashServices } from '../../types/services';
|
||||
import EventService from '../../services/event-service';
|
||||
import { ADMIN } from '../../types/permissions';
|
||||
|
||||
const Controller = require('../controller');
|
||||
|
||||
@ -20,7 +21,7 @@ export default class EventController extends Controller {
|
||||
) {
|
||||
super(config);
|
||||
this.eventService = eventService;
|
||||
this.get('/', this.getEvents);
|
||||
this.get('/', this.getEvents, ADMIN);
|
||||
this.get('/:name', this.getEventsForToggle);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ test.serial('creates new feature toggle with createdBy', async t => {
|
||||
})
|
||||
.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');
|
||||
});
|
||||
});
|
||||
|
@ -61,7 +61,7 @@ test.serial('creates new feature toggle with createdBy', async t => {
|
||||
})
|
||||
.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);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user