예제 #1
0
def app_button_by_name(app_name):
    try:
        app = App.object.get(name=app_name)
        c = {}
        c['app'] = app
        return c
    except:
        app = App.get(name=app_name)
        c = {}
        c['app'] = app
        return c
예제 #2
0
    def authenticate_app(self, app_key, app_secret):
        #authenticate app
        app = App(self._db)
        app = app.filter(app_key=app_key, app_secret=app_secret)
        if len(app) == 1:
            app = app[0]
            if not app.get('is_active'):
                raise falcon.HTTPForbidden(
                    title='Permission Denied ',
                    description='Your app account is inactive')

        elif len(app) > 1:
            raise falcon.HTTPUnauthorized(
                title='Duplicate  Autheentication',
                description='Duplicate Authentication Occured')
        else:
            raise falcon.HTTPUnauthorized(
                title='Authentication Failed ',
                description='Valid app-key and app-secret are  needed')
        return app