feat(web): Added admin user config to user settings (#15380)

* feat(web): Added admin user config to user settings

* feat (web) - cleaned up the files and added tests

* feat (web) - added missing files

* feat (web) - updated per review comments

* feat (web) - e2e admin command test failures
This commit is contained in:
nosajthenitram 2025-06-11 21:11:13 -05:00 committed by GitHub
parent 22eef5f3c5
commit e5219f1f31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 308 additions and 20 deletions

View file

@ -118,7 +118,7 @@ describe('/admin/users', () => {
});
}
it('should ignore `isAdmin`', async () => {
it('should accept `isAdmin`', async () => {
const { status, body } = await request(app)
.post(`/admin/users`)
.send({
@ -130,7 +130,7 @@ describe('/admin/users', () => {
.set('Authorization', `Bearer ${admin.accessToken}`);
expect(body).toMatchObject({
email: 'user5@immich.cloud',
isAdmin: false,
isAdmin: true,
shouldChangePassword: true,
});
expect(status).toBe(201);
@ -163,14 +163,15 @@ describe('/admin/users', () => {
});
}
it('should not allow a non-admin to become an admin', async () => {
it('should allow a non-admin to become an admin', async () => {
const user = await utils.userSetup(admin.accessToken, createUserDto.create('admin2'));
const { status, body } = await request(app)
.put(`/admin/users/${nonAdmin.userId}`)
.put(`/admin/users/${user.userId}`)
.send({ isAdmin: true })
.set('Authorization', `Bearer ${admin.accessToken}`);
expect(status).toBe(200);
expect(body).toMatchObject({ isAdmin: false });
expect(body).toMatchObject({ isAdmin: true });
});
it('ignores updates to profileImagePath', async () => {