当前位置: 首页>>代码示例>>Python>>正文


Python Setting.get_auth_settings方法代码示例

本文整理汇总了Python中kallithea.model.db.Setting.get_auth_settings方法的典型用法代码示例。如果您正苦于以下问题:Python Setting.get_auth_settings方法的具体用法?Python Setting.get_auth_settings怎么用?Python Setting.get_auth_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kallithea.model.db.Setting的用法示例。


在下文中一共展示了Setting.get_auth_settings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_ldap_save_settings

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_auth_settings [as 别名]
    def test_ldap_save_settings(self):
        self.log_user()

        params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_ldap')
        params.update({'auth_ldap_host': u'dc.example.com',
                       'auth_ldap_port': '999',
                       'auth_ldap_tls_kind': 'PLAIN',
                       'auth_ldap_tls_reqcert': 'NEVER',
                       'auth_ldap_cacertdir': '',
                       'auth_ldap_dn_user': 'test_user',
                       'auth_ldap_dn_pass': 'test_pass',
                       'auth_ldap_base_dn': 'test_base_dn',
                       'auth_ldap_filter': 'test_filter',
                       'auth_ldap_search_scope': 'BASE',
                       'auth_ldap_attr_login': 'test_attr_login',
                       'auth_ldap_attr_firstname': 'ima',
                       'auth_ldap_attr_lastname': 'tester',
                       'auth_ldap_attr_email': '[email protected]'})

        test_url = url(controller='admin/auth_settings',
                       action='auth_settings')

        response = self.app.post(url=test_url, params=params)
        self.checkSessionFlash(response, 'Auth settings updated successfully')

        new_settings = Setting.get_auth_settings()
        assert new_settings['auth_ldap_host'] == u'dc.example.com', 'fail db write compare'
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:29,代码来源:test_admin_auth_settings.py

示例2: test_pam_save_settings

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_auth_settings [as 别名]
    def test_pam_save_settings(self):
        self.log_user()

        params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_pam')
        params.update({'auth_pam_service': 'kallithea',
                       'auth_pam_gecos': '^foo-.*'})

        test_url = url(controller='admin/auth_settings',
                       action='auth_settings')

        response = self.app.post(url=test_url, params=params)
        self.checkSessionFlash(response, 'Auth settings updated successfully')

        new_settings = Setting.get_auth_settings()
        assert new_settings['auth_pam_service'] == u'kallithea', 'fail db write compare'
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:17,代码来源:test_admin_auth_settings.py

示例3: test_crowd_save_settings

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_auth_settings [as 别名]
    def test_crowd_save_settings(self):
        self.log_user()

        params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_crowd')
        params.update({'auth_crowd_host': ' hostname ',
                       'auth_crowd_app_password': 'secret',
                       'auth_crowd_admin_groups': 'mygroup',
                       'auth_crowd_port': '123',
                       'auth_crowd_app_name': 'xyzzy'})

        test_url = url(controller='admin/auth_settings',
                       action='auth_settings')

        response = self.app.post(url=test_url, params=params)
        self.checkSessionFlash(response, 'Auth settings updated successfully')

        new_settings = Setting.get_auth_settings()
        assert new_settings['auth_crowd_host'] == u'hostname', 'fail db write compare'
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:20,代码来源:test_admin_auth_settings.py

示例4: index

# 需要导入模块: from kallithea.model.db import Setting [as 别名]
# 或者: from kallithea.model.db.Setting import get_auth_settings [as 别名]
    def index(self, defaults=None, errors=None, prefix_error=False):
        self.__load_defaults()
        _defaults = {}
        # default plugins loaded
        formglobals = {
            "auth_plugins": ["kallithea.lib.auth_modules.auth_internal"]
        }
        formglobals.update(Setting.get_auth_settings())
        formglobals["plugin_settings"] = {}
        formglobals["auth_plugins_shortnames"] = {}
        _defaults["auth_plugins"] = formglobals["auth_plugins"]

        for module in formglobals["auth_plugins"]:
            plugin = auth_modules.loadplugin(module)
            plugin_name = plugin.name
            formglobals["auth_plugins_shortnames"][module] = plugin_name
            formglobals["plugin_settings"][module] = plugin.plugin_settings()
            for v in formglobals["plugin_settings"][module]:
                fullname = ("auth_" + plugin_name + "_" + v["name"])
                if "default" in v:
                    _defaults[fullname] = v["default"]
                # Current values will be the default on the form, if there are any
                setting = Setting.get_by_name(fullname)
                if setting:
                    _defaults[fullname] = setting.app_settings_value
        # we want to show , separated list of enabled plugins
        _defaults['auth_plugins'] = ','.join(_defaults['auth_plugins'])
        if defaults:
            _defaults.update(defaults)

        formglobals["defaults"] = _defaults
        # set template context variables
        for k, v in formglobals.iteritems():
            setattr(c, k, v)

        log.debug(pprint.pformat(formglobals, indent=4))
        log.debug(formatted_json(defaults))
        return formencode.htmlfill.render(
            render('admin/auth/auth_settings.html'),
            defaults=_defaults,
            errors=errors,
            prefix_error=prefix_error,
            encoding="UTF-8",
            force_defaults=False)
开发者ID:msabramo,项目名称:kallithea,代码行数:46,代码来源:auth_settings.py


注:本文中的kallithea.model.db.Setting.get_auth_settings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。