mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
feat(admin)!: move the admin api to rest and fix its defects (#2515)
This commit is contained in:
1 parent
a70924d4b0
commit
7f8f09ee51
143 files changed
+15238
-12790
No files matched your search
@@ -95,8 +95,8 @@ describe('Auth session cache invalidation', () => {
|
||||
expect(await readCachedSession(harness, token)).not.toBeNull();
|
||||
}
|
||||
await createBuilder(harness, admin.token)
|
||||
.post('/admin/users/temp-ban')
|
||||
.body({user_id: target.userId, duration_hours: 24, reason: 'cache invalidation coverage'})
|
||||
.put(`/admin/users/${target.userId}/ban`)
|
||||
.body({duration_hours: 24, reason: 'cache invalidation coverage'})
|
||||
.execute();
|
||||
for (const token of [target.token, targetSecond.token]) {
|
||||
expect(await readCachedSession(harness, token)).toBeNull();
|
||||
|
||||
@@ -336,12 +336,12 @@ export async function enableSso(
|
||||
redirect_uri: '',
|
||||
...overrides,
|
||||
};
|
||||
await createBuilder(harness, token).post('/admin/instance-config/update').body({sso: ssoConfig}).execute();
|
||||
await createBuilder(harness, token).patch('/admin/instance/config').body({sso: ssoConfig}).execute();
|
||||
}
|
||||
|
||||
export async function disableSso(harness: ApiTestHarness, token: string): Promise<void> {
|
||||
await createBuilder(harness, token)
|
||||
.post('/admin/instance-config/update')
|
||||
.patch('/admin/instance/config')
|
||||
.body({
|
||||
sso: {
|
||||
enabled: false,
|
||||
|
||||
@@ -128,7 +128,7 @@ describe('Auth registration', () => {
|
||||
await instanceConfigRepository.markAdminBootstrapped();
|
||||
const account = await registerUser(harness, bootstrapRegistrationBody('stalesetupmarker'));
|
||||
await expectUserACLs(account.user_id, []);
|
||||
await createBuilder(harness, account.token).post('/admin/instance-config/get').body({}).execute();
|
||||
await createBuilder(harness, account.token).get('/admin/instance/config').execute();
|
||||
});
|
||||
});
|
||||
it('repairs setup completer admin ACL when bootstrap marker is stale', async () => {
|
||||
@@ -140,12 +140,12 @@ describe('Auth registration', () => {
|
||||
await expectUserACLs(account.user_id, []);
|
||||
|
||||
await createBuilder(harness, account.token)
|
||||
.post('/admin/instance-config/update')
|
||||
.patch('/admin/instance/config')
|
||||
.body({app_public: {setup: {configured: true}}})
|
||||
.execute();
|
||||
|
||||
await expectUserACLs(account.user_id, [AdminACLs.WILDCARD]);
|
||||
await createBuilder(harness, account.token).post('/admin/instance-config/get').body({}).execute();
|
||||
await createBuilder(harness, account.token).get('/admin/instance/config').execute();
|
||||
});
|
||||
});
|
||||
it('allows emoji global name', async () => {
|
||||
|
||||
@@ -90,7 +90,7 @@ describe('Auth SSO flow', () => {
|
||||
});
|
||||
it('rejects enforced SSO config that cannot resolve claims', async () => {
|
||||
await createBuilder(harness, admin.token)
|
||||
.post('/admin/instance-config/update')
|
||||
.patch('/admin/instance/config')
|
||||
.body({
|
||||
sso: {
|
||||
enabled: true,
|
||||
@@ -458,7 +458,7 @@ describe('Auth SSO flow', () => {
|
||||
});
|
||||
it('rejects invalid allowed domains during config update', async () => {
|
||||
await createBuilder(harness, admin.token)
|
||||
.post('/admin/instance-config/update')
|
||||
.patch('/admin/instance/config')
|
||||
.body({
|
||||
sso: {
|
||||
enabled: true,
|
||||
@@ -477,7 +477,7 @@ describe('Auth SSO flow', () => {
|
||||
});
|
||||
it('rejects unsafe provider URLs during config update', async () => {
|
||||
await createBuilder(harness, admin.token)
|
||||
.post('/admin/instance-config/update')
|
||||
.patch('/admin/instance/config')
|
||||
.body({
|
||||
sso: {
|
||||
enabled: true,
|
||||
@@ -504,8 +504,7 @@ describe('Auth SSO flow', () => {
|
||||
allowed_domains: Array<string>;
|
||||
};
|
||||
}>(harness, admin.token)
|
||||
.post('/admin/instance-config/get')
|
||||
.body({})
|
||||
.get('/admin/instance/config')
|
||||
.execute();
|
||||
expect(config.sso.allowed_domains).toEqual(['example.com', 'xn--bcher-kva.example']);
|
||||
});
|
||||
@@ -715,7 +714,7 @@ describe('Auth SSO flow', () => {
|
||||
});
|
||||
it('does not advertise enabled SSO when optional SSO cannot resolve claims', async () => {
|
||||
await createBuilder(harness, admin.token)
|
||||
.post('/admin/instance-config/update')
|
||||
.patch('/admin/instance/config')
|
||||
.body({
|
||||
sso: {
|
||||
enabled: true,
|
||||
|
||||
Reference in new issue
Block a user