mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: list all domains for users with PRIV_VIEW_ALL_DOMAIN
This commit is contained in:
1 parent
ced60e6567
commit
29965f323b
16 files changed
+53
-26
No files matched your search
@@ -4,13 +4,13 @@ import {
|
||||
ObjectID, Cursor, FilterQuery, UpdateQuery, OnlyFieldsOfType,
|
||||
} from 'mongodb';
|
||||
import {
|
||||
Pdoc, Ddoc, Drdoc, Tdoc, TrainingDoc, ProblemStatusDoc,
|
||||
Pdoc, Ddoc, Drdoc, Tdoc, TrainingDoc,
|
||||
ProblemStatusDoc, User, Content,
|
||||
} from '../interface';
|
||||
import { buildProjection } from '../utils';
|
||||
import { NumberKeys, ArrayKeys, Projection, MaybeArray } from '../typeutils';
|
||||
import db from '../service/db';
|
||||
import * as bus from '../service/bus';
|
||||
import { Content } from '../loader';
|
||||
|
||||
type DocID = ObjectID | string | number;
|
||||
|
||||
@@ -44,6 +44,11 @@ export interface DocStatusType {
|
||||
[key: number]: any
|
||||
}
|
||||
|
||||
export async function canView<T extends keyof DocType>(doc: DocType[T], user: User): Promise<boolean> {
|
||||
if (doc.owner === user._id || doc.maintainers.includes(user._id) || doc.participants.includes(user._id)) return true;
|
||||
if ()
|
||||
}
|
||||
|
||||
export async function add<T extends keyof DocType, K extends DocType[T]['docId']>(
|
||||
domainId: string, content: Content, owner: number,
|
||||
docType: T, docId: K,
|
||||
|
||||
Reference in new issue
Block a user