3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-18 23:55:02 +00:00

Dashboard styling; don't allow login if you have no guild perms; allow logging out

This commit is contained in:
Dragory 2019-07-22 00:11:24 +03:00
parent 16a5b5c13a
commit d7a21facdc
9 changed files with 132 additions and 35 deletions

View file

@ -75,4 +75,16 @@ export class ApiLogins extends BaseRepository {
return `${loginId}.${token}`;
}
expireApiKey(apiKey) {
const [loginId, token] = apiKey.split(".");
if (!loginId || !token) return;
return this.apiLogins.update(
{ id: loginId },
{
expires_at: moment().format(DBDateFormat),
},
);
}
}

View file

@ -10,6 +10,14 @@ export class ApiPermissions extends BaseRepository {
this.apiPermissions = getRepository(ApiPermission);
}
getByUserId(userId) {
return this.apiPermissions.find({
where: {
user_id: userId,
},
});
}
getByGuildAndUserId(guildId, userId) {
return this.apiPermissions.findOne({
where: {