Example #1
0
class IContactFolder(Interface):
    """Marker interface for .ContactFolder.ContactFolder
    """

    contains('UWOshMusicRecruiting.content.interfaces.IContact')

##code-section FOOT
##/code-section FOOT
Example #2
0
class IRDFFolder(Interface):
    '''A folder containing RDF data sources.'''
    contains('edrn.rdf.source')
    title = schema.TextLine(title=_(u'Title'),
                            description=_(u'The name of this folder.'))
    description = schema.Text(
        title=_(u'Description'),
        description=_(u'A short summary of this folder.'))
Example #3
0
class ICartContentType(Interface):
    """Interface for Cart Content Type.
    """

    contains('collective.cart.core.interfaces.ICartProductContentType', )

    info = Attribute('Additioinal Info besides products.')
    session_cart_id = Attribute('Cart ID for Session.')
Example #4
0
class IAgenda(Interface):
    """A rich text field that can contain files."""

    contains('Products.ATContentTypes.interfaces.IATFile', )

    text = schema.Text(title=_(u"Text"),
                       description=_(u"Main agenda text"),
                       required=True)
Example #5
0
class IDirectory(Interface):
    """ A folder containing contacts
    """
    contains('atreal.contacts.interfaces.IContact',
             'atreal.contacts.interfaces.IOrganization')
    title = schema.TextLine(title=_(u"Title"), required=True)
    description = schema.TextLine(
        title=_(u"Description"),
        description=_(u"A short summary of this folder"))
class ISchoolFolder(Interface):
    """An folder object containing schools.
    """
    contains('Products.Tutorweb.interfaces.ISchool')
    title = schema.TextLine(title=_(u"Object title"), required=True)

    description = schema.TextLine(
        title=_(u"Description"),
        description=_(u"A short summary of this folder"))
Example #7
0
class IPluggableAuthentication(ILogout, IContainer):
    """Provides authentication services with the help of various plugins.
    
    IPluggableAuthentication implementations will also implement
    zope.app.security.interfaces.IAuthentication.  The `authenticate` method
    of this interface in an IPluggableAuthentication should annotate the
    IPrincipalInfo with the credentials plugin and authentication plugin used.
    The `getPrincipal` method should annotate the IPrincipalInfo with the
    authentication plugin used.
    """

    contains(IPlugin)

    credentialsPlugins = zope.schema.List(
        title=_('Credentials Plugins'),
        description=_("""Used for extracting credentials.
        Names may be of ids of non-utility ICredentialsPlugins contained in
        the IPluggableAuthentication, or names of registered
        ICredentialsPlugins utilities.  Contained non-utility ids mask 
        utility names."""),
        value_type=zope.schema.Choice(vocabulary='CredentialsPlugins'),
        default=[],
    )

    authenticatorPlugins = zope.schema.List(
        title=_('Authenticator Plugins'),
        description=_("""Used for converting credentials to principals.
        Names may be of ids of non-utility IAuthenticatorPlugins contained in
        the IPluggableAuthentication, or names of registered
        IAuthenticatorPlugins utilities.  Contained non-utility ids mask 
        utility names."""),
        value_type=zope.schema.Choice(vocabulary='AuthenticatorPlugins'),
        default=[],
    )

    def getCredentialsPlugins():
        """Return iterable of (plugin name, actual credentials plugin) pairs.
        Looks up names in credentialsPlugins as contained ids of non-utility
        ICredentialsPlugins first, then as registered ICredentialsPlugin
        utilities.  Names that do not resolve are ignored."""

    def getAuthenticatorPlugins():
        """Return iterable of (plugin name, actual authenticator plugin) pairs.
        Looks up names in authenticatorPlugins as contained ids of non-utility
        IAuthenticatorPlugins first, then as registered IAuthenticatorPlugin
        utilities.  Names that do not resolve are ignored."""

    prefix = zope.schema.TextLine(
        title=_('Prefix'),
        default=u'',
        required=True,
        readonly=True,
    )

    def logout(request):
        """Performs a logout by delegating to its authenticator plugins."""
Example #8
0
class IGsoc(IContainer):
    """This is the root object of this project. It can only contain IOrganization objects"""

    contains(".IOrganization")

    description = Text(
        title=u"Description",
        description=u"A detailed description about the content on the Gsoc",
        default=u"",
        required=False)
