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:
parent
28b186150d
commit
01ab4e1604
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user