MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / post

Method post

packages/hydrooj/src/handler/manage.ts:338–351  ·  view source on GitHub ↗
(domainId: string, uid: number, priv: number, editSystem: boolean)

Source from the content-addressed store, hash-verified

336 @param('priv', Types.UnsignedInt)
337 @param('system', Types.Boolean)
338 async post(domainId: string, uid: number, priv: number, editSystem: boolean) {
339 if (!editSystem) {
340 const udoc = await user.getById(domainId, uid);
341 if (!udoc) throw new UserNotFoundError(uid);
342 if (udoc.priv === -1 || priv === -1 || priv === allPriv) throw new CannotEditSuperAdminError();
343 await user.setPriv(uid, priv);
344 } else {
345 const defaultPriv = system.get('default.priv');
346 await user.coll.updateMany({ priv: defaultPriv }, { $set: { priv } });
347 await system.set('default.priv', priv);
348 this.ctx.broadcast('user/delcache', true);
349 }
350 this.back();
351 }
352}
353
354export const inject = ['setting', 'check'];

Callers

nothing calls this directly

Calls 5

getByIdMethod · 0.80
setPrivMethod · 0.80
backMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected