Example #1
0
        def admin_bot(path, db):
            auth = basic_auth()
            if isinstance(auth, HTTPError):
                return auth

            spl = path.split('/')
            controller = Admin(self.cfg, db)

            if not spl[1]:
                redirect('/admin/', 301)

            if spl[0] == 'bot':
                if is_int(spl[1]):
                    return controller.bot_id(spl[1])
                elif spl[1] == 'list':
                    return controller.bot_list()
            elif spl[0] == 'amqp':
                if spl[1] == 'add':
                    return controller.amqp_add()
                elif spl[1] == 'list':
                    return controller.amqp_list()
                elif spl[1] and not len(spl) > 2:
                    return controller.amqp_id(spl[1])
                elif spl[2] == 'delete':
                    return controller.amqp_delete(spl[1])
            elif spl[0] == 'appearance':
                if spl[1] == 'list':
                    return controller.themes()
Example #2
0
    def wrapper(self, *args):
        env = {}

        auth = basic_auth()
        if isinstance(auth, HTTPError):
            return auth

        env['authed'] = True

        if not isinstance(env, dict):
            return env
        args = (args[0], env,) if args else (env,)
        return f(self, *args)
Example #3
0
        def admin_dyn(db, name):
            auth = basic_auth()
            if isinstance(auth, HTTPError):
                return auth

            controller = Admin(self.cfg, db)

            try:
                func = getattr(controller, name)
            except:
                return redirect('/admin/general')

            return func()
Example #4
0
        def admin():
            auth = basic_auth()
            if isinstance(auth, HTTPError):
                return auth

            return redirect('/admin/general')