Path: blob/master/src/packages/frontend/client/admin.ts
1503 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import type { WebappClient } from "./client";6import api from "./api";78export class AdminClient {9private client: WebappClient;1011constructor(client: WebappClient) {12this.client = client;13}1415public async admin_ban_user(16account_id: string,17ban: boolean = true, // if true, ban user -- if false, remove ban18): Promise<void> {19if (ban) {20await api("/accounts/ban", { account_id });21} else {22await api("/accounts/remove-ban", { account_id });23}24}2526public async get_user_auth_token(user_account_id: string): Promise<string> {27return await this.client.conat_client.hub.system.generateUserAuthToken({28user_account_id,29});30}31}323334