示例#1
0
    def fetchConfig(self):
        serialized = self.mainwindow.init_call('nuauth', 'getNuauthConfig')
        if serialized is None:
            self._no_backend()
            return

        #DON'T REMOVE: 3 is a major turn in this module conception
        if serialized['DATASTRUCTURE_VERSION'] < 3:
            self._ask_server_upgrade()
            return

        self.config = NuauthCfg.deserialize(serialized)
        self.selected_auth = self.config.auth.protocol
        self.selected_group = self.config.org.protocol

        #instantiate all data structures
        if len(self.auth_configs) == 0:
            for protocol in auth_protocols:
                if protocol == self.selected_auth:
                    self.auth_configs[protocol] = self.config.auth
                else:
                    self.auth_configs[protocol] = auth_class(protocol)()
        self.auth_configs[self.selected_auth] = self.config.auth

        if len(self.group_configs) == 0:
            for protocol in org_protocols:
                if protocol == self.selected_group:
                    continue
                self.group_configs[protocol] = org_class(protocol)()
        self.group_configs[self.selected_group] = self.config.org
示例#2
0
 def changeable(self):
     if self._isChangeForbidden():
         returnValue(NOT_CHANGEABLE)
     context = Context.fromComponent(self)
     serialized_nuauthcfg = yield self.core.callService(
         context,
         "nuauth",
         "getNuauthConfig"
         )
     nuauthcfg = NuauthCfg.deserialize(serialized_nuauthcfg)
     changeable = CHANGE_DISCOURAGED if nuauthcfg.hasAD() else CHANGEABLE
     returnValue(changeable)
示例#3
0
文件: bind.py 项目: maximerobin/Ufwi
 def __nuauth_hadAD(self):
     previous_nuauth = self.__previous_nuauth_config()
     if previous_nuauth is None:
         hadAD = False
         self.debug("There is no previous configuration")
     else:
         try:
             hadAD = NuauthCfg.deserialize(previous_nuauth).hasAD()
             self.debug("Reading previous configuration.")
         except:
             self.debug("Assuming we had an AD previously")
             #Assume True and risk restarting bind for nothing: it is safer
             hadAD = True
     if hadAD:
         self.debug("Conclusion: We had an AD previously.")
     else:
         self.debug("Conclusion: We did not have an AD previously.")
     return hadAD
示例#4
0
文件: bind.py 项目: maximerobin/Ufwi
    def read_config(self, *args, **kwargs):

        name = 'nuauth'
        try:
            serialized = self.core.config_manager.get(name)
        except (ConfigError, KeyError):
            self.config[name] = NuauthCfg()
        else:
            self.config[name] = NuauthCfg.deserialize(serialized)

        name = 'resolv'
        try:
            serialized = self.core.config_manager.get(name)
        except (ConfigError, KeyError):
            # XXX should be removed : bind require resolv which already call, save
            # and apply autoconf
            self.config[name] = ResolvCfgAutoconf()
        else:
            self.config[name] = resolv_deserialize(serialized)