mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: only allow record lookup for up to 10 weeks when allDomain enabled
This commit is contained in:
1 file changed
+2
-1
@@ -20,7 +20,7 @@ import user from '../model/user';
|
|||||||
import {
|
import {
|
||||||
ConnectionHandler, param, subscribe, Types,
|
ConnectionHandler, param, subscribe, Types,
|
||||||
} from '../service/server';
|
} from '../service/server';
|
||||||
import { buildProjection } from '../utils';
|
import { buildProjection, Time } from '../utils';
|
||||||
import { ContestDetailBaseHandler } from './contest';
|
import { ContestDetailBaseHandler } from './contest';
|
||||||
import { postJudge } from './judge';
|
import { postJudge } from './judge';
|
||||||
|
|
||||||
@@ -87,6 +87,7 @@ class RecordListHandler extends ContestDetailBaseHandler {
|
|||||||
if (allDomain) {
|
if (allDomain) {
|
||||||
this.checkPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN);
|
this.checkPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN);
|
||||||
delete q.contest;
|
delete q.contest;
|
||||||
|
q._id = { $gt: Time.getObjectID(new Date(Date.now() - 10 * Time.week)) };
|
||||||
}
|
}
|
||||||
let cursor = record.getMulti(allDomain ? '' : domainId, q).sort('_id', -1);
|
let cursor = record.getMulti(allDomain ? '' : domainId, q).sort('_id', -1);
|
||||||
if (!full) cursor = cursor.project(buildProjection(record.PROJECTION_LIST));
|
if (!full) cursor = cursor.project(buildProjection(record.PROJECTION_LIST));
|
||||||
|
|||||||
Reference in new issue
Block a user