satellite/admin: add UI functionality to update user's or project's user agent

Implemented UI functionality to allow prod owner to update user's or project's user agent.

Issue:
https://github.com/storj/storj-private/issues/297

Change-Id: Ibe47e735f3c7a9fdf05b70735ebcecbac5c94ce8
This commit is contained in:
Vitalii 2023-06-14 16:48:29 +03:00 committed by Storj Robot
parent 1eee2fad69
commit eb636f5b57

View File

@ -204,6 +204,19 @@ export class Admin {
}) as Promise<null>;
}
},
{
name: 'update user agent',
desc: 'Update projects user agent',
params: [
['Project ID', new InputText('text', true)],
['User Agent', new InputText('text', true)]
],
func: async (projectId: string, userAgent: string): Promise<null> => {
return this.fetch('PATCH', `projects/${projectId}/useragent`, null, {
userAgent
}) as Promise<null>;
}
},
{
name: 'create API key',
desc: 'Create a new API key for a specific project',
@ -415,6 +428,19 @@ Blank fields will not be updated.`,
}) as Promise<null>;
}
},
{
name: 'update user agent',
desc: `Update user's user agent.`,
params: [
["current user's email", new InputText('email', true)],
['user agent', new InputText('text', true)]
],
func: async (currentEmail: string, userAgent: string): Promise<null> => {
return this.fetch('PATCH', `users/${currentEmail}/useragent`, null, {
userAgent
}) as Promise<null>;
}
},
{
name: 'disable MFA',
desc: "Disable user's mulifactor authentication",
@ -472,7 +498,7 @@ Blank fields will not be updated.`,
}
protected async fetch(
method: 'DELETE' | 'GET' | 'POST' | 'PUT',
method: 'DELETE' | 'GET' | 'POST' | 'PUT' | 'PATCH',
path: string,
query?: string,
data?: Record<string, unknown>