Ejemplo n.º 1
0
 async def wrapper(*args: Any, **kwargs: Any) -> Any:
     if not (await current_user.is_authenticated):
         raise Unauthorized()
     else:
         if not await check_is_admin(current_user.auth_id):
             raise NotAdmin()
         return await func(*args, **kwargs)
Ejemplo n.º 2
0
async def _specform(params):
    usr = await current_user.user
    if not usr or not usr.admin:
        raise Unauthorized()
    yield ("/api/v1/form/" + params["idx"], "fetch")
    try:
        form = await Form.find_one({"id": bson.ObjectId(params["idx"])})
        if form is None:
            return
        if form.representative_thumbnail:
            yield ("/api/v1/form/" + params["idx"] + "/thumb.png", "image")
    except bson.errors.InvalidId:
        return
Ejemplo n.º 3
0
async def _signuplist(params):
    usr = await current_user.user
    if not usr or not usr.admin:
        raise Unauthorized()
    yield ("/api/v1/signup_provider", "fetch")
Ejemplo n.º 4
0
async def _coursespectest(params):
    usr = await current_user.user
    if not usr or not usr.admin:
        raise Unauthorized()
    yield ("/api/v1/course/" + params["idx"] + "/test/" + params["testidx"],
           "fetch")
Ejemplo n.º 5
0
async def _courselist(params):
    usr = await current_user.user
    if not usr or not usr.admin:
        raise Unauthorized()
    yield ("/api/v1/course", "fetch")
Ejemplo n.º 6
0
 async def wrapper(*args, **kwargs):
     if (await current_user.user).admin:
         return await func(*args, **kwargs)
     else:
         raise Unauthorized()