mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Add support for API permission expiry
This commit is contained in:
parent
2b8f75b91b
commit
947a49761e
5 changed files with 42 additions and 0 deletions
|
@ -55,4 +55,12 @@ export class ApiPermissionAssignments extends BaseRepository {
|
|||
removeUser(guildId, userId) {
|
||||
return this.apiPermissions.delete({ guild_id: guildId, type: ApiPermissionTypes.User, target_id: userId });
|
||||
}
|
||||
|
||||
async clearExpiredPermissions() {
|
||||
await this.apiPermissions
|
||||
.createQueryBuilder()
|
||||
.where("expires_at IS NOT NULL")
|
||||
.andWhere("expires_at <= NOW()")
|
||||
.delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,9 @@ export class ApiPermissionAssignment {
|
|||
@Column("simple-array")
|
||||
permissions: string[];
|
||||
|
||||
@Column()
|
||||
expires_at: string;
|
||||
|
||||
@ManyToOne(
|
||||
type => ApiUserInfo,
|
||||
userInfo => userInfo.permissionAssignments,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue