Example #1
0
 def _check_user_exist(self, session, user_id):
     auth = CoreAuthenticator(settings.auth_server_url)
     resp = auth.check_user_exist(session.session_id, user_id)
     if resp['status'] == 'ok':
         if resp['exist'] == True:
             pass
         else:
             raise UserNotExists('User %s not exists' % user_id)
     else:
         raise UserCheckingError(resp.get('message'))
Example #2
0
 def _check_user_exist(self, session, user_id):
     auth = CoreAuthenticator(settings.auth_server_url)
     resp = auth.check_user_exist(session.session_id, user_id)
     if resp['status'] == 'ok':
         if resp['exist'] == True:
             pass
         else:
             raise UserNotExists('User %s not exists' % user_id)
     else:
         raise UserCheckingError(resp.get('message'))
Example #3
0
 def decroated(self, data, curs):
     auth = CoreAuthenticator(settings.auth_server_url)
     session_id = data['session_id']
     custom_actor_info = data.pop('custom_actor_info', None)
     resp = auth.check_access(session_id, 'billing', method.__name__)
     if resp.get('status') == 'ok':
         session = Session(session_id, '%s' % resp['environment_id'],
             '%s' % resp['user_id'])
         if resp.get('access') == 'granted':
             try:
                 result = method(self, data, session, curs=curs)
             except Exception, e:
                 data['environment_id'] = session.environment_id
                 _add_log_info(data, session, custom_actor_info)
                 raise e
         else:
             result = {'status': 'error', 'code': error_code.HELIX_AUTH_ERROR,
                 'message': 'Access denied'}
         _add_log_info(data, session, custom_actor_info)
Example #4
0
 def decroated(self, data, curs):
     auth = CoreAuthenticator(settings.auth_server_url)
     session_id = data['session_id']
     custom_actor_info = data.pop('custom_actor_info', None)
     resp = auth.check_access(session_id, 'tariff', method.__name__)
     if resp.get('status') == 'ok':
         session = Session(session_id, '%s' % resp['environment_id'],
                           '%s' % resp['user_id'])
         if resp.get('access') == 'granted':
             try:
                 result = method(self, data, session, curs=curs)
             except Exception, e:
                 data['environment_id'] = session.environment_id
                 _add_log_info(data, session, custom_actor_info)
                 raise e
         else:
             result = {
                 'status': 'error',
                 'code': error_code.HELIX_AUTH_ERROR,
                 'message': 'Access denied'
             }
         _add_log_info(data, session, custom_actor_info)
Example #5
0
 def logout(self, data):
     auth = CoreAuthenticator(settings.auth_server_url)
     resp = auth.logout(data)
     return resp
Example #6
0
 def logout(self, data):
     auth = CoreAuthenticator(settings.auth_server_url)
     resp = auth.logout(data)
     return resp