Example #9
0
class ISlave(IPossibleSite, IComponent):
    """A objectcontainer for new slave data."""

    contains('org.ict_ok.components.net.interfaces.INet')

    title = TextLine(min_length=2,
                     max_length=40,
                     title=u"Title/Subject",
                     description=u"Title and/or subject of the message.",
                     default=u"Title",
                     required=True)
Example #10
0
class ISite(IComponent):
    """
    The interface of Site-objects
    """
    contains('org.ict_ok.components.site.interfaces.ISite')

    sitename = TextLine(
        max_length = 80,
        title = _("Sitename"),
        description = _("Name of the site."),
        default = _("mysite"),
        required = True)
Example #11
0
class IIpNet(Interface):
    """A network object."""

    contains('org.ict_ok.components.host.interfaces.IHost')

    ipv4 = NetIpValid(min_length=1,
                      max_length=30,
                      title=_("IpNetwork IP"),
                      description=_("IP address of the IpNetwork."),
                      default=u"0.0.0.0/24",
                      readonly=False,
                      required=True)

    ipAddresses = List(
        title=_(u'IP Addresses'),
        value_type=Choice(vocabulary='AllUnusedOrUsedIpNetIpAddresses'),
        default=[],
        required=False)

    parentnet = Choice(title=_(u'Parent net'),
                       vocabulary='AllIpNets',
                       required=False)

    subnets = List(title=_(u'Sub nets'),
                   value_type=Choice(vocabulary='AllValidSubIpNets'),
                   default=[],
                   required=False)

    @invariant
    def ensureSubnetInIpNet(obj):
        """publicKey must be valid PEM string
        """
        if obj.parentnet is not None:
            if IIpNet.providedBy(obj.parentnet):
                parentnet = IP(obj.parentnet.ipv4)
            else:
                parentnet = IP(obj.parentnet)
            mynet = IP(obj.ipv4)
            if not mynet in parentnet:
                raise Invalid(u"'%s' not in '%s'" %
                              (obj.ipv4, obj.parentnet.ipv4))
        if obj.subnets is not None:
            mynet = IP(obj.ipv4)
            for subnet_obj in obj.subnets:
                subnet = IP(subnet_obj.ipv4)
                if not subnet in mynet:
                    raise Invalid(u"'%s' not in '%s'" %
                                  (subnet_obj.ipv4, obj.ipv4))

    def containsIp(ipString):
        """ is ip(String) part of this network?
Example #12
0
class ISite(Interface):
    """
    The interface of Site-objects
    """
    contains('org.ict_ok.components.site.interfaces.ISite')

    sitename = TextLine(
        max_length = 80,
        title = _("Sitename"),
        description = _("Name of the site."),
        default = _("mysite"),
        required = True)

    def __delitem__(name):
        """Delete the named object from the container.
class ICourseFolder(Interface):
    """A folder containing courses
    """
    contains('.ICourse')

    title = schema.TextLine(title=_(u"Title"), required=True)

    description = schema.TextLine(
        title=_(u"Description"),
        description=_(u"A short summary of this folder"))

    categories = schema.List(
        title=_(u"Categories"),
        description=_(u"Classify this Course using the listed categories"),
        required=True)
