-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Canonicalise the existence of the "admin room" for managing the appservice and Draupnir instances * Add utilities for managing users in the admin room * Merge the appservice admin room and access control list. The majority of admins will need to use the draupnir admin commands to manage the list. * Utility methods for creating generic rules in PolicyLists. * Commands for managing appservice users.
- Loading branch information
Showing
9 changed files
with
91 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Copyright (C) 2022 Gnuxie <[email protected]> | ||
* All rights reserved. | ||
*/ | ||
|
||
import { defineInterfaceCommand, findTableCommand } from "../../commands/interface-manager/InterfaceCommand"; | ||
import { findPresentationType, parameters, ParsedKeywords } from "../../commands/interface-manager/ParameterParsing"; | ||
import { CommandResult } from "../../commands/interface-manager/Validation"; | ||
import { AppserviceContext } from "./AppserviceCommandHandler"; | ||
import { UserID } from "matrix-bot-sdk"; | ||
import { defineMatrixInterfaceAdaptor } from "../../commands/interface-manager/MatrixInterfaceAdaptor"; | ||
import { tickCrossRenderer } from "../../commands/interface-manager/MatrixHelpRenderer"; | ||
|
||
defineInterfaceCommand({ | ||
designator: ["allow"], | ||
table: "appservice bot", | ||
parameters: parameters([ | ||
{ | ||
name: 'user', | ||
acceptor: findPresentationType('UserID'), | ||
} | ||
]), | ||
command: async function (this: AppserviceContext, _keywords: ParsedKeywords, user: UserID): Promise<CommandResult<void>> { | ||
await this.appservice.accessControl.allow(user.toString()); | ||
return CommandResult.Ok(undefined); | ||
}, | ||
summary: "Allow a user to provision themselves a draupnir using the appservice." | ||
}) | ||
|
||
defineMatrixInterfaceAdaptor({ | ||
interfaceCommand: findTableCommand("appservice bot", "allow"), | ||
renderer: tickCrossRenderer, | ||
}); | ||
|
||
defineInterfaceCommand({ | ||
designator: ["remove"], | ||
table: "appservice bot", | ||
parameters: parameters([ | ||
{ | ||
name: 'user', | ||
acceptor: findPresentationType('UserID'), | ||
} | ||
]), | ||
command: async function (this: AppserviceContext, _keywords: ParsedKeywords, user: UserID): Promise<CommandResult<void>> { | ||
await this.appservice.accessControl.remove(user.toString()); | ||
return CommandResult.Ok(undefined); | ||
}, | ||
summary: "Stop a user from using any provisioned draupnir in the appservice." | ||
}) | ||
|
||
defineMatrixInterfaceAdaptor({ | ||
interfaceCommand: findTableCommand("appservice bot", "remove"), | ||
renderer: tickCrossRenderer, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters