X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f63f3a5360ae6381d4b332bf86ef52b4e22107fb..41f6f1e495c82fcfa79b87cf718fa2e9cd91c726:/src/services/user-service/user-service.ts diff --git a/src/services/user-service/user-service.ts b/src/services/user-service/user-service.ts index 3c09a87d..8581b267 100644 --- a/src/services/user-service/user-service.ts +++ b/src/services/user-service/user-service.ts @@ -3,11 +3,41 @@ // SPDX-License-Identifier: AGPL-3.0 import { AxiosInstance } from "axios"; -import { CommonResourceService } from "~/common/api/common-resource-service"; -import { UserResource } from "~/models/user"; +import { CommonResourceService } from "services/common-service/common-resource-service"; +import { UserResource } from "models/user"; +import { ApiActions } from "services/api/api-actions"; +import { ListResults } from "services/common-service/common-service"; export class UserService extends CommonResourceService { - constructor(serverApi: AxiosInstance) { - super(serverApi, "users"); + constructor(serverApi: AxiosInstance, actions: ApiActions, readOnlyFields: string[] = []) { + super(serverApi, "users", actions, readOnlyFields.concat([ + 'fullName', + 'isInvited', + 'writableBy', + ])); } -} \ No newline at end of file + + activate(uuid: string) { + return CommonResourceService.defaultResponse( + this.serverApi + .post(this.resourceType + `/${uuid}/activate`), + this.actions + ); + } + + setup(uuid: string) { + return CommonResourceService.defaultResponse>( + this.serverApi + .post(this.resourceType + `/setup`, {}, { params: { uuid } }), + this.actions + ); + } + + unsetup(uuid: string) { + return CommonResourceService.defaultResponse( + this.serverApi + .post(this.resourceType + `/${uuid}/unsetup`), + this.actions + ); + } +}