예제 #1
0
 def forbidden(**kw):
     raise ProcessingException(status=403, detail='forbidden')
예제 #2
0
 def raise_error(**kw):
     raise ProcessingException(status=500)
예제 #3
0
def handle400():
    return ProcessingException(description=STATUS_MESSAGE.BAD_REQUEST,
                               code=STATUS_CODE.ER_400)
예제 #4
0
def handle405():
    return ProcessingException(description=STATUS_MESSAGE['METHOD_NOT_ALLOWED'], code=STATUS_CODE['ER_405'])
예제 #5
0
def handle401():
    return ProcessingException(description=STATUS_MESSAGE.NOT_AUTHORIZED,
                               code=STATUS_CODE.ER_401)
예제 #6
0
def handle405():
    return ProcessingException(description=STATUS_MESSAGE.METHOD_NOT_ALLOWED,
                               code=STATUS_CODE.ER_405)
예제 #7
0
파일: app.py 프로젝트: boreone/apppy
def auth_admin_func(instance_id=None, **kwargs):
    current_user = get_jwt_identity()
    if not current_user == "jim":

        raise ProcessingException(description='Only admins can access this view', code=401)
예제 #8
0
def preprocessors_check_adm_or_normal_user(instance_id=None, **kargs):
    if not (current_user.is_admin or current_user.username == instance_id):
        raise ProcessingException(description='Forbidden', code=403)
예제 #9
0
def is_auth_to_app_edit(*args, **kw):
     if not current_user.group.app_edit_all:
        raise ProcessingException(description='Not authenticated!', code=401)
예제 #10
0
def is_auth_to_user_drop(*args, **kw):
    if not current_user.group.user_drop:
        raise ProcessingException(description='Not authenticated!', code=401)
예제 #11
0
def auth_func(*args, **kw):
    if not login_fresh() and not current_user.is_authenticated:
        if not 'user' in session:
            raise ProcessingException(description='Not authenticated!', code=401)
예제 #12
0
def handle401():
    return ProcessingException(description=STATUS_MESSAGE['NOT_AUTHORIZED'], code=STATUS_CODE['ER_401'])
예제 #13
0
def handle400():
    return ProcessingException(description=STATUS_MESSAGE['BAD_REQUEST'], code=STATUS_CODE['ER_400'])
예제 #14
0
def auth(*args, **kargs):
    """
    Required API request to be authenticated
    """
    if not current_user.is_authenticated:
        raise ProcessingException(description='Not authenticated', code=401)
예제 #15
0
def auth_func(**kw):
    '''Ensures api users are authenticated.'''
    if not current_user.is_authenticated:
        raise ProcessingException(description='Not Authorized', code=401)
예제 #16
0
def preprocessor_check_adm(*args, **kargs):
    if not current_user.is_admin:
        raise ProcessingException(description='Forbidden', code=403)
예제 #17
0
def auth_func(**kw):
    if not current_user.is_authenticated:
        raise ProcessingException(description='Not Authorized', code=401)
예제 #18
0
 def is_authorized(self, user, obj):
     if user.id != obj.user_id:
         raise ProcessingException(description='Not Authorized', code=401)
예제 #19
0
파일: utils.py 프로젝트: JakeStanger/PMMS
def auth_request(**kw):
    if not current_user.is_authenticated:
        user = load_user_from_request(request)
        if not user:
            raise ProcessingException(description='Not Authorized', status=401)
예제 #20
0
def handle404():
    return ProcessingException(description=STATUS_MESSAGE.NOT_FOUND,
                               code=STATUS_CODE.ER_404)
예제 #21
0
    def check(description, amount, content):

        if (not description) or (not amount) or (not content):
            raise ProcessingException(description='Tositteista puuttuu tietoja.')
예제 #22
0
def handle500():
    return ProcessingException(
        description=STATUS_MESSAGE.INTERNAL_SERVER_ERROR,
        code=STATUS_CODE.ER_500)
예제 #23
0
def authenticate(*args, **kwargs):
    if not current_user.is_authenticated:
        raise ProcessingException(description='Not authenticated', code=401)
예제 #24
0
 def delete_preprocessor(self, instance_id=None, **kw):
     try:
         article = ArticleController(current_user.id).get(id=instance_id)
     except NotFound:
         raise ProcessingException(description='No such article.', code=404)
     self.is_authorized(current_user, article)
예제 #25
0
def handle404():
    return ProcessingException(description=STATUS_MESSAGE['NOT_FOUND'], code=STATUS_CODE['ER_404'])