예제 #1
0
def AllObjectInstancesWithEventInputs(dummy_context):
    """Which objects are there
    """
    iid = zapi.getUtility(IIntIds, '')
    terms = []
    for (oid, oobj) in iid.items():
        if ISite.providedBy(oobj.object) or \
           IIpNet.providedBy(oobj.object) or \
           IHost.providedBy(oobj.object) or \
           IInterface.providedBy(oobj.object) or \
           IService.providedBy(oobj.object) or \
           ISnmpValue.providedBy(oobj.object) or \
           IEventLogic.providedBy(oobj.object):
            inpEventNames = oobj.object.getAllInpEventNames().keys()
            if len(inpEventNames) > 0:
                for inpEventName in inpEventNames:
                    myId = oobj.object.objectID + u'.' + inpEventName
                    terms.append(\
                        SimpleTerm(myId,
                                   str(myId),
                                   oobj.object.getDcTitle() + \
                                   u'->' + inpEventName))
    for iface in [INotifierEmail]:
        my_util = queryUtility(iface)
        if my_util is not None:
            inpEventNames = my_util.getAllInpEventNames().keys()
            if len(inpEventNames) > 0:
                for inpEventName in inpEventNames:
                    myId = my_util.objectID + u'.' + inpEventName
                    terms.append(\
                        SimpleTerm(myId,
                                   str(myId),
                                   my_util.getDcTitle()+ u'->' + inpEventName))
    return SimpleVocabulary(terms)
예제 #2
0
def AllObjectInstances(dummy_context):
    """Which objects are there
    """
    iid = zapi.getUtility(IIntIds, '')
    terms = []
    for (oid, oobj) in iid.items():
        if ISite.providedBy(oobj.object) or \
           IIpNet.providedBy(oobj.object) or \
           IHost.providedBy(oobj.object) or \
           IInterface.providedBy(oobj.object) or \
           IService.providedBy(oobj.object) or \
           ISnmpValue.providedBy(oobj.object) or \
           IEventLogic.providedBy(oobj.object):
            terms.append(\
                SimpleTerm(oobj.object.objectID,
                           str(oobj.object.objectID),
                           oobj.object.getDcTitle()))
    for iface in [INotifierEmail]:
        my_util = queryUtility(iface)
        if my_util is not None:
            terms.append(\
                SimpleTerm(my_util.objectID,
                           str(my_util.objectID),
                           my_util.getDcTitle()))
    return SimpleVocabulary(terms)
예제 #3
0
파일: site.py 프로젝트: mleist/ict-ok.org
 def eventInp_inward_relaying_shutdown(self, eventMsg=None):
     """
     forward the event to all objects in this container through the signal filter
     """
     print "Site.eventInp_inward_relaying_shutdown()"
     for name, obj in self.items():
         if ISite.providedBy(obj):
             targetFunctionName = "inward_relaying_shutdown"
         elif IIpNet.providedBy(obj):
             targetFunctionName = "inward_relaying_shutdown"
         else:
             targetFunctionName = None
         if eventMsg is not None:
             inst_event = MsgEvent(senderObj = self,
                                   oidEventObject = eventMsg.oidEventObject,
                                   logText = u"inward relaying by site '%s'"\
                                   % self.ikName,
                                   targetFunctionName = targetFunctionName)
             eventMsg.stopit(self, u"relaying by site '%s'" % self.ikName)
         else:
             inst_event = MsgEvent(senderObj = self,
                                   logText = u"inward relaying by site '%s'"\
                                   % self.ikName,
                                   targetFunctionName = targetFunctionName)
         obj.injectInpEQueue(inst_event)
예제 #4
0
 def isInIctSite(self):
     """ this supervisor is under a ict site
     """
     sitem = zapi.getSiteManager(self)
     site = zapi.getParent(sitem)
     if IIctSite.providedBy(site):
         return True
     return False
예제 #5
0
파일: site.py 프로젝트: mleist/ict-ok.org
 def __init__(self, **data):
     """
     constructor of the object
     """
     Component.__init__(self, **data)
     for (name, value) in data.items():
         if name in ISite.names():
             setattr(self, name, value)
     self.eventInpObjs_inward_relaying_shutdown = set([])
     self.ikRevision = __version__
예제 #6
0
 def create_indices(self):
     """
     will create all non existent indices in database
     """
     sitem = zapi.getSiteManager(self)
     site = zapi.getParent(sitem)
     tmpEvent = TmpEvent()
     if IZopeSite.providedBy(site) or \
         IIctSite.providedBy(site) or \
         zapi.getParent(site) is None:
         tmpEvent.object = site
         createLocalUtils(tmpEvent)
예제 #7
0
def AllObjectInstances(dummy_context):
    """Which objects are there
    """
    iid = zapi.getUtility(IIntIds, '')
    terms = []
    for (oid, oobj) in iid.items():
        if ISite.providedBy(oobj.object) or \
           INet.providedBy(oobj.object) or \
           IHost.providedBy(oobj.object) or \
           IInterface.providedBy(oobj.object) or \
           IService.providedBy(oobj.object) or \
           ISnmpValue.providedBy(oobj.object) or \
           IEventLogic.providedBy(oobj.object):
            terms.append(\
                SimpleTerm(oobj.object.objectID,
                           str(oobj.object.objectID),
                           oobj.object.getDcTitle()))
    my_util = zapi.getUtility(IAdmUtilTicker)
    terms.append(\
        SimpleTerm(my_util.objectID,
                   str(my_util.objectID),
                   my_util.getDcTitle()))
    return SimpleVocabulary(terms)
예제 #8
0
def createUtils(root_folder, connection=None, dummy_db=None):
    sitem = zapi.getSiteManager(root_folder)
    site = zapi.getParent(sitem)
    isInSite = IIctSite.providedBy(site)
    madeLdapAdapter = ensureUtility(\
        root_folder,
        IManageableLDAPAdapter,
        'ManageableLDAPAdapter',
        ManageableLDAPAdapter,
        name='ManageableLDAPAdapter',
        copy_to_zlog=False)

    madeLdapPas = ensureUtility(\
        root_folder,
        IMyLDAPAuthentication,
        'MyLDAPAuthentication',
        MyLDAPAuthentication,
        name='MyLDAPAuthentication',
        copy_to_zlog=False)

    if isinstance(madeLdapPas, MyLDAPAuthentication):
        madeLdapPas.adapterName = 'ManageableLDAPAdapter'
        madeLdapPas.principalIdPrefix = u'ldap.'

    madePluggableAuthentication = ensureUtility(\
        root_folder,
        IAdmUtilUserManagement,
        'AdmUtilUserManagement',
        AdmUtilUserManagement,
        name='',
        copy_to_zlog=False)

    if isinstance(madePluggableAuthentication, PluggableAuthentication):
        logger.info(u"bootstrap: Ensure named AdmUtilUserManagement")
        dcore = IWriteZopeDublinCore(madePluggableAuthentication)
        dcore.title = u"User Authentication"
        dcore.created = datetime.utcnow()
        madePluggableAuthentication.ikName = dcore.title
        # madePluggableAuthentication.__post_init__()
        sitem = root_folder.getSiteManager()
        utils = [
            util for util in sitem.registeredUtilities()
            if util.provided.isOrExtends(IAdmUtilSupervisor)
        ]
        instAdmUtilSupervisor = utils[0].component
        instAdmUtilSupervisor.appendEventHistory(\
            u" bootstrap: made AdmUtilUserManagement-Utility")
        if not isInSite:
            # only produce in real zope root folder not sites
            groups = GroupFolder(u'group.')
            madePluggableAuthentication[u'groups'] = groups
            principals = PrincipalFolder(u'principal.')
            madePluggableAuthentication[u'principals'] = principals
            madePluggableAuthentication.credentialsPlugins = \
                                       (u'Session Credentials',
                                        u'No Challenge if Authenticated',)
            p_user = InternalPrincipal(u'User',
                                       u'User',
                                       u'Initial User',
                                       passwordManagerName="SHA1")
            p_manager = InternalPrincipal(u'Manager',
                                          u'Manager',
                                          u'Initial Manager',
                                          passwordManagerName="SHA1")
            p_admin = InternalPrincipal(u'Administrator',
                                        u'Administrator',
                                        u'Initial Administrator',
                                        passwordManagerName="SHA1")
            p_developer = InternalPrincipal(u'Developer',
                                            u'Developer',
                                            u'Initial Developer',
                                            passwordManagerName="SHA1")
            principals[u'User'] = p_user
            principals[u'Manager'] = p_manager
            principals[u'Administrator'] = p_admin
            principals[u'Developer'] = p_developer
            grp_usr = GroupInformation(
                u'User', u'view & analyse data, generate reports '
                u'& leave notes at any object')
            grp_mgr = GroupInformation(
                u'Manager', u'search, connect, configure '
                u'& delete devices')
            grp_adm = GroupInformation(
                u'Administrator', u'install, configure '
                u'& administrate System')
            grp_dvl = GroupInformation(
                u'Developer', u'individual adaption '
                u'& development on System')
            grp_usr.principals = [u'principal.User']
            grp_mgr.principals = [u'principal.Manager']
            grp_adm.principals = [u'principal.Administrator']
            grp_dvl.principals = [u'principal.Developer']
            groups[u'User'] = grp_usr
            groups[u'Manager'] = grp_mgr
            groups[u'Administrator'] = grp_adm
            groups[u'Developer'] = grp_dvl
            madePluggableAuthentication[u'LDAPAuthentication'] = madeLdapPas
            madePluggableAuthentication.authenticatorPlugins = \
                (u'groups', u'principals', u'LDAPAuthentication', )
            prm = IPrincipalRoleManager(root_folder)
            prm.assignRoleToPrincipal(u'org.ict_ok.usr', u'group.User')
            prm.assignRoleToPrincipal(u'org.ict_ok.mgr', u'group.Manager')
            prm.assignRoleToPrincipal(u'org.ict_ok.adm',
                                      u'group.Administrator')
            prm.assignRoleToPrincipal(u'org.ict_ok.dvl', u'group.Developer')
        else:  # is in site
            madePluggableAuthentication.credentialsPlugins = \
                                       (u'Session Credentials',
                                        u'No Challenge if Authenticated',)
            madePluggableAuthentication[u'LDAPAuthentication'] = madeLdapPas
            madePluggableAuthentication.authenticatorPlugins = \
                (u'LDAPAuthentication', )

    transaction.get().commit()
    if connection is not None:
        connection.close()