Esempio n. 1
0
    def init_route(self):
        handler_path = os.path.join(os.path.abspath(os.path.dirname(toughwlan.__file__)), "admin")
        load_handlers(handler_path=handler_path, pkg_prefix="toughwlan.admin",excludes=['views','webserver','ddns_task'])

        conn = self.db()
        oprs = conn.query(models.TrwOperator)
        for opr in oprs:
            if opr.operator_type > 0:
                for rule in self.db.query(models.TrwOperatorRule).filter_by(operator_name=opr.operator_name):
                    permit.bind_opr(rule.operator_name, rule.rule_path)
            elif opr.operator_type == 0:  # 超级管理员授权所有
                permit.bind_super(opr.operator_name)
Esempio n. 2
0
 def init_route_permit(self):
     with make_db(self.db) as conn:
         try:
             oprs = conn.query(models.TrOperator)
             for opr in oprs:
                 if opr.operator_type > 0:
                     for rule in self.db.query(models.TrOperatorRule).filter_by(operator_name=opr.operator_name):
                         permit.bind_opr(rule.operator_name, rule.rule_path)
                 elif opr.operator_type == 0:  # 超级管理员授权所有
                     permit.bind_super(opr.operator_name)
         except Exception as err:
             dispatch.pub(logger.EVENT_ERROR,"init route error , %s" % str(err))
Esempio n. 3
0
 def init_route_permit(self):
     with make_db(self.db) as conn:
         try:
             oprs = conn.query(models.TlOperator)
             for opr in oprs:
                 if opr.operator_type > 0:
                     for rule in self.db.query(models.TlOperatorRule).filter_by(operator_name=opr.operator_name):
                         permit.bind_opr(rule.operator_name, rule.rule_path)
                 elif opr.operator_type == 0:  # 超级管理员授权所有
                     permit.bind_super(opr.operator_name)
         except Exception as err:
             logger.error("init route error , %s" % str(err))
Esempio n. 4
0
    def init_route(self):
        handler_path = os.path.join(os.path.abspath(os.path.dirname(__file__)))
        load_handlers(handler_path=handler_path, pkg_prefix="toughradius.manage",excludes=['views','webserver','zagent'])

        conn = self.db()
        try:
            oprs = conn.query(models.TrOperator)
            for opr in oprs:
                if opr.operator_type > 0:
                    for rule in self.db.query(models.TrOperatorRule).filter_by(operator_name=opr.operator_name):
                        permit.bind_opr(rule.operator_name, rule.rule_path)
                elif opr.operator_type == 0:  # 超级管理员授权所有
                    permit.bind_super(opr.operator_name)
        except Exception as err:
            self.syslog.error("init route error , %s" % str(err))
        finally:
            conn.close()
Esempio n. 5
0
    def init_route(self):
        handler_path = os.path.join(os.path.abspath(os.path.dirname(__file__)))
        load_handlers(handler_path=handler_path,
                      pkg_prefix="toughradius.manage",
                      excludes=['views', 'webserver', 'zagent'])

        conn = self.db()
        try:
            oprs = conn.query(models.TrOperator)
            for opr in oprs:
                if opr.operator_type > 0:
                    for rule in self.db.query(models.TrOperatorRule).filter_by(
                            operator_name=opr.operator_name):
                        permit.bind_opr(rule.operator_name, rule.rule_path)
                elif opr.operator_type == 0:  # 超级管理员授权所有
                    permit.bind_super(opr.operator_name)
        except Exception as err:
            self.syslog.error("init route error , %s" % str(err))
        finally:
            conn.close()