Restore settings preferences and simplify services editor
This commit is contained in:
@@ -69,13 +69,13 @@ describe('panel api', () => {
|
||||
expect(typeof response.body.expiresAt).toBe('string');
|
||||
});
|
||||
|
||||
it('rejects user creation against a non-assignable service', async () => {
|
||||
it('rejects user creation against a disabled service', async () => {
|
||||
const app = await createTestApp();
|
||||
const token = await authorize(app);
|
||||
const response = await request(app).post('/api/users').set('Authorization', `Bearer ${token}`).send({
|
||||
username: 'bad-admin-user',
|
||||
username: 'bad-proxy-user',
|
||||
password: 'secret123',
|
||||
serviceId: 'admin',
|
||||
serviceId: 'proxy',
|
||||
quotaMb: 100,
|
||||
});
|
||||
|
||||
@@ -132,6 +132,26 @@ describe('panel api', () => {
|
||||
expect(response.body.error).toMatch(/night-shift/i);
|
||||
});
|
||||
|
||||
it('removes linked users when a service is deleted from settings', async () => {
|
||||
const app = await createTestApp();
|
||||
const token = await authorize(app);
|
||||
const initial = await request(app).get('/api/state').set('Authorization', `Bearer ${token}`);
|
||||
const system = createSystemPayload(initial.body);
|
||||
|
||||
system.services = system.services.filter((service) => service.id !== 'socks-main');
|
||||
|
||||
const response = await request(app).put('/api/system').set('Authorization', `Bearer ${token}`).send(system);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.body.userRecords.some((entry: { username: string }) => entry.username === 'night-shift')).toBe(
|
||||
false,
|
||||
);
|
||||
expect(response.body.userRecords.some((entry: { username: string }) => entry.username === 'ops-east')).toBe(
|
||||
false,
|
||||
);
|
||||
expect(response.body.service.lastEvent).toMatch(/removed 2 linked users/i);
|
||||
});
|
||||
|
||||
it('updates system settings and regenerates the rendered config', async () => {
|
||||
const app = await createTestApp();
|
||||
const token = await authorize(app);
|
||||
|
||||
Reference in New Issue
Block a user