18559: Add read only fields to user service
[arvados-workbench2.git] / src / services / user-service / user-service.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { AxiosInstance } from "axios";
6 import { CommonResourceService } from "services/common-service/common-resource-service";
7 import { UserResource } from "models/user";
8 import { ApiActions } from "services/api/api-actions";
9
10 export class UserService extends CommonResourceService<UserResource> {
11     constructor(serverApi: AxiosInstance, actions: ApiActions, readOnlyFields: string[] = []) {
12         super(serverApi, "users", actions, readOnlyFields.concat([
13             'fullName',
14             'isInvited',
15             'writableBy',
16         ]));
17     }
18
19     activate(uuid: string) {
20         return CommonResourceService.defaultResponse(
21             this.serverApi
22                 .post(this.resourceType + `/${uuid}/activate`),
23             this.actions
24         );
25     }
26
27     unsetup(uuid: string) {
28         return CommonResourceService.defaultResponse(
29             this.serverApi
30                 .post(this.resourceType + `/${uuid}/unsetup`),
31             this.actions
32         );
33     }
34 }