|
|
@ -330,6 +330,18 @@ class OAuth2Service extends SiteService {
|
|
|
|
return clients;
|
|
|
|
return clients;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async getRandomClients (maxCount) {
|
|
|
|
|
|
|
|
const clients = await OAuth2Client.aggregate([
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$match: { 'flags.isActive': true },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$sample: { size: maxCount },
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
return clients;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async getClientById (clientId) {
|
|
|
|
async getClientById (clientId) {
|
|
|
|
const client = await OAuth2Client
|
|
|
|
const client = await OAuth2Client
|
|
|
|
.findOne({ _id: clientId })
|
|
|
|
.findOne({ _id: clientId })
|
|
|
|