예제 #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)
예제 #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
예제 #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")
예제 #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")
예제 #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")
예제 #6
0
 async def wrapper(*args, **kwargs):
     if (await current_user.user).admin:
         return await func(*args, **kwargs)
     else:
         raise Unauthorized()