def _setPropValue(self, id, value): BasePlugin._setPropValue(self, id, value) if id == 'match_roles': self._compile_matchs() if value and len(self._compiled) != len(self.match_roles): raise ValueError('match_roles contains invalid parameters!') notify(ConfigurationChangedEvent(self))
def _setPropValue(self, id, value): BasePlugin._setPropValue(self, id, value) if id == 'ip_roles': self._compile_subnets() if value and len(self._compiled) != len(self.ip_roles): raise ValueError( 'ip_roles contains invalid subnets and/or roles!') notify(ConfigurationChangedEvent(self))
def _setPropValue(self, id, value): BasePlugin._setPropValue(self, id, value) if id == 'match_roles': self._compile_matchs() if value and len(self._compiled) != len(self.match_roles): raise ValueError( 'match_roles contains invalid parameters!') notify(ConfigurationChangedEvent(self))
def test_get_plugin_with_bad_plugin(self): from pas.plugins.headers.utils import get_plugin from pas.plugins.headers.utils import PLUGIN_ID from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin pas = api.portal.get_tool("acl_users") pas._delObject(PLUGIN_ID) pas._setObject(PLUGIN_ID, BasePlugin()) self.assertIsNone(get_plugin(self.portal))
def test_uninstall_with_bad_plugin(self): # When a different plugin with 'our' id is found, we do not remove it. from pas.plugins.headers.utils import PLUGIN_ID from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin pas = api.portal.get_tool("acl_users") pas._delObject(PLUGIN_ID) pas._setObject(PLUGIN_ID, BasePlugin()) from pas.plugins.headers.setuphandlers import uninstall uninstall(self.portal) self.assertIn(PLUGIN_ID, pas.objectIds())
def test_double_install(self): # A double install should not cause trouble. from pas.plugins.headers.utils import PLUGIN_ID from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin pas = api.portal.get_tool("acl_users") pas._delObject(PLUGIN_ID) pas._setObject(PLUGIN_ID, BasePlugin()) from pas.plugins.headers.setuphandlers import post_install with self.assertRaises(ValueError): post_install(self.portal)
def __init__(self, id, title=None): BasePlugin.__init__(self) self._setId(id) self.title = title self._config = _configDefaults
def __init__(self, id, title=None): BasePlugin.__init__(self) self._setId(id) self.title = title self._config = PersistentDict(configDefaults)
def __init__(self, id, host, email_domain): BasePlugin.__init__(self) self.host = unicode(host)