Example #14
0
class INet(IComponent):
    """A network object."""

    contains('org.ict_ok.components.host.interfaces.IHost')

    ipv4 = NetIpValid(min_length=1,
                      max_length=30,
                      title=_("Network IP"),
                      description=_("IP address of the Network."),
                      default=u"0.0.0.0/24",
                      readonly=False,
                      required=True)

    def containsIp(ipString):
        """ is ip(String) part of this network?
Example #15
0
class ICartFolderContentType(Interface):
    """Interface for CartFolder Content Type.
    """

    contains('collective.cart.core.interfaces.ICartContentType', )

    cart_id_numbering_method = schema.Choice(
        title=_(u"Cart ID Numbering Method"),
        description=_(u"Select Incremental or Random for Cart ID Numbering."),
        required=True,
        vocabulary='Numbering Method',
        default="Incremental",
    )

    next_incremental_cart_id = schema.Int(
        title=_(u"Next Incremenatal Cart ID"),
        description=_(
            u"If Incrementanl Cart ID is seleceted, give interger number here."
        ),
        required=False,
        default=1,
    )

    random_digits_cart_id = schema.Int(
        title=_(u"Random Digits Cart ID"),
        description=_(
            u"If Random Cart ID is selected, give integer digits here."),
        required=False,
        default=5,
    )

    quantity_method = schema.Choice(
        title=_(u"Quantity Method"),
        description=
        _(u"Select one method, Select or Input to determine how to put products into cart."
          ),
        required=True,
        vocabulary="Quantity Methods",
        default="Select",
    )
Example #16
0
class IInternalPrincipalContainer(interface.Interface):
    """A container that contains internal principals."""

    prefix = TextLine(
        title=_("Prefix"),
        description=_(
            "Prefix to be added to all principal ids to assure "
            "that all ids are unique within the authentication service"),
        missing_value=u"",
        default=u'',
        readonly=True)

    def getIdByLogin(login):
        """Return the principal id currently associated with login.

        The return value includes the container prefix, but does not
        include the PAU prefix.

        KeyError is raised if no principal is associated with login.

        """

    contains(IInternalPrincipal)
Example #17
0
class IInterface(Interface):
    """A interface object."""

    contains('org.ict_ok.components.service.interfaces.IService',
             'org.ict_ok.components.snmpvalue.interfaces.ISnmpValue')

    device = Choice(title=_(u'Device'),
                    vocabulary='AllDevices',
                    required=False)

    #    host2 = Choice(
    #        title=u'Host 0..1',
    #        vocabulary='AllHosts',
    #        required=False
    #        )

    netType = Choice(
        title=_("interface type"),
        description=_("Networktype of this interface (OSI Layer1-2)"),
        default="ethernet",
        values=['ethernet', 'fddi', 'wlan', 'token bus', 'token ring'],
        required=True)

    #    physicalConnector = Choice(
    #        title=u'Connected with',
    #        vocabulary='AllUnusedOrUsedInterfacePhysicalConnectors',
    #        required=False
    #        )

    mac = MacValid(max_length=40,
                   title=_("MAC address"),
                   description=_("MAC address of the host."),
                   default=u"00:00:00:00:00:00",
                   required=False)

    #wait for z3c.form list of textlines
    #    ipv4List = List (
    #        title = _("IPv4 addresses"),
    #        description = _("list of all configured IPv4 addresses"),
    #        value_type = HostIpValid(
    #            min_length=1,
    #            max_length=30,
    #            title=_("IP address"),
    #            description=_("IP address of the host."),
    #            default=u"192.168.1.100",
    #            required=True),
    #        default = [],
    #        required = False)
    #ipv4List = HostIpValid(
    #min_length=1,
    #max_length=30,
    #title=_("IP address"),
    #description=_("IP address of the host."),
    #default=u"192.168.1.100",
    #required=False)

    ipAddresses = List(
        title=_(u'IP Addresses'),
        value_type=Choice(vocabulary='AllUnusedOrUsedInterfaceIpAddresses'),
        default=[],
        required=False)

    #connectedInterfaces

    #    @invariant
    #    def ensureMyIpInNetIpRange(intfc):
    #        if intfc.netType == 'ethernet' and \
    #           intfc.__context__ is not None and \
    #           intfc.ipv4List is not None:
    #            if IHost.providedBy(intfc.__context__):
    #                host = intfc.__context__
    #            else:
    #                host = intfc.__context__.__parent__
    #            net = host.__parent__
    #            for ipv4 in intfc.ipv4List:
    #                if not net.containsIp(ipv4):
    #                    raise Invalid("The IP address %s is not in ip-range %s of the "\
    #                                  "network '%s'" % (ipv4, net.ipv4, net.ikName))

    #    @invariant
    #    def ensureMyIpNotAlreadyUsed(intfc):
    #        if intfc.netType == 'ethernet' and \
    #             intfc.__context__ is not None and \
    #           intfc.ipv4List is not None:
    #            my_catalog = zapi.getUtility(ICatalog)
    #            alreadyFound = []
    #            # new Object
    #            if IHost.providedBy(intfc.__context__):
    #                for obj in my_catalog.searchResults(\
    #                    interface_ip_index=convertIpV4(intfc.ipv4List)):
    #                    ifHost = obj.__parent__
    #                    ifString = u"%s/%s" % (ifHost.ikName, obj.ikName)
    #                    alreadyFound.append(ifString)
    #            # edit Object
    #            if IInterface.providedBy(intfc.__context__):
    #                for obj in my_catalog.searchResults(\
    #                    interface_ip_index=convertIpV4(intfc.ipv4List)):
    #                    # don't check object itself
    #                    if obj.objectID != intfc.__context__.objectID:
    #                        ifHost = obj.__parent__
    #                        ifString = u"%s/%s" % (ifHost.ikName, obj.ikName)
    #                        alreadyFound.append(ifString)
    #            if len(alreadyFound) > 0:
    #                raise Invalid("The IP address already used in interface %s" % \
    #                              " ".join(alreadyFound))

    def getAllPhysicalConnectors(connectorSet, maxDepth=10):
        """
Example #18
0
class IOrganizationContainer(IContainer):
    """Organization is also a container for projects, students and mentors"""

    contains(".IProject", ".IStudent", ".IMentor")
Example #19
0
class IInterface(IComponent):
    """A interface object."""

    contains('org.ict_ok.components.service.interfaces.IService',
             'org.ict_ok.components.snmpvalue.interfaces.ISnmpValue')

    netType = Choice(
        title=_("interface type"),
        description=_("Networktype of this interface (OSI Layer1-2)"),
        default="ethernet",
        values=['ethernet', 'fddi', 'wlan', 'token bus', 'token ring'],
        required=True)

    mac = MacValid(max_length=40,
                   title=_("MAC address"),
                   description=_("MAC address of the host."),
                   default=u"00:00:00:00:00:00",
                   required=False)

    #wait for z3c.form list of textlines
    #ipv4List = List (
    #title = _("IPv4 addresses"),
    #description = _("list of all configured IPv4 addresses"),
    #value_type = HostIpValid(
    #min_length=1,
    #max_length=30,
    #title=_("IP address"),
    #description=_("IP address of the host."),
    #default=u"192.168.1.100",
    #required=True),
    #default = [],
    #required = False)
    ipv4List = HostIpValid(min_length=1,
                           max_length=30,
                           title=_("IP address"),
                           description=_("IP address of the host."),
                           default=u"192.168.1.100",
                           required=False)

    #connectedInterfaces

    @invariant
    def ensureMyIpInNetIpRange(intfc):
        if intfc.netType == 'ethernet' and \
           intfc.__context__ is not None and \
           intfc.ipv4List is not None:
            if IHost.providedBy(intfc.__context__):
                host = intfc.__context__
            else:
                host = intfc.__context__.__parent__
            net = host.__parent__
            if not net.containsIp(intfc.ipv4List):
                raise Invalid("The IP address is not in ip-range %s of the "\
                              "network '%s'" % (net.ipv4, net.ikName))

    @invariant
    def ensureMyIpNotAlreadyUsed(intfc):
        if intfc.netType == 'ethernet' and \
             intfc.__context__ is not None and \
           intfc.ipv4List is not None:
            my_catalog = zapi.getUtility(ICatalog)
            alreadyFound = []
            # new Object
            if IHost.providedBy(intfc.__context__):
                for obj in my_catalog.searchResults(\
                    interface_ip_index=convertIpV4(intfc.ipv4List)):
                    ifHost = obj.__parent__
                    ifString = u"%s/%s" % (ifHost.ikName, obj.ikName)
                    alreadyFound.append(ifString)
            # edit Object
            if IInterface.providedBy(intfc.__context__):
                for obj in my_catalog.searchResults(\
                    interface_ip_index=convertIpV4(intfc.ipv4List)):
                    # don't check object itself
                    if obj.objectID != intfc.__context__.objectID:
                        ifHost = obj.__parent__
                        ifString = u"%s/%s" % (ifHost.ikName, obj.ikName)
                        alreadyFound.append(ifString)
            if len(alreadyFound) > 0:
                raise Invalid("The IP address already used in interface %s" % \
                              " ".join(alreadyFound))
Example #20
0
class IHost(IComponent):
    """A host object."""

    contains('org.ict_ok.components.interface.interfaces.IInterface')

    hostname = TextLine(max_length=80,
                        title=_("Hostname"),
                        description=_("Name of the system."),
                        default=_("systemname"),
                        required=True)

    manufacturer = TextLine(max_length=500,
                            title=_("Manufacturer"),
                            description=_("Name/Address of the manufacturer."),
                            default=u"",
                            required=False)

    vendor = TextLine(max_length=500,
                      title=_("Vendor"),
                      description=_("Name/Address of the vendor."),
                      default=u"",
                      required=False)

    hostGroups = Set(title=_("host groups"),
                     value_type=Choice(title=_("host"),
                                       vocabulary="AllHostGroups"),
                     default=set([]),
                     readonly=False,
                     required=True)

    productionState = Choice(title=_("Production state"),
                             vocabulary="AllHostProductionStates",
                             default='production',
                             readonly=False,
                             required=True)

    workinggroup = TextLine(max_length=500,
                            title=_("Workinggroup"),
                            description=_("Name of the workinggroup."),
                            default=u"",
                            required=False)

    hardware = TextLine(max_length=500,
                        title=_("Hardware"),
                        description=_("Hardware of the system."),
                        default=u"",
                        required=False)

    user = TextLine(max_length=500,
                    title=_("User"),
                    description=_("User which is working with the system."),
                    default=u"",
                    required=False)

    inv_id = TextLine(max_length=500,
                      title=_("inventory id"),
                      description=_("Id of inventory."),
                      default=u"",
                      required=False)

    room = Choice(title=_("Room"),
                  description=_("The Room Description."),
                  vocabulary="AllRoomsVocab",
                  required=False)

    osList = List(title=_("operating systems"),
                  description=_("list of possible operating systems"),
                  value_type=TextLine(max_length=200,
                                      title=_("Operatingsystem"),
                                      description=_("The OS Description."),
                                      default=u"",
                                      required=False),
                  default=[],
                  required=False)

    snmpVersion = Choice(
        title=_("SNMP version"),
        vocabulary="SnmpVersions",
        default=u"0",  # SNMP V1
        required=False)

    snmpPort = Int(min=1,
                   max=65535,
                   title=_("SNMP port"),
                   default=161,
                   required=False)

    snmpReadCommunity = TextLine(max_length=80,
                                 title=_("SNMP read community"),
                                 default=u"public",
                                 required=False)

    snmpWriteCommunity = TextLine(max_length=80,
                                  title=_("SNMP write community"),
                                  default=u"private",
                                  required=False)

    url = TextLine(max_length=80,
                   title=_("URL"),
                   description=_("URL of system."),
                   default=u"",
                   required=False)

    url_type = Choice(
        title=_("URL browser type"),
        description=_("Type of browser window"),
        default="direct",
        values=['direct', 'proxy', 'direct extern', 'proxy extern'],
        required=True)

    url_authname = TextLine(max_length=80,
                            title=_("URL Username"),
                            description=_("Username for url-browser login"),
                            default=u"",
                            required=False)

    url_authpasswd = Password(max_length=80,
                              title=_("URL Password"),
                              description=_("Password for url-browser login"),
                              default=u"",
                              required=False)

    console = TextLine(max_length=80,
                       title=_("Console"),
                       description=_("Console of system."),
                       default=u"",
                       required=False)

    genNagios = Bool(title=_("for Nagios"),
                     description=_("enabled in Nagios"),
                     default=False,
                     required=False)

    def trigger_online():
        """
        trigger workflow
        """

    def trigger_offline():
        """
        trigger workflow
        """

    def trigger_not1():
        """
        trigger workflow
        """

    def getIpList():
        """ get a list of all possible ips
Example #21
0
class IHost(Interface):
    """A host object."""

    contains('org.ict_ok.components.interface.interfaces.IInterface')
    
#    interfaces2 = List(title=u"Interfaces 0..n",
#                      #value_type=Object(IObject),
#                      value_type=Choice(vocabulary='AllUnusedOrSelfInterfaces'),
#                      required=False,
#                      default=[])
    #related = schema.List(
            #title=u"Related",
            #value_type=schema.Choice(vocabulary='demo.documentsInParent'),
            #required=False,
            #default=[])

    hostname = TextLine(
        max_length = 80,
        title = _("Hostname"),
        description = _("Name of the system."),
        default = _("systemname"),
        required = True)

#    manufacturer = TextLine(
#        max_length = 500,
#        title = _("Manufacturer"),
#        description = _("Name/Address of the manufacturer."),
#        default = u"",
#        required = False)
#
#    vendor = TextLine(
#        max_length = 500,
#        title = _("Vendor"),
#        description = _("Name/Address of the vendor."),
#        default = u"",
#        required = False)
#
#    hostGroups = Set(
#        title = _("host groups"),
#        value_type = Choice(
#            title = _("host"),
#            vocabulary="AllHostGroups"),
#        default = set([]),
#        readonly = False,
#        required = True)
#
#    productionState = Choice(
#        title = _("Production state"),
#        vocabulary="AllHostProductionStates",
#        default = 'production',
#        readonly = False,
#        required = True)
#
#    workinggroup = TextLine(
#        max_length = 500,
#        title = _("Workinggroup"),
#        description = _("Name of the workinggroup."),
#        default = u"",
#        required = False)
#
#    hardware = TextLine(
#        max_length = 500,
#        title = _("Hardware"),
#        description = _("Hardware of the system."),
#        default = u"",
#        required = False)
#
#    user = TextLine(
#        max_length = 500,
#        title = _("User"),
#        description = _("User which is working with the system."),
#        default = u"",
#        required = False)
#
#
#    inv_id = TextLine(
#        max_length = 500,
#        title = _("inventory id"),
#        description = _("Id of inventory."),
#        default = u"",
#        required = False)
#
#    room = Choice(
#        title = _("Room"),
#        description = _("The Room Description."),
#        vocabulary="AllRoomsVocab",
#        required = False)
#
#    osList = List (
#        title = _("operating systems"),
#        description = _("list of possible operating systems"),
#        value_type = TextLine(
#            max_length = 200,
#            title = _("Operatingsystem"),
#            description = _("The OS Description."),
#            default = u"",
#            required = False),
#        default = [],
#        required = False)
#
#    snmpVersion = Choice(
#        title = _("SNMP version"),
#        vocabulary="SnmpVersions",
#        default = u"0", # SNMP V1
#        required = False)
#    
#    snmpPort = Int(
#        min = 1,
#        max = 65535,
#        title = _("SNMP port"),
#        default = 161,
#        required = False)
#
#    snmpReadCommunity = TextLine(
#        max_length = 80,
#        title = _("SNMP read community"),
#        default = u"public",
#        required = False)
#
#    snmpWriteCommunity = TextLine(
#        max_length = 80,
#        title = _("SNMP write community"),
#        default = u"private",
#        required = False)
#
#    url = TextLine(
#        max_length = 80,
#        title = _("URL"),
#        description = _("URL of system."),
#        default = u"",
#        required = False)
#        
#    url_type = Choice(
#        title = _("URL browser type"),
#        description = _("Type of browser window"),
#        default = "direct",
#        values = ['direct', 'proxy', 'direct extern', 'proxy extern'],
#        required = True)
#
#    url_authname = TextLine(
#        max_length = 80,
#        title = _("URL Username"),
#        description = _("Username for url-browser login"),
#        default = u"",
#        required = False)
#
#    url_authpasswd = Password(
#        max_length = 80,
#        title = _("URL Password"),
#        description = _("Password for url-browser login"),
#        default = u"",
#        required = False)
#
#    console = TextLine(
#        max_length = 80,
#        title = _("Console"),
#        description = _("Console of system."),
#        default = u"",
#        required = False)
#
#    genNagios = Bool(
#        title = _("for Nagios"),
#        description = _("enabled in Nagios"),
#        default = False,
#        required = False)

    def trigger_online():
        """
        trigger workflow
        """

    def trigger_offline():
        """
        trigger workflow
        """

    def trigger_not1():
        """
        trigger workflow
        """
        
    def getIpList():
        """ get a list of all possible ips
Example #22
0
class ISchoolFolder(Interface):
    """Marker interface for .SchoolFolder.SchoolFolder
    """

    contains('UWOshMusicRecruiting.content.interfaces.ISchool')
Example #23
0
class IFacultyMemberFolder(Interface):
    """Marker interface for .FacultyMemberFolder.FacultyMemberFolder
    """

    contains('UWOshMusicRecruiting.content.interfaces.IFacultyMember')
Example #24
0
class IVisitFolder(Interface):
    """Marker interface for .VisitFolder.VisitFolder
    """
    contains('UWOshMusicRecruiting.content.interfaces.IVisit')