perm_check_func: the auth func with parameter db,col,cmd
    raise_exception: True: raise http 403 exception if permission check failed, otherwise return a JSON

def perm_check(function, perm_check_func=_perm_check_func, raise_exception=False):
    """
    perm_check_func: the auth func with parameter db,col,cmd
    raise_exception: True: raise http 403 exception if permission check failed, otherwise return a JSON
    """
    def real_decorator(func):
        def wrapped(request, db, col, cmd, *args, **kwargs):
            bPermPass = perm_check_func(request, db, col, cmd) if perm_check_func else True
            if raise_exception and (not bPermPass):
                raise PermissionDenied
            return func(request, db, col, cmd, *args, **kwargs) if bPermPass else {"error": "permission disallowed"}

        return wrapped
    return real_decorator(function)