コード例 #1
0
ファイル: __init__.py プロジェクト: annndrey/npui
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_core.models import (GlobalSetting, Group,
                                            GroupCapability, Privilege)

        if not vpair.is_install:
            return

        privs = (Privilege(code='BASE_SESSIONS', name=_('Menu: Sessions')),
                 Privilege(code='SESSIONS_LIST', name=_('Sessions: List')),
                 Privilege(code='SESSIONS_LIST_ARCHIVED',
                           name=_('Sessions: List archived')),
                 Privilege(code='SESSIONS_DISCONNECT',
                           name=_('Sessions: Disconnect')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass

        global_settings = (GlobalSetting(name='sessions.acct.interval',
                                         value='60'),
                           GlobalSetting(name='sessions.acct.stale_cutoff',
                                         value='130'))
        for gs in global_settings:
            sess.add(gs)
コード例 #2
0
ファイル: __init__.py プロジェクト: annndrey/npui
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_core.models import (Group, GroupCapability, Privilege)

        if not vpair.is_install:
            return

        privs = (Privilege(code='NAS_LIST', name=_('NASes: List')),
                 Privilege(code='NAS_CREATE', name=_('NASes: Create')),
                 Privilege(code='NAS_EDIT', name=_('NASes: Edit')),
                 Privilege(code='NAS_DELETE', name=_('NASes: Delete')),
                 Privilege(code='IPPOOLS_LIST', name=_('IP Pools: List')),
                 Privilege(code='IPPOOLS_CREATE', name=_('IP Pools: Create')),
                 Privilege(code='IPPOOLS_EDIT', name=_('IP Pools: Edit')),
                 Privilege(code='IPPOOLS_DELETE', name=_('IP Pools: Delete')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass
コード例 #3
0
ファイル: __init__.py プロジェクト: annndrey/npui
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_core.models import (Group, GroupCapability, Privilege)

        if not vpair.is_install:
            return

        privs = (Privilege(code='BASE_DOCUMENTS', name=_('Menu: Documents')),
                 Privilege(code='DOCUMENTS_LIST', name=_('Documents: List')),
                 Privilege(code='DOCUMENTS_CREATE',
                           name=_('Documents: Create')),
                 Privilege(code='DOCUMENTS_EDIT', name=_('Documents: Edit')),
                 Privilege(code='DOCUMENTS_DELETE',
                           name=_('Documents: Delete')),
                 Privilege(code='DOCUMENTS_GENERATE',
                           name=_('Documents: Generate')),
                 Privilege(code='DOCUMENTS_BUNDLES_CREATE',
                           name=_('Documents: Create bundles')),
                 Privilege(code='DOCUMENTS_BUNDLES_EDIT',
                           name=_('Documents: Edit bundles')),
                 Privilege(code='DOCUMENTS_BUNDLES_DELETE',
                           name=_('Documents: Delete bundles')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass
コード例 #4
0
ファイル: __init__.py プロジェクト: nikitos/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_entities.models import Entity
		from netprofile_access import models
		from netprofile_core.models import (
			Group,
			GroupCapability,
			Privilege
		)

		etab = Entity.__table__
		sess.execute(AlterTableAlterColumn(etab, etab.c['etype']))

		privs = (
			Privilege(
				code='ENTITIES_ACCOUNTSTATE_EDIT',
				name='Entities: Edit Account State'
			),
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass
コード例 #5
0
ファイル: __init__.py プロジェクト: annndrey/npui
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_core.models import (
			Group,
			GroupCapability,
			Privilege
		)

		if not vpair.is_install:
			return

		privs = (
			Privilege(
				code='BASE_XOP',
				name=_('Menu: External operations')
			),
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass
コード例 #6
0
ファイル: __init__.py プロジェクト: annndrey/npui
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_core.models import (
			Group,
			GroupCapability,
			Privilege
		)

		if not vpair.is_install:
			return

		privs = (
			Privilege(
				code='BASE_DOCUMENTS',
				name=_('Menu: Documents')
			),
			Privilege(
				code='DOCUMENTS_LIST',
				name=_('Documents: List')
			),
			Privilege(
				code='DOCUMENTS_CREATE',
				name=_('Documents: Create')
			),
			Privilege(
				code='DOCUMENTS_EDIT',
				name=_('Documents: Edit')
			),
			Privilege(
				code='DOCUMENTS_DELETE',
				name=_('Documents: Delete')
			),
			Privilege(
				code='DOCUMENTS_GENERATE',
				name=_('Documents: Generate')
			),
			Privilege(
				code='DOCUMENTS_BUNDLES_CREATE',
				name=_('Documents: Create bundles')
			),
			Privilege(
				code='DOCUMENTS_BUNDLES_EDIT',
				name=_('Documents: Edit bundles')
			),
			Privilege(
				code='DOCUMENTS_BUNDLES_DELETE',
				name=_('Documents: Delete bundles')
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass
コード例 #7
0
ファイル: __init__.py プロジェクト: baloon11/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		sess.add(LogType(
			id=14,
			name='Paid Services'
		))

		privs = (
			Privilege(
				code='BASE_PAIDSERVICES',
				name='Access: Paid Services'
			),
			Privilege(
				code='PAIDSERVICES_LIST',
				name='Paid Services: List'
			),
			Privilege(
				code='PAIDSERVICES_CREATE',
				name='Paid Services: Create'
			),
			Privilege(
				code='PAIDSERVICES_EDIT',
				name='Paid Services: Edit'
			),
			Privilege(
				code='PAIDSERVICES_DELETE',
				name='Paid Services: Delete'
			),
			Privilege(
				code='PAIDSERVICETYPES_CREATE',
				name='Paid Services: Create types'
			),
			Privilege(
				code='PAIDSERVICETYPES_EDIT',
				name='Paid Services: Edit types'
			),
			Privilege(
				code='PAIDSERVICETYPES_DELETE',
				name='Paid Services: Delete types'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass
コード例 #8
0
ファイル: __init__.py プロジェクト: annndrey/npui
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_core.models import (
			Group,
			GroupCapability,
			Privilege
		)

		if not vpair.is_install:
			return

		privs = (
			Privilege(
				code='NAS_LIST',
				name=_('NASes: List')
			),
			Privilege(
				code='NAS_CREATE',
				name=_('NASes: Create')
			),
			Privilege(
				code='NAS_EDIT',
				name=_('NASes: Edit')
			),
			Privilege(
				code='NAS_DELETE',
				name=_('NASes: Delete')
			),
			Privilege(
				code='IPPOOLS_LIST',
				name=_('IP Pools: List')
			),
			Privilege(
				code='IPPOOLS_CREATE',
				name=_('IP Pools: Create')
			),
			Privilege(
				code='IPPOOLS_EDIT',
				name=_('IP Pools: Edit')
			),
			Privilege(
				code='IPPOOLS_DELETE',
				name=_('IP Pools: Delete')
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass
コード例 #9
0
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		if not vpair.is_install:
			return

		sess.add(LogType(
			id=8,
			name='IPv4 Addresses'
		))
		sess.add(LogType(
			id=19,
			name='IPv6 Addresses'
		))

		privs = (
			Privilege(
				code='BASE_IPADDR',
				name=_('Menu: IP addresses')
			),
			Privilege(
				code='IPADDR_LIST',
				name=_('IP Addresses: List')
			),
			Privilege(
				code='IPADDR_CREATE',
				name=_('IP Addresses: Create')
			),
			Privilege(
				code='IPADDR_EDIT',
				name=_('IP Addresses: Edit')
			),
			Privilege(
				code='IPADDR_DELETE',
				name=_('IP Addresses: Delete')
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass
コード例 #10
0
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_networks.models import NetworkServiceType
        from netprofile_core.models import (Group, GroupCapability, LogType,
                                            Privilege)

        if not vpair.is_install:
            return

        sess.add(LogType(id=6, name='Networks'))

        privs = (Privilege(code='BASE_NETS', name=_('Menu: Networks')),
                 Privilege(code='NETS_LIST', name=_('Networks: List')),
                 Privilege(code='NETS_CREATE', name=_('Networks: Create')),
                 Privilege(code='NETS_EDIT', name=_('Networks: Edit')),
                 Privilege(code='NETS_DELETE', name=_('Networks: Delete')),
                 Privilege(code='NETGROUPS_CREATE',
                           name=_('Networks: Create groups')),
                 Privilege(code='NETGROUPS_EDIT',
                           name=_('Networks: Edit groups')),
                 Privilege(code='NETGROUPS_DELETE',
                           name=_('Networks: Delete groups')),
                 Privilege(code='NETS_SERVICETYPES_CREATE',
                           name=_('Networks: Create service types')),
                 Privilege(code='NETS_SERVICETYPES_EDIT',
                           name=_('Networks: Edit service types')),
                 Privilege(code='NETS_SERVICETYPES_DELETE',
                           name=_('Networks: Delete service types')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass

        nstypes = (models.NetworkServiceType(id=1, name=_('Name Server')),
                   models.NetworkServiceType(id=2, name=_('WINS Server')),
                   models.NetworkServiceType(id=3, name=_('NTP Server')),
                   models.NetworkServiceType(id=4, name=_('Gateway')),
                   models.NetworkServiceType(id=5, name=_('SLP DA Server')),
                   models.NetworkServiceType(id=6, name=_('DNSv6 Server')))

        for nst in nstypes:
            sess.add(nst)
コード例 #11
0
ファイル: __init__.py プロジェクト: annndrey/npui
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_core.models import (
			GlobalSetting,
			Group,
			GroupCapability,
			Privilege
		)

		if not vpair.is_install:
			return

		privs = (
			Privilege(
				code='BASE_SESSIONS',
				name=_('Menu: Sessions')
			),
			Privilege(
				code='SESSIONS_LIST',
				name=_('Sessions: List')
			),
			Privilege(
				code='SESSIONS_LIST_ARCHIVED',
				name=_('Sessions: List archived')
			),
			Privilege(
				code='SESSIONS_DISCONNECT',
				name=_('Sessions: Disconnect')
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		global_settings = (
			GlobalSetting(name='sessions.acct.interval', value='60'),
			GlobalSetting(name='sessions.acct.stale_cutoff', value='130')
		)
		for gs in global_settings:
			sess.add(gs)
コード例 #12
0
ファイル: __init__.py プロジェクト: unikmhz/npui
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_core.models import (
            Group,
            GroupCapability,
            LogType,
            Privilege
        )

        if not vpair.is_install:
            return

        sess.add(LogType(id=15,
                         name='Bills'))
        sess.flush()

        privs = (Privilege(code='BASE_BILLS',
                           name=_('Menu: Bills')),
                 Privilege(code='BILLS_LIST',
                           name=_('Bills: List')),
                 Privilege(code='BILLS_CREATE',
                           name=_('Bills: Create')),
                 Privilege(code='BILLS_EDIT',
                           name=_('Bills: Edit')),
                 Privilege(code='BILLS_DELETE',
                           name=_('Bills: Delete')),
                 Privilege(code='BILLS_OPS',
                           name=_('Bills: Operations')),
                 Privilege(code='BILLS_TYPES_CREATE',
                           name=_('Bills: Create types')),
                 Privilege(code='BILLS_TYPES_EDIT',
                           name=_('Bills: Edit types')),
                 Privilege(code='BILLS_TYPES_DELETE',
                           name=_('Bills: Delete types')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                    Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass
コード例 #13
0
ファイル: __init__.py プロジェクト: annndrey/npui
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_core.models import (Group, GroupCapability, Privilege)

        if not vpair.is_install:
            return

        privs = (Privilege(code='BASE_XOP',
                           name=_('Menu: External operations')), )
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass
コード例 #14
0
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_core.models import (
			Group,
			GroupCapability,
			Privilege
		)
		from netprofile_entities.models import EntityType

		if not vpair.is_install:
			return

		privs = (
			Privilege(
				code='ENTITIES_ACCOUNTSTATE_EDIT',
				name=_('Entities: Edit account state')
			),
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		sess.add(EntityType(
			id=5,
			name=_('Account'),
			module=modobj,
			model='AccessEntity',
			long_name=_('Account'),
			plural=_('Accounts'),
			root=False,
			leaf=True,
			description=_('Account details for network admission and client UI access.')
		))
コード例 #15
0
ファイル: __init__.py プロジェクト: baloon11/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_core.models import (
			Group,
			GroupCapability,
			Privilege
		)

		privs = (
			Privilege(
				code='BASE_GEO',
				name='Access: Addresses'
			),
			Privilege(
				code='GEO_LIST',
				name='Addresses: List'
			),
			Privilege(
				code='GEO_CREATE',
				name='Addresses: Create'
			),
			Privilege(
				code='GEO_EDIT',
				name='Addresses: Edit'
			),
			Privilege(
				code='GEO_DELETE',
				name='Addresses: Delete'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass
コード例 #16
0
ファイル: __init__.py プロジェクト: annndrey/npui
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_core.models import (Group, GroupCapability, LogType,
                                            Privilege)

        if not vpair.is_install:
            return

        sess.add(LogType(id=14, name='Paid Services'))

        privs = (Privilege(code='BASE_PAIDSERVICES',
                           name=_('Menu: Paid services')),
                 Privilege(code='PAIDSERVICES_LIST',
                           name=_('Paid Services: List')),
                 Privilege(code='PAIDSERVICES_CREATE',
                           name=_('Paid Services: Create')),
                 Privilege(code='PAIDSERVICES_EDIT',
                           name=_('Paid Services: Edit')),
                 Privilege(code='PAIDSERVICES_DELETE',
                           name=_('Paid Services: Delete')),
                 Privilege(code='PAIDSERVICETYPES_CREATE',
                           name=_('Paid Services: Create types')),
                 Privilege(code='PAIDSERVICETYPES_EDIT',
                           name=_('Paid Services: Edit types')),
                 Privilege(code='PAIDSERVICETYPES_DELETE',
                           name=_('Paid Services: Delete types')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass
コード例 #17
0
ファイル: __init__.py プロジェクト: hermes-jr/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_entities import models
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		sess.add(LogType(
			id=2,
			name='Entities'
		))
		sess.flush()

		privs = (
			Privilege(
				code='BASE_ENTITIES',
				name='Access: Entities'
			),
			Privilege(
				code='ENTITIES_LIST',
				name='Entities: List'
			),
			Privilege(
				code='ENTITIES_CREATE',
				name='Entities: Create'
			),
			Privilege(
				code='ENTITIES_EDIT',
				name='Entities: Edit'
			),
			Privilege(
				code='ENTITIES_DELETE',
				name='Entities: Delete'
			),
			Privilege(
				code='FILES_ATTACH_2ENTITIES',
				name='Files: Attach to entities'
			),
			Privilege(
				code='ENTITIES_STATES_CREATE',
				name='Entities: Create states'
			),
			Privilege(
				code='ENTITIES_STATES_EDIT',
				name='Entities: Edit states'
			),
			Privilege(
				code='ENTITIES_STATES_DELETE',
				name='Entities: Delete states'
			),
			Privilege(
				code='ENTITIES_FLAGTYPES_CREATE',
				name='Entities: Create flag types'
			),
			Privilege(
				code='ENTITIES_FLAGTYPES_EDIT',
				name='Entities: Edit flag types'
			),
			Privilege(
				code='ENTITIES_FLAGTYPES_DELETE',
				name='Entities: Delete flag types'
			),
			Privilege(
				code='ENTITIES_COMMENT',
				name='Entities: Add comments'
			),
			Privilege(
				code='ENTITIES_COMMENTS_EDIT',
				name='Entities: Edit comments'
			),
			Privilege(
				code='ENTITIES_COMMENTS_DELETE',
				name='Entities: Delete comments'
			),
			Privilege(
				code='ENTITIES_COMMENTS_MARK',
				name='Entities: Mark comments as obsolete'
			),
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		sess.add(models.EntityState(
			name='Default',
			description='Default entity state. You can safely rename and/or delete it if you wish.'
		))
コード例 #18
0
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_hosts.models import (ServiceType, ServiceProtocol)
        from netprofile_core.models import (Group, GroupCapability, LogType,
                                            Privilege)

        if not vpair.is_install:
            return

        sess.add(LogType(id=4, name='Hosts'))
        sess.add(LogType(id=10, name='Services'))
        sess.flush()

        privs = (Privilege(code='BASE_HOSTS', name=_('Menu: Hosts')),
                 Privilege(code='HOSTS_LIST', name=_('Hosts: List')),
                 Privilege(code='HOSTS_CREATE', name=_('Hosts: Create')),
                 Privilege(code='HOSTS_EDIT', name=_('Hosts: Edit')),
                 Privilege(code='HOSTS_DELETE', name=_('Hosts: Delete')),
                 Privilege(code='HOSTS_GROUPS_CREATE',
                           name=_('Hosts: Create groups')),
                 Privilege(code='HOSTS_GROUPS_EDIT',
                           name=_('Hosts: Edit groups')),
                 Privilege(code='HOSTS_GROUPS_DELETE',
                           name=_('Hosts: Delete groups')),
                 Privilege(code='BASE_SERVICES', name=_('Menu: Services')),
                 Privilege(code='SERVICES_LIST', name=_('Services: List')),
                 Privilege(code='SERVICES_CREATE', name=_('Services: Create')),
                 Privilege(code='SERVICES_EDIT', name=_('Services: Edit')),
                 Privilege(code='SERVICES_DELETE', name=_('Services: Delete')),
                 Privilege(code='SERVICES_TYPES_CREATE',
                           name=_('Services: Create types')),
                 Privilege(code='SERVICES_TYPES_EDIT',
                           name=_('Services: Edit types')),
                 Privilege(code='SERVICES_TYPES_DELETE',
                           name=_('Services: Delete types')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass

        stypes = (
            ('domain', 'Domain Name System', 'tcp', 53, 53, 'dns,nameserver'),
            ('domain', 'Domain Name System', 'udp', 53, 53,
             'dns,nameserver'), ('ftp', 'File Transfer Protocol', 'tcp', 21,
                                 21, 'fsp, fspd, fxp'),
            ('ftp-data', 'File Transfer Protocol Data Stream', 'tcp', 20, 20,
             'fsp-data,fspd-data,fxp-data'),
            ('imap', 'Internet Message Access Protocol', 'tcp', 143, 143,
             'imap2'),
            ('imaps', 'Internet Message Access Protocol over SSL/TLS', 'tcp',
             993, 993,
             'imap2s,simap'), ('nntp', 'Network News Transfer Protocol', 'tcp',
                               119, 119, 'readnews,untp'),
            ('nntps', 'Network News Transfer Protocol over SSL/TLS',
             'tcp', 563, 563, 'untps,snntp'),
            ('pop3', 'Post Office Protocol version 3', 'tcp', 110, 110,
             'pop-3'), ('pop3s', 'Post Office Protocol version 3 over SSL/TLS',
                        'tcp', 995, 995, 'spop3,pop-3s'),
            ('pptp', 'Point-to-Point Tunneling Protocol', 'tcp', 1723, 1723,
             'pptpd'), ('smtp', 'Simple Mail Transfer Protocol', 'tcp', 25, 25,
                        'mail'), ('smtps',
                                  'Simple Mail Transfer Protocol over SSL/TLS',
                                  'tcp', 465, 465, 'ssmtp,smail,mails'),
            ('submission', 'Message Submission Agent', 'tcp', 587, 587,
             None), ('http', 'Hypertext Transfer Protocol', 'tcp', 80, 80,
                     'www,www-http,http-www'),
            ('https', 'Hypertext Transfer Protocol over SSL/TLS', 'tcp', 443,
             443, 'www-https,https-www'), ('ircd', 'Internet Relay Chat',
                                           'tcp', 6667, 6667, None),
            ('ssh', 'Secure Shell', 'tcp', 22, 22,
             None), ('telnet', 'Telnet Service', 'tcp', 23, 23,
                     'telnetd'), ('kerberos', 'Kerberos Auth Service', 'tcp',
                                  88, 88, 'kerberos5,krb5'),
            ('kerberos', 'Kerberos Auth Service', 'udp', 88, 88,
             'kerberos5, krb5'), ('ldap',
                                  'Lightweight Directory Access Protocol',
                                  'tcp', 389, 389, 'nds'),
            ('ldaps', 'Lightweight Directory Access Protocol over SSL/TLS',
             'tcp', 636, 636,
             'sldap,ndss,snds'), ('kerberos-master',
                                  'Kerberos Master Auth Service', 'udp', 88,
                                  88, 'kerberos5-master,krb5-master'),
            ('kerberos-adm', 'Kerberos Administration Service', 'tcp', 749,
             749, 'kerberos5-adm,krb5-adm'), ('kpasswd',
                                              'Kerberos Master Passwd Service',
                                              'udp', 464, 464, 'kpwd'),
            ('kerberos-iv', 'Kerberos IV Auth Service', 'udp', 750, 750,
             'kerberos4,kdc,krb4'), ('timed', 'Time Service', 'udp', 525, 525,
                                     'timeserver'), ('ntp',
                                                     'Network Time Protocol',
                                                     'udp', 123, 123, 'sntp'),
            ('netbios-ns', 'NetBIOS Name Service', 'tcp', 137, 137,
             None), ('netbios-ns', 'NetBIOS Name Service', 'udp', 137, 137,
                     None), ('netbios-dgm', 'NetBIOS Datagram Service', 'tcp',
                             138, 138, None),
            ('netbios-dgm', 'NetBIOS Datagram Service', 'udp', 138, 138,
             None), ('netbios-ssn', 'NetBIOS Session Service', 'tcp', 139, 139,
                     None), ('netbios-ssn', 'NetBIOS Session Service', 'udp',
                             139, 139, None), ('microsoft-ds', 'Microsoft DS',
                                               'tcp', 445, 445,
                                               'Microsoft-DS'),
            ('imsp', 'Interactive Mail Support Protocol', 'tcp', 406, 406,
             None), ('epmap', 'DCE Endpoint Resolution Protocol', 'tcp', 135,
                     135, 'loc-srv'), ('epmap',
                                       'DCE Endpoint Resolution Protocol',
                                       'udp', 135, 135, 'loc-srv'),
            ('mysql', 'MySQL RDBMS Service', 'tcp', 3306, 3306,
             None), ('postgresql', 'PostgreSQL RDBMS Service', 'tcp', 5432,
                     5432, None), ('kftp', 'Kerberos V File Transfer Protocol',
                                   'tcp', 6621, 6621, None),
            ('kftp-data', 'Kerberos V File Transfer Protocol Data Stream',
             'tcp', 6620, 6620,
             None), ('ktelnet', 'Kerberos V Telnet Service', 'tcp', 6623, 6623,
                     None), ('soap-http', 'SOAP HTTP Service', 'tcp', 7627,
                             7627, 'http-soap'), ('bootps',
                                                  'Bootstrap Protocol Server',
                                                  'udp', 67, 67, None),
            ('tftp', 'Trivial File Transfer Protocol', 'udp', 69, 69,
             None), ('rtelnet', 'Remote Telnet Service', 'tcp', 107, 107,
                     None), ('rtelnet', 'Remote Telnet Service', 'udp', 107,
                             107, None), ('jabber', 'Jabber IM Service', 'tcp',
                                          5269, 5269, None),
            ('xmpp-server', 'Jabber XMPP Protocol Server', 'tcp', 5269, 5269,
             None), ('xmpp-client', 'Jabber XMPP Protocol Client', 'tcp', 5222,
                     5222,
                     None), ('xmpp-client-ssl',
                             'Jabber XMPP Protocol Client over SSL/TLS', 'tcp',
                             5223, 5223, None), ('radius', 'RADIUS Service',
                                                 'tcp', 1812, 1812, None),
            ('radius', 'RADIUS Service', 'udp', 1812, 1812,
             None), ('radius-acct', 'RADIUS Accounting Service', 'tcp', 1813,
                     1813,
                     'radacct'), ('radius-acct', 'RADIUS Accounting Service',
                                  'udp', 1813, 1813,
                                  'radacct'), ('radius-dynauth',
                                               'RADIUS Dynamic Authorization',
                                               'tcp', 3799, 3799, None),
            ('radius-dynauth', 'RADIUS Dynamic Authorization', 'udp', 3799,
             3799, None), ('tacacs', 'Login Host Protocol (TACACS)', 'tcp', 49,
                           49, None), ('tacacs',
                                       'Login Host Protocol (TACACS)', 'udp',
                                       49, 49, None),
            ('tacacs-ds', 'TACACS Database Service', 'tcp', 65, 65,
             None), ('tacacs-ds', 'TACACS Database Service', 'udp', 65, 65,
                     None), ('finger', 'Finger Service', 'tcp', 79, 79,
                             'fingerd'), ('pop2',
                                          'Post Office Protocol version 2',
                                          'tcp', 109, 109, 'pop-2,postoffice'),
            ('sunrpc', 'SUN Remote Procedure Call', 'tcp', 111, 111,
             'portmapper'), ('sunrpc', 'SUN Remote Procedure Call', 'udp', 111,
                             111,
                             'portmapper'), ('auth', 'Authentication Service',
                                             'tcp', 113, 113,
                                             'authentication,tap,ident'),
            ('snmp', 'Simple Network Management Protocol', 'tcp', 161, 161,
             None), ('snmp', 'Simple Network Management Protocol', 'udp', 161,
                     161, None), ('snmptrap', 'SNMP Trap Port', 'tcp', 162,
                                  162, 'snmp-trap'), ('snmptrap',
                                                      'SNMP Trap Port', 'udp',
                                                      162, 162, 'snmp-trap'),
            ('bgp', 'Border Gateway Protocol', 'tcp', 179, 179,
             None), ('bgp', 'Border Gateway Protocol', 'udp', 179, 179,
                     None), ('bgp', 'Border Gateway Protocol', 'sctp', 179,
                             179, None), ('smux', 'SNMP Multiplexing', 'tcp',
                                          199, 199,
                                          None), ('smux', 'SNMP Multiplexing',
                                                  'udp', 199, 199, None),
            ('imap3', 'Interactive Mail Access Protocol version 3', 'tcp', 220,
             220,
             None), ('imap3', 'Interactive Mail Access Protocol version 3',
                     'udp', 220, 220,
                     None), ('snpp', 'Simple Network Paging Protocol', 'tcp',
                             444, 444,
                             None), ('who', 'Who is Logged In Service', 'udp',
                                     513, 513, 'whod'),
            ('syslog', 'System Logging Service', 'udp', 514, 514,
             'syslogd'), ('utime', 'UNIX Time Service', 'tcp', 519, 519,
                          'unixtime'), ('utime', 'UNIX Time Service', 'udp',
                                        519, 519, 'unixtime'),
            ('klogin', 'Kerberos V Remote Login Service', 'tcp', 543, 543,
             'krlogin'), ('klogin', 'Kerberos V Remote Login Service', 'udp',
                          543, 543,
                          'krlogin'), ('kshell',
                                       'Kerberos V Remote Commands Service',
                                       'tcp', 544, 544, 'krcmd'),
            ('kshell', 'Kerberos V Remote Commands Service', 'udp', 544, 544,
             'krcmd'), ('ipp', 'Internet Printing Protocol', 'tcp', 631, 631,
                        None), ('ipp', 'Internet Printing Protocol', 'udp',
                                631, 631,
                                None), ('rsync', 'RSYNC Service', 'tcp', 873,
                                        873, None), ('rsync', 'RSYNC Service',
                                                     'udp', 873, 873, None),
            ('ftps', 'File Transfer Protocol over SSL/TLS', 'tcp', 990, 990,
             None), ('ftps-data',
                     'File Transfer Protocol Data Stream over SSL/TLS', 'tcp',
                     989, 989, None), ('telnets',
                                       'Telnet Service over SSL/TLS', 'tcp',
                                       992, 992, 'stelnet'),
            ('socks', 'Socks Proxy Server', 'tcp', 1080, 1080,
             None), ('socks', 'Socks Proxy Server', 'udp', 1080, 1080,
                     None), ('openvpn', 'OpenVPN Service', 'tcp', 1194, 1194,
                             'open-vpn'), ('openvpn', 'OpenVPN Service', 'udp',
                                           1194, 1194, 'open-vpn'),
            ('wins', 'Windows Internet Name Service', 'tcp', 1512, 1512,
             None), ('wins', 'Windows Internet Name Service', 'udp', 1512,
                     1512, None), ('l2tp', 'Level 2 Tunneling Protocol', 'tcp',
                                   1701, 1701, 'l2f'),
            ('l2tp', 'Level 2 Tunneling Protocol', 'udp', 1701, 1701,
             'l2f'), ('mysql-im', 'MySQL Instance Manager Service', 'tcp',
                      2273, 2273,
                      'mysqlim'), ('icpv2', 'Internet Cache Protocol', 'tcp',
                                   3130, 3130,
                                   'icp'), ('icpv2', 'Internet Cache Protocol',
                                            'udp', 3130, 3130, 'icp'),
            ('daap', 'Digital Audio Access Protocol', 'tcp', 3689, 3689,
             None), ('daap', 'Digital Audio Access Protocol', 'udp', 3689,
                     3689, None), ('xgrid', 'Mac OS X Server Xgrid', 'tcp',
                                   4111, 4111,
                                   None), ('xgrid', 'Mac OS X Server Xgrid',
                                           'udp', 4111, 4111,
                                           None), ('mdns', 'Multicast DNS',
                                                   'udp', 5353, 5353, None),
            ('mdnsresponder', 'Multicast DNS Responder IPC', 'udp', 5354, 5354,
             None), ('sip', 'Session Initiation Protocol', 'tcp', 5060, 5060,
                     None), ('sip', 'Session Initiation Protocol', 'udp', 5060,
                             5060,
                             None), ('sip', 'Session Initiation Protocol',
                                     'sctp', 5060, 5060,
                                     None), ('sip',
                                             'Session Initiation Protocol',
                                             'tls', 443, 443, None),
            ('sips', 'Session Initiation Protocol over SSL/TLS', 'tcp', 5061,
             5061, None), ('sips', 'Session Initiation Protocol over SSL/TLS',
                           'udp', 5061, 5061,
                           None), ('sips',
                                   'Session Initiation Protocol over SSL/TLS',
                                   'sctp', 5061, 5061,
                                   None), ('sipinternal',
                                           'SIP for internal OCS clients',
                                           'tcp', 5060, 5060, None),
            ('sipinternaltls', 'SIP for internal OCS clients over SSL/TLS',
             'tcp', 5061, 5061,
             None), ('sipfederationtls', 'SIP federation for OCS', 'tcp', 5061,
                     5061,
                     None), ('iax', 'Inter-Asterisk eXchange 2 Service',
                             'udp', 4569, 4569,
                             'iax2'), ('caldav', 'CalDAV Service', 'tcp', 80,
                                       80,
                                       None), ('caldavs',
                                               'CalDAV Service over SSL/TLS',
                                               'tcp', 443, 443, None),
            ('carddav', 'CardDAV Service', 'tcp', 80, 80,
             None), ('carddavs', 'CardDAV Service over SSL/TLS', 'tcp', 443,
                     443, None), ('citrixreceiver',
                                  'Citrix Receiver Service', 'tcp', 443, 443,
                                  None), ('avatars',
                                          'Libravatar Profile Image Service',
                                          'tcp', 80, 80, None),
            ('avatars-sec',
             'Libravatar Profile Image Service over SSL/TLS', 'tcp', 443, 443,
             None), ('minecraft', 'Minecraft Service', 'tcp', 25565, 25565,
                     None), ('x-puppet', 'Puppet Master', 'tcp', 8140, 8140,
                             None), ('ts3', 'TeamSpeak 3 Voice Server', 'udp',
                                     9987, 9987,
                                     None), ('tsdns',
                                             'TeamSpeak 3 TSDNS Service',
                                             'tcp', 41144, 41144, None))
        for t in stypes:
            st = ServiceType()
            st.abbreviation = t[0]
            st.name = t[1]
            st.protocol = ServiceProtocol.from_string(t[2])
            st.start_port = t[3]
            st.end_port = t[4]
            if t[5]:
                st.alias = t[5]
            sess.add(st)
コード例 #19
0
ファイル: __init__.py プロジェクト: hermes-jr/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_confgen.models import ServerType
		from netprofile_core.models import (
			Group,
			GroupCapability,
			Privilege
		)

		privs = (
			Privilege(
				code='SRV_LIST',
				name='Servers: List'
			),
			Privilege(
				code='SRV_CREATE',
				name='Servers: Create'
			),
			Privilege(
				code='SRV_EDIT',
				name='Servers: Edit'
			),
			Privilege(
				code='SRV_DELETE',
				name='Servers: Delete'
			),
			Privilege(
				code='SRV_CONFGEN',
				name='Servers: Generate configuration'
			),
			Privilege(
				code='SRVTYPES_CREATE',
				name='Servers: Create types'
			),
			Privilege(
				code='SRVTYPES_EDIT',
				name='Servers: Edit types'
			),
			Privilege(
				code='SRVTYPES_DELETE',
				name='Servers: Delete types'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		bind_defaults = {
			'key_name_gen'           : 'nslink.',
			'key_name_int'           : 'nsexternal.',
			'key_name_ext'           : 'nsinternal.',
# TODO: generate these at install time to be somewhat secure even w/o configuration
#			'key_value_gen'          : None,
#			'key_value_int'          : None,
#			'key_value_ext'          : None,
			'key_algo_gen'           : 'hmac-md5',
			'key_algo_int'           : 'hmac-md5',
			'key_algo_ext'           : 'hmac-md5',
			'revzone_refresh'        : 3600,
			'revzone_retry'          : 300,
			'revzone_expire'         : 1814400,
			'revzone_minimum'        : 3600,
#			'default_domain'         : None,
#			'hostmaster'             : None,
			'dnssec'                 : 'true',
			'dnssec_accept_expired'  : 'false',
			'split_dns'              : 'false',
			'only_external'          : 'false',
			'gen_spf'                : 'true',
			'gen_dkim'               : 'false',
			'gen_dmarc'              : 'false'
		};

		stypes = (
			ServerType(
				id=1,
				name='ISC DHCP 3+',
				generator_name='iscdhcp',
				parameter_defaults={
					'dir_dhcp' : '/etc/dhcp'
				},
				description='ISC DHCP server version 3+.'
			),
			ServerType(
				id=2,
				name='ISC BIND 9.0-9.2',
				generator_name='iscbind9',
				parameter_defaults=bind_defaults,
				description='ISC BIND DNS server versions 9.0-9.2.'
			),
			ServerType(
				id=3,
				name='ISC BIND 9.3',
				generator_name='iscbind93',
				parameter_defaults=bind_defaults,
				description='ISC BIND DNS server version 9.3.'
			),
			ServerType(
				id=4,
				name='ISC BIND 9.4-9.8',
				generator_name='iscbind94',
				parameter_defaults=bind_defaults,
				description='ISC BIND DNS server versions 9.4-9.8.'
			),
			ServerType(
				id=5,
				name='Samba 3',
				generator_name='samba3',
				description='Samba NT domain server version 3.'
			),
			ServerType(
				id=6,
				name='OpenSLP',
				generator_name='openslp',
				description='OpenSLP server.'
			),
			ServerType(
				id=7,
				name='ISC BIND 9.9+',
				generator_name='iscbind99',
				parameter_defaults=bind_defaults,
				description='ISC BIND DNS server versions 9.9+.'
			)
		)

		for st in stypes:
			sess.add(st)
コード例 #20
0
ファイル: __init__.py プロジェクト: hermes-jr/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_hosts.models import (
			ServiceType,
			ServiceProtocol
		)
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		sess.add(LogType(
			id=4,
			name='Hosts'
		))
		sess.add(LogType(
			id=10,
			name='Services'
		))
		sess.flush()

		privs = (
			Privilege(
				code='BASE_HOSTS',
				name='Access: Hosts'
			),
			Privilege(
				code='HOSTS_LIST',
				name='Host: List'
			),
			Privilege(
				code='HOSTS_CREATE',
				name='Hosts: Create'
			),
			Privilege(
				code='HOSTS_EDIT',
				name='Hosts: Edit'
			),
			Privilege(
				code='HOSTS_DELETE',
				name='Hosts: Delete'
			),
			Privilege(
				code='HOSTS_GROUPS_CREATE',
				name='Hosts: Create groups'
			),
			Privilege(
				code='HOSTS_GROUPS_EDIT',
				name='Hosts: Edit groups'
			),
			Privilege(
				code='HOSTS_GROUPS_DELETE',
				name='Hosts: Delete groups'
			),
			Privilege(
				code='BASE_SERVICES',
				name='Access: Services'
			),
			Privilege(
				code='SERVICES_LIST',
				name='Services: List'
			),
			Privilege(
				code='SERVICES_CREATE',
				name='Services: Create'
			),
			Privilege(
				code='SERVICES_EDIT',
				name='Services: Edit'
			),
			Privilege(
				code='SERVICES_DELETE',
				name='Services: Delete'
			),
			Privilege(
				code='SERVICES_TYPES_CREATE',
				name='Services: Create types'
			),
			Privilege(
				code='SERVICES_TYPES_EDIT',
				name='Services: Edit types'
			),
			Privilege(
				code='SERVICES_TYPES_DELETE',
				name='Services: Delete types'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		stypes = (
			('domain', 'Domain Name System', 'tcp', 53, 53, 'dns,nameserver'),
			('domain', 'Domain Name System', 'udp', 53, 53, 'dns,nameserver'),
			('ftp', 'File Transfer Protocol', 'tcp', 21, 21, 'fsp, fspd, fxp'),
			('ftp-data', 'File Transfer Protocol Data Stream', 'tcp', 20, 20, 'fsp-data,fspd-data,fxp-data'),
			('imap', 'Internet Message Access Protocol', 'tcp', 143, 143, 'imap2'),
			('imaps', 'Internet Message Access Protocol over SSL', 'tcp', 993, 993, 'imap2s,simap'),
			('nntp', 'Network News Transfer Protocol', 'tcp', 119, 119, 'readnews,untp'),
			('nntps', 'Network News Transfer Protocol over SSL', 'tcp', 563, 563, 'untps,snntp'),
			('pop3', 'Post Office Protocol version 3', 'tcp', 110, 110, 'pop-3'),
			('pop3s', 'Post Office Protocol version 3 over SSL', 'tcp', 995, 995, 'spop3,pop-3s'),
			('pptp', 'Point-to-Point Tunneling Protocol', 'tcp', 1723, 1723, 'pptpd'),
			('smtp', 'Simple Mail Transfer Protocol', 'tcp', 25, 25, 'mail'),
			('smtps', 'Simple Mail Transfer Protocol over SSL', 'tcp', 465, 465, 'ssmtp,smail,mails'),
			('http', 'Hypertext Transfer Protocol', 'tcp', 80, 80, 'www,www-http,http-www'),
			('https', 'Hypertext Transfer Protocol over SSL', 'tcp', 443, 443, 'www-https,https-www'),
			('ircd', 'Internet Relay Chat', 'tcp', 6667, 6667, None),
			('ssh', 'Secure Shell', 'tcp', 22, 22, None),
			('telnet', 'Telnet Service', 'tcp', 23, 23, 'telnetd'),
			('kerberos', 'Kerberos Auth Service', 'tcp', 88, 88, 'kerberos5,krb5'),
			('kerberos', 'Kerberos Auth Service', 'udp', 88, 88, 'kerberos5, krb5'),
			('ldap', 'Lightweight Directory Access Protocol', 'tcp', 389, 389, 'nds'),
			('ldaps', 'Lightweight Directory Access Protocol over SSL', 'tcp', 636, 636, 'sldap,ndss,snds'),
			('kerberos-master', 'Kerberos Master Auth Service', 'udp', 88, 88, 'kerberos5-master,krb5-master'),
			('kerberos-adm', 'Kerberos Administration Service', 'tcp', 749, 749, 'kerberos5-adm,krb5-adm'),
			('kpasswd', 'Kerberos Master Passwd Service', 'udp', 464, 464, 'kpwd'),
			('kerberos-iv', 'Kerberos IV Auth Service', 'udp', 750, 750, 'kerberos4,kdc,krb4'),
			('timed', 'Time Service', 'udp', 525, 525, 'timeserver'),
			('ntp', 'Network Time Protocol', 'udp', 123, 123, 'sntp'),
			('netbios-ns', 'NetBIOS Name Service', 'tcp', 137, 137, None),
			('netbios-ns', 'NetBIOS Name Service', 'udp', 137, 137, None),
			('netbios-dgm', 'NetBIOS Datagram Service', 'tcp', 138, 138, None),
			('netbios-dgm', 'NetBIOS Datagram Service', 'udp', 138, 138, None),
			('netbios-ssn', 'NetBIOS Session Service', 'tcp', 139, 139, None),
			('netbios-ssn', 'NetBIOS Session Service', 'udp', 139, 139, None),
			('microsoft-ds', 'Microsoft DS', 'tcp', 445, 445, 'Microsoft-DS'),
			('imsp', 'Interactive Mail Support Protocol', 'tcp', 406, 406, None),
			('epmap', 'DCE Endpoint Resolution Protocol', 'tcp', 135, 135, 'loc-srv'),
			('epmap', 'DCE Endpoint Resolution Protocol', 'udp', 135, 135, 'loc-srv'),
			('mysql', 'MySQL RDBMS Service', 'tcp', 3306, 3306, None),
			('postgresql', 'PostgreSQL RDBMS Service', 'tcp', 5432, 5432, None),
			('kftp', 'Kerberos V File Transfer Protocol', 'tcp', 6621, 6621, None),
			('kftp-data', 'Kerberos V File Transfer Protocol Data Stream', 'tcp', 6620, 6620, None),
			('ktelnet', 'Kerberos V Telnet Service', 'tcp', 6623, 6623, None),
			('soap-http', 'SOAP HTTP Service', 'tcp', 7627, 7627, 'http-soap'),
			('bootps', 'Bootstrap Protocol Server', 'udp', 67, 67, None),
			('tftp', 'Trivial File Transfer Protocol', 'udp', 69, 69, None),
			('rtelnet', 'Remote Telnet Service', 'tcp', 107, 107, None),
			('rtelnet', 'Remote Telnet Service', 'udp', 107, 107, None),
			('jabber', 'Jabber IM Service', 'tcp', 5269, 5269, None),
			('xmpp-server', 'Jabber XMPP Protocol Server', 'tcp', 5269, 5269, None),
			('xmpp-client', 'Jabber XMPP Protocol Client', 'tcp', 5222, 5222, None),
			('xmpp-client-ssl', 'Jabber XMPP Protocol Client over SSL', 'tcp', 5223, 5223, None),
			('radius', 'RADIUS Service', 'tcp', 1812, 1812, None),
			('radius', 'RADIUS Service', 'udp', 1812, 1812, None),
			('radius-acct', 'RADIUS Accounting Service', 'tcp', 1813, 1813, 'radacct'),
			('radius-acct', 'RADIUS Accounting Service', 'udp', 1813, 1813, 'radacct'),
			('radius-dynauth', 'RADIUS Dynamic Authorization', 'tcp', 3799, 3799, None),
			('radius-dynauth', 'RADIUS Dynamic Authorization', 'udp', 3799, 3799, None),
			('tacacs', 'Login Host Protocol (TACACS)', 'tcp', 49, 49, None),
			('tacacs', 'Login Host Protocol (TACACS)', 'udp', 49, 49, None),
			('tacacs-ds', 'TACACS Database Service', 'tcp', 65, 65, None),
			('tacacs-ds', 'TACACS Database Service', 'udp', 65, 65, None),
			('finger', 'Finger Service', 'tcp', 79, 79, 'fingerd'),
			('pop2', 'Post Office Protocol version 2', 'tcp', 109, 109, 'pop-2,postoffice'),
			('sunrpc', 'SUN Remote Procedure Call', 'tcp', 111, 111, 'portmapper'),
			('sunrpc', 'SUN Remote Procedure Call', 'udp', 111, 111, 'portmapper'),
			('auth', 'Authentication Service', 'tcp', 113, 113, 'authentication,tap,ident'),
			('snmp', 'Simple Network Management Protocol', 'tcp', 161, 161, None),
			('snmp', 'Simple Network Management Protocol', 'udp', 161, 161, None),
			('snmptrap', 'SNMP Trap Port', 'tcp', 162, 162, 'snmp-trap'),
			('snmptrap', 'SNMP Trap Port', 'udp', 162, 162, 'snmp-trap'),
			('bgp', 'Border Gateway Protocol', 'tcp', 179, 179, None),
			('bgp', 'Border Gateway Protocol', 'udp', 179, 179, None),
			('bgp', 'Border Gateway Protocol', 'sctp', 179, 179, None),
			('smux', 'SNMP Multiplexing', 'tcp', 199, 199, None),
			('smux', 'SNMP Multiplexing', 'udp', 199, 199, None),
			('imap3', 'Interactive Mail Access Protocol version 3', 'tcp', 220, 220, None),
			('imap3', 'Interactive Mail Access Protocol version 3', 'udp', 220, 220, None),
			('snpp', 'Simple Network Paging Protocol', 'tcp', 444, 444, None),
			('who', 'Who is Logged In Service', 'udp', 513, 513, 'whod'),
			('syslog', 'System Logging Service', 'udp', 514, 514, 'syslogd'),
			('utime', 'UNIX Time Service', 'tcp', 519, 519, 'unixtime'),
			('utime', 'UNIX Time Service', 'udp', 519, 519, 'unixtime'),
			('klogin', 'Kerberos V Remote Login Service', 'tcp', 543, 543, 'krlogin'),
			('klogin', 'Kerberos V Remote Login Service', 'udp', 543, 543, 'krlogin'),
			('kshell', 'Kerberos V Remote Commands Service', 'tcp', 544, 544, 'krcmd'),
			('kshell', 'Kerberos V Remote Commands Service', 'udp', 544, 544, 'krcmd'),
			('ipp', 'Internet Printing Protocol', 'tcp', 631, 631, None),
			('ipp', 'Internet Printing Protocol', 'udp', 631, 631, None),
			('rsync', 'RSYNC Service', 'tcp', 873, 873, None),
			('rsync', 'RSYNC Service', 'udp', 873, 873, None),
			('ftps', 'File Transfer Protocol over SSL', 'tcp', 990, 990, None),
			('ftps-data', 'File Transfer Protocol Data Stream over SSL', 'tcp', 989, 989, None),
			('telnets', 'Telnet Service over SSL', 'tcp', 992, 992, 'stelnet'),
			('socks', 'Socks Proxy Server', 'tcp', 1080, 1080, None),
			('socks', 'Socks Proxy Server', 'udp', 1080, 1080, None),
			('openvpn', 'OpenVPN Service', 'tcp', 1194, 1194, 'open-vpn'),
			('openvpn', 'OpenVPN Service', 'udp', 1194, 1194, 'open-vpn'),
			('wins', 'Windows Internet Name Service', 'tcp', 1512, 1512, None),
			('wins', 'Windows Internet Name Service', 'udp', 1512, 1512, None),
			('l2tp', 'Level 2 Tunneling Protocol', 'tcp', 1701, 1701, 'l2f'),
			('l2tp', 'Level 2 Tunneling Protocol', 'udp', 1701, 1701, 'l2f'),
			('mysql-im', 'MySQL Instance Manager Service', 'tcp', 2273, 2273, 'mysqlim'),
			('icpv2', 'Internet Cache Protocol', 'tcp', 3130, 3130, 'icp'),
			('icpv2', 'Internet Cache Protocol', 'udp', 3130, 3130, 'icp'),
			('daap', 'Digital Audio Access Protocol', 'tcp', 3689, 3689, None),
			('daap', 'Digital Audio Access Protocol', 'udp', 3689, 3689, None),
			('xgrid', 'Mac OS X Server Xgrid', 'tcp', 4111, 4111, None),
			('xgrid', 'Mac OS X Server Xgrid', 'udp', 4111, 4111, None),
			('mdns', 'Multicast DNS', 'udp', 5353, 5353, None),
			('mdnsresponder', 'Multicast DNS Responder IPC', 'udp', 5354, 5354, None)
		)
		for t in stypes:
			st = ServiceType()
			st.abbreviation = t[0]
			st.name = t[1]
			st.protocol = ServiceProtocol.from_string(t[2])
			st.start_port = t[3]
			st.end_port = t[4]
			if t[5]:
				st.alias = t[5]
			sess.add(st)
コード例 #21
0
ファイル: __init__.py プロジェクト: annndrey/npui
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_tickets.models import (TicketChangeField, TicketOrigin)
        from netprofile_core.models import (Group, GroupCapability, LogType,
                                            Privilege)

        if not vpair.is_install:
            return

        sess.add(LogType(id=3, name='Tickets'))

        privs = (Privilege(code='BASE_TICKETS', name=_('Menu: Tickets')),
                 Privilege(code='TICKETS_LIST', name=_('Tickets: List')),
                 Privilege(code='TICKETS_LIST_ARCHIVED',
                           name=_('Tickets: List archived')),
                 Privilege(code='TICKETS_CREATE', name=_('Tickets: Create')),
                 Privilege(code='TICKETS_UPDATE', name=_('Tickets: Update')),
                 Privilege(code='TICKETS_COMMENT', name=_('Tickets: Comment')),
                 Privilege(code='TICKETS_ARCHIVAL',
                           name=_('Tickets: Archival')),
                 Privilege(code='TICKETS_DIRECT',
                           name=_('Tickets: Direct access'),
                           can_be_set=False),
                 Privilege(code='TICKETS_OWN_LIST',
                           name=_('Tickets: List assigned to user')),
                 Privilege(code='TICKETS_OWNGROUP_LIST',
                           name=_('Tickets: List assigned to group')),
                 Privilege(code='TICKETS_CHANGE_DATE',
                           name=_('Tickets: Change date')),
                 Privilege(code='TICKETS_CHANGE_UID',
                           name=_('Tickets: Change assigned user')),
                 Privilege(code='TICKETS_CHANGE_GID',
                           name=_('Tickets: Change assigned group')),
                 Privilege(code='TICKETS_CHANGE_STATE',
                           name=_('Tickets: Change state')),
                 Privilege(code='TICKETS_CHANGE_FLAGS',
                           name=_('Tickets: Change flags')),
                 Privilege(code='TICKETS_CHANGE_ENTITY',
                           name=_('Tickets: Change entity')),
                 Privilege(code='TICKETS_DEPENDENCIES',
                           name=_('Tickets: Edit dependencies')),
                 Privilege(code='FILES_ATTACH_2TICKETS',
                           name=_('Files: Attach to tickets')),
                 Privilege(code='TICKETS_STATES_CREATE',
                           name=_('Tickets: Create states')),
                 Privilege(code='TICKETS_STATES_EDIT',
                           name=_('Tickets: Edit states')),
                 Privilege(code='TICKETS_STATES_DELETE',
                           name=_('Tickets: Delete states')),
                 Privilege(code='TICKETS_FLAGTYPES_CREATE',
                           name=_('Tickets: Create flag types')),
                 Privilege(code='TICKETS_FLAGTYPES_EDIT',
                           name=_('Tickets: Edit flag types')),
                 Privilege(code='TICKETS_FLAGTYPES_DELETE',
                           name=_('Tickets: Delete flag types')),
                 Privilege(code='TICKETS_ORIGINS_CREATE',
                           name=_('Tickets: Create origins')),
                 Privilege(code='TICKETS_ORIGINS_EDIT',
                           name=_('Tickets: Edit origins')),
                 Privilege(code='TICKETS_ORIGINS_DELETE',
                           name=_('Tickets: Delete origins')),
                 Privilege(code='TICKETS_TRANSITIONS_CREATE',
                           name=_('Tickets: Create transitions')),
                 Privilege(code='TICKETS_TRANSITIONS_EDIT',
                           name=_('Tickets: Edit transitions')),
                 Privilege(code='TICKETS_TRANSITIONS_DELETE',
                           name=_('Tickets: Delete transitions')),
                 Privilege(code='TICKETS_TEMPLATES_CREATE',
                           name=_('Tickets: Create templates')),
                 Privilege(code='TICKETS_TEMPLATES_EDIT',
                           name=_('Tickets: Edit templates')),
                 Privilege(code='TICKETS_TEMPLATES_DELETE',
                           name=_('Tickets: Delete templates')),
                 Privilege(code='TICKETS_SCHEDULES_CREATE',
                           name=_('Tickets: Create schedules')),
                 Privilege(code='TICKETS_SCHEDULES_EDIT',
                           name=_('Tickets: Edit schedules')),
                 Privilege(code='TICKETS_SCHEDULES_DELETE',
                           name=_('Tickets: Delete schedules')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                if priv.code in {
                        'TICKETS_OWN_LIST', 'TICKETS_OWNGROUP_LIST',
                        'TICKETS_DIRECT'
                }:
                    continue
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass

        origins = (TicketOrigin(
            id=1,
            name=_('Operator'),
            description=_('Added manually via an administrative UI.')),
                   TicketOrigin(id=2,
                                name=_('Via site'),
                                description=_('Added via client portal.')),
                   TicketOrigin(
                       id=3,
                       name=_('Via e-mail'),
                       description=_('Added via incoming e-mail message.')),
                   TicketOrigin(
                       id=4,
                       name=_('Via voicemail'),
                       description=_('Added via incoming voicemail message.')))

        for obj in origins:
            sess.add(obj)

        chfields = (TicketChangeField(id=1, name=_('User')),
                    TicketChangeField(id=2, name=_('Group')),
                    TicketChangeField(id=3, name=_('Time')),
                    TicketChangeField(id=4, name=_('Archived')),
                    TicketChangeField(id=5, name=_('Entity')))

        for obj in chfields:
            sess.add(obj)
コード例 #22
0
ファイル: __init__.py プロジェクト: nikitos/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_stashes.models import (
			IOOperationType,
			OperationClass,
			StashIOType
		)
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		sess.add(LogType(
			id=12,
			name='Stashes'
		))
		sess.add(LogType(
			id=16,
			name='Promised Payments'
		))

		privs = (
			Privilege(
				code='BASE_STASHES',
				name='Access: Stashes'
			),
			Privilege(
				code='STASHES_LIST',
				name='Stashes: List'
			),
			Privilege(
				code='STASHES_CREATE',
				name='Stashes: Create'
			),
			Privilege(
				code='STASHES_EDIT',
				name='Stashes: Edit'
			),
			Privilege(
				code='STASHES_DELETE',
				name='Stashes: Delete'
			),
			Privilege(
				code='STASHES_IO',
				name='Stashes: Operations'
			),
			Privilege(
				code='STASHES_IOTYPES_CREATE',
				name='Stashes: Create op. types'
			),
			Privilege(
				code='STASHES_IOTYPES_EDIT',
				name='Stashes: Edit op. types'
			),
			Privilege(
				code='STASHES_IOTYPES_DELETE',
				name='Stashes: Delete op. types'
			),
			Privilege(
				code='BASE_FUTURES',
				name='Access: Promised payments'
			),
			Privilege(
				code='FUTURES_LIST',
				name='Promised payments: List'
			),
			Privilege(
				code='FUTURES_CREATE',
				name='Promised payments: Create'
			),
			Privilege(
				code='FUTURES_EDIT',
				name='Promised payments: Edit'
			),
			Privilege(
				code='FUTURES_APPROVE',
				name='Promised payments: Approve'
			),
			Privilege(
				code='FUTURES_CANCEL',
				name='Promised payments: Cancel'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		siotypes = (
			StashIOType(
				id=1,
				name='Subscription fee',
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				oper_visible=False,
				user_visible=True,
				description='Periodic withdrawal of funds for an active service.'
			),
			StashIOType(
				id=2,
				name='Postpaid service fee',
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				oper_visible=False,
				user_visible=True,
				description='Withdrawal of funds for used service.'
			),
			StashIOType(
				id=3,
				name='Reimbursement for unused subscription fee.',
				io_class=OperationClass.system,
				type=IOOperationType.incoming,
				oper_visible=False,
				user_visible=True,
				description='Addition of funds that is a result of tariff recalculation or operator action.'
			),
			StashIOType(
				id=4,
				name='Confirmation of promised payment',
				io_class=OperationClass.system,
				type=IOOperationType.bidirectional,
				oper_visible=False,
				user_visible=True,
				description='This operation is a result of a payment promise being fulfilled.'
			),
			StashIOType(
				id=5,
				name='Transfer from another stash',
				io_class=OperationClass.system,
				type=IOOperationType.incoming,
				oper_visible=False,
				user_visible=True,
				description='Addition of funds that were transferred from another stash.'
			),
			StashIOType(
				id=6,
				name='Transfer to another stash',
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				oper_visible=False,
				user_visible=True,
				description='Withdrawal of funds that were transferred to another stash.'
			),
			StashIOType(
				id=7,
				name='Payment for service activation',
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				oper_visible=False,
				user_visible=True,
				description='Initial payment for activation of an auxiliary service.',
			),
			StashIOType(
				id=8,
				name='Payment for maintaining service',
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				oper_visible=False,
				user_visible=True,
				description='Periodic payment for maintaining an auxiliary service.'
			)
		)
コード例 #23
0
ファイル: __init__.py プロジェクト: hermes-jr/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_devices import models
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		sess.add(LogType(
			id=9,
			name='Devices'
		))
		sess.flush()

		privs = (
			Privilege(
				code='BASE_DEVICES',
				name='Access: Devices'
			),
			Privilege(
				code='DEVICES_LIST',
				name='Devices: List'
			),
			Privilege(
				code='DEVICES_CREATE',
				name='Devices: Create'
			),
			Privilege(
				code='DEVICES_EDIT',
				name='Devices: Edit'
			),
			Privilege(
				code='DEVICES_DELETE',
				name='Devices: Delete'
			),
			Privilege(
				code='DEVICES_PASSWORDS',
				name='Devices: Access to passwords'
			),
			Privilege(
				code='FILES_ATTACH_2DEVICETYPES',
				name='Files: Attach to devices'
			),
			Privilege(
				code='DEVICES_FLAGTYPES_CREATE',
				name='Devices: Create flags'
			),
			Privilege(
				code='DEVICES_FLAGTYPES_EDIT',
				name='Devices: Edit flags'
			),
			Privilege(
				code='DEVICES_FLAGTYPES_DELETE',
				name='Devices: Delete flags'
			),

			Privilege(
				code='DEVICETYPES_FLAGTYPES_CREATE',
				name='Devices: Create device type flags'
			),
			Privilege(
				code='DEVICETYPES_FLAGTYPES_EDIT',
				name='Devices: Edit device type flags'
			),
			Privilege(
				code='DEVICETYPES_FLAGTYPES_DELETE',
				name='Devices: Delete device type flags'
			),

			Privilege(
				code='DEVICETYPES_MANUFACTURERS_CREATE',
				name='Devices: Create manufacturers'
			),
			Privilege(
				code='DEVICETYPES_MANUFACTURERS_EDIT',
				name='Devices: Edit manufacturers'
			),
			Privilege(
				code='DEVICETYPES_MANUFACTURERS_DELETE',
				name='Devices: Delete manufacturers'
			),

			Privilege(
				code='DEVICETYPES_LIST',
				name='Devices: List types'
			),
			Privilege(
				code='DEVICETYPES_CREATE',
				name='Devices: Create types'
			),
			Privilege(
				code='DEVICETYPES_EDIT',
				name='Devices: Edit types'
			),
			Privilege(
				code='DEVICETYPES_DELETE',
				name='Devices: Delete types'
			),

			Privilege(
				code='DEVICETYPES_CATEGORIES_CREATE',
				name='Devices: Create categories'
			),
			Privilege(
				code='DEVICETYPES_CATEGORIES_EDIT',
				name='Devices: Edit categories'
			),
			Privilege(
				code='DEVICETYPES_CATEGORIES_DELETE',
				name='Devices: Delete categories'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass
コード例 #24
0
ファイル: __init__.py プロジェクト: baloon11/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_core.models import (
			GlobalSetting,
			GlobalSettingSection,
			Group,
			GroupCapability,
			Privilege
		)

		privs = (
			Privilege(
				code='BASE_SESSIONS',
				name='Access: Sessions'
			),
			Privilege(
				code='SESSIONS_LIST',
				name='Sessions: List'
			),
			Privilege(
				code='SESSIONS_LIST_ARCHIVED',
				name='Sessions: List archived'
			),
			Privilege(
				code='SESSIONS_DISCONNECT',
				name='Sessions: Disconnect'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		gss_acct = GlobalSettingSection( # no old id
			module=modobj,
			name='Accounting',
			description='Client accounting settings.'
		)

		sess.add(gss_acct)

		sess.add(GlobalSetting(
			section=gss_acct,
			module=modobj,
			name='acct_interval',
			title='Default accounting interval',
			type='text',
			value='60',
			default='60',
			constraints={
				'cast'   : 'int',
				'nullok' : False,
				'minval' : 20
			},
			description='Interval (in seconds) between session accounting reports.'
		))
		sess.add(GlobalSetting(
			section=gss_acct,
			module=modobj,
			name='acct_stale_cutoff',
			title='Inactivity before close',
			type='text',
			value='130',
			default='130',
			constraints={
				'cast'   : 'int',
				'nullok' : False,
				'minval' : 45
			},
			description='Maximum session inactivity time (in seconds) before it is considered stale and closed down.'
		))
コード例 #25
0
ファイル: __init__.py プロジェクト: annndrey/npui
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_stashes.models import (
			IOOperationType,
			IOFunctionType,
			OperationClass,
			StashIOType
		)
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		if not vpair.is_install:
			return

		sess.add(LogType(
			id=12,
			name='Stashes'
		))
		sess.add(LogType(
			id=16,
			name='Promised Payments'
		))

		privs = (
			Privilege(
				code='BASE_STASHES',
				name=_('Menu: Stashes')
			),
			Privilege(
				code='STASHES_LIST',
				name=_('Stashes: List')
			),
			Privilege(
				code='STASHES_CREATE',
				name=_('Stashes: Create')
			),
			Privilege(
				code='STASHES_EDIT',
				name=_('Stashes: Edit')
			),
			Privilege(
				code='STASHES_DELETE',
				name=_('Stashes: Delete')
			),
			Privilege(
				code='STASHES_IO',
				name=_('Stashes: Operations')
			),
			Privilege(
				code='STASHES_IOTYPES_CREATE',
				name=_('Stashes: Create op. types')
			),
			Privilege(
				code='STASHES_IOTYPES_EDIT',
				name=_('Stashes: Edit op. types')
			),
			Privilege(
				code='STASHES_IOTYPES_DELETE',
				name=_('Stashes: Delete op. types')
			),
			Privilege(
				code='STASHES_CURRENCIES_CREATE',
				name=_('Stashes: Create currencies')
			),
			Privilege(
				code='STASHES_CURRENCIES_EDIT',
				name=_('Stashes: Edit currencies')
			),
			Privilege(
				code='STASHES_CURRENCIES_DELETE',
				name=_('Stashes: Delete currencies')
			),
			Privilege(
				code='BASE_FUTURES',
				name=_('Menu: Promised payments')
			),
			Privilege(
				code='FUTURES_LIST',
				name=_('Promised payments: List')
			),
			Privilege(
				code='FUTURES_CREATE',
				name=_('Promised payments: Create')
			),
			Privilege(
				code='FUTURES_EDIT',
				name=_('Promised payments: Edit')
			),
			Privilege(
				code='FUTURES_APPROVE',
				name=_('Promised payments: Approve')
			),
			Privilege(
				code='FUTURES_CANCEL',
				name=_('Promised payments: Cancel')
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		siotypes = (
			StashIOType(
				id=1,
				name=_('Prepaid subscription fee'),
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				function_type=IOFunctionType.rate_quota_prepaid,
				visible_to_operator=False,
				visible_to_user=True,
				description=_('Periodic withdrawal of funds for an active service.')
			),
			StashIOType(
				id=2,
				name=_('Postpaid service fee'),
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				function_type=IOFunctionType.rate_quota_postpaid,
				visible_to_operator=False,
				visible_to_user=True,
				description=_('Withdrawal of funds for used service.')
			),
			StashIOType(
				id=3,
				name=_('Reimbursement on rate conversion'),
				io_class=OperationClass.system,
				type=IOOperationType.incoming,
				function_type=IOFunctionType.rate_rollback,
				visible_to_operator=False,
				visible_to_user=True,
				description=_('Addition of funds that is a result of tariff recalculation or operator action.')
			),
			# XXX: following one might be deprecated.
			StashIOType(
				id=4,
				name=_('Confirmation of promised payment'),
				io_class=OperationClass.system,
				type=IOOperationType.bidirectional,
				function_type=IOFunctionType.future_confirm,
				visible_to_operator=False,
				visible_to_user=True,
				fulfills_futures=True,
				description=_('This operation is a result of a payment promise being fulfilled.')
			),
			StashIOType(
				id=5,
				name=_('Transfer from another account'),
				io_class=OperationClass.system,
				type=IOOperationType.incoming,
				function_type=IOFunctionType.transfer_deposit,
				visible_to_operator=False,
				visible_to_user=True,
				description=_('Addition of funds that were transferred from another account.')
			),
			StashIOType(
				id=6,
				name=_('Transfer to another account'),
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				function_type=IOFunctionType.transfer_withdrawal,
				visible_to_operator=False,
				visible_to_user=True,
				description=_('Withdrawal of funds that were transferred to another account.')
			),
			StashIOType(
				id=7,
				name=_('Service activation fee'),
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				function_type=IOFunctionType.service_initial,
				visible_to_operator=False,
				visible_to_user=True,
				description=_('Initial payment for activation of an auxiliary service.')
			),
			StashIOType(
				id=8,
				name=_('Service subscription fee'),
				io_class=OperationClass.system,
				type=IOOperationType.outgoing,
				function_type=IOFunctionType.service_quota,
				visible_to_operator=False,
				visible_to_user=True,
				description=_('Periodic payment for maintaining an auxiliary service.')
			)
		)

		for siotype in siotypes:
			sess.add(siotype)
コード例 #26
0
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_confgen.models import ServerType
        from netprofile_core.models import (Group, GroupCapability, Privilege)

        if not vpair.is_install:
            return

        privs = (Privilege(code='SRV_LIST', name=_('Servers: List')),
                 Privilege(code='SRV_CREATE', name=_('Servers: Create')),
                 Privilege(code='SRV_EDIT', name=_('Servers: Edit')),
                 Privilege(code='SRV_DELETE', name=_('Servers: Delete')),
                 Privilege(code='SRV_CONFGEN',
                           name=_('Servers: Generate configuration')),
                 Privilege(code='SRVTYPES_CREATE',
                           name=_('Servers: Create types')),
                 Privilege(code='SRVTYPES_EDIT',
                           name=_('Servers: Edit types')),
                 Privilege(code='SRVTYPES_DELETE',
                           name=_('Servers: Delete types')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass

        bind_defaults = {
            'key_name_gen': 'nslink.',
            'key_name_int': 'nsexternal.',
            'key_name_ext': 'nsinternal.',
            # TODO: generate these at install time to be somewhat secure even w/o configuration
            #			'key_value_gen'          : None,
            #			'key_value_int'          : None,
            #			'key_value_ext'          : None,
            'key_algo_gen': 'hmac-md5',
            'key_algo_int': 'hmac-md5',
            'key_algo_ext': 'hmac-md5',
            'revzone_refresh': 3600,
            'revzone_retry': 300,
            'revzone_expire': 1814400,
            'revzone_minimum': 3600,
            #			'default_domain'         : None,
            #			'hostmaster'             : None,
            'dnssec': 'true',
            'dnssec_accept_expired': 'false',
            'split_dns': 'false',
            'only_external': 'false',
            'gen_spf': 'true',
            'gen_dkim': 'false',
            'gen_dmarc': 'false'
        }

        stypes = (ServerType(id=1,
                             name='ISC DHCP 3+',
                             generator_name='iscdhcp',
                             parameter_defaults={'dir_dhcp': '/etc/dhcp'},
                             description='ISC DHCP server version 3+.'),
                  ServerType(
                      id=2,
                      name='ISC BIND 9.0-9.2',
                      generator_name='iscbind9',
                      parameter_defaults=bind_defaults,
                      description='ISC BIND DNS server versions 9.0-9.2.'),
                  ServerType(id=3,
                             name='ISC BIND 9.3',
                             generator_name='iscbind93',
                             parameter_defaults=bind_defaults,
                             description='ISC BIND DNS server version 9.3.'),
                  ServerType(
                      id=4,
                      name='ISC BIND 9.4-9.8',
                      generator_name='iscbind94',
                      parameter_defaults=bind_defaults,
                      description='ISC BIND DNS server versions 9.4-9.8.'),
                  ServerType(id=5,
                             name='Samba 3',
                             generator_name='samba3',
                             description='Samba NT domain server version 3.'),
                  ServerType(id=6,
                             name='OpenSLP',
                             generator_name='openslp',
                             description='OpenSLP server.'),
                  ServerType(id=7,
                             name='ISC BIND 9.9+',
                             generator_name='iscbind99',
                             parameter_defaults=bind_defaults,
                             description='ISC BIND DNS server versions 9.9+.'))

        for st in stypes:
            sess.add(st)
コード例 #27
0
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_domains import models
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		if not vpair.is_install:
			return

		sess.add(LogType(
			id=5,
			name='Domains'
		))
		sess.flush()

		privs = (
			Privilege(
				code='BASE_DOMAINS',
				name=_('Menu: Domains')
			),
			Privilege(
				code='DOMAINS_LIST',
				name=_('Domains: List')
			),
			Privilege(
				code='DOMAINS_CREATE',
				name=_('Domains: Create')
			),
			Privilege(
				code='DOMAINS_EDIT',
				name=_('Domains: Edit')
			),
			Privilege(
				code='DOMAINS_DELETE',
				name=_('Domains: Delete')
			),
			Privilege(
				code='DOMAINS_SERVICETYPES_CREATE',
				name=_('Domains: Create service types')
			),
			Privilege(
				code='DOMAINS_SERVICETYPES_EDIT',
				name=_('Domains: Edit service types')
			),
			Privilege(
				code='DOMAINS_SERVICETYPES_DELETE',
				name=_('Domains: Delete service types')
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		dstypes = (
			models.DomainServiceType(
				id=1,
				name=_('Primary Name Server'),
				unique=True
			),
			models.DomainServiceType(
				id=2,
				name=_('Secondary Name Server'),
				unique=False
			),
			models.DomainServiceType(
				id=3,
				name=_('Primary Mail Server'),
				unique=True
			),
			models.DomainServiceType(
				id=4,
				name=_('Secondary Mail Server'),
				unique=False
			),
			models.DomainServiceType(
				id=5,
				name=_('Default Host'),
				unique=False
			)
		)

		for dst in dstypes:
			sess.add(dst)
コード例 #28
0
ファイル: __init__.py プロジェクト: baloon11/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_rates.models import (
			DestinationSet,
			FilterSet,
			RateClass
		)
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		sess.add(LogType(
			id=13,
			name='Rates'
		))

		privs = (
			Privilege(
				code='BASE_RATES',
				name='Access: Rates'
			),
			Privilege(
				code='RATES_LIST',
				name='Rates: List'
			),
			Privilege(
				code='RATES_CREATE',
				name='Rates: Create'
			),
			Privilege(
				code='RATES_EDIT',
				name='Rates: Edit'
			),
			Privilege(
				code='RATES_DELETE',
				name='Rates: Delete'
			),
			Privilege(
				code='RATES_CLASSES_CREATE',
				name='Rates: Create classes'
			),
			Privilege(
				code='RATES_CLASSES_EDIT',
				name='Rates: Edit classes'
			),
			Privilege(
				code='RATES_CLASSES_DELETE',
				name='Rates: Delete classes'
			),
			Privilege(
				code='RATES_DS_CREATE',
				name='Rates: Create destinations'
			),
			Privilege(
				code='RATES_DS_EDIT',
				name='Rates: Edit destinations'
			),
			Privilege(
				code='RATES_DS_DELETE',
				name='Rates: Delete destinations'
			),
			Privilege(
				code='RATES_FS_CREATE',
				name='Rates: Create filters'
			),
			Privilege(
				code='RATES_FS_EDIT',
				name='Rates: Edit filters'
			),
			Privilege(
				code='RATES_FS_DELETE',
				name='Rates: Delete filters'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		sess.add(RateClass(
			name='Default Class',
			description='This is a class added during module installation. You can safely remove it, provided you haven\'t specified any rates in this class yet.'
		))

		sess.add(DestinationSet(name='Default Set'))
		sess.add(FilterSet(name='Default Set'))
コード例 #29
0
ファイル: __init__.py プロジェクト: hermes-jr/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_tickets.models import (
			TicketChangeField,
			TicketOrigin
		)
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		sess.add(LogType(
			id=3,
			name='Tickets'
		))

		privs = (
			Privilege(
				code='BASE_TICKETS',
				name='Access: Tickets'
			),
			Privilege(
				code='TICKETS_LIST',
				name='Tickets: List'
			),
			Privilege(
				code='TICKETS_LIST_ARCHIVED',
				name='Tickets: List archived'
			),
			Privilege(
				code='TICKETS_CREATE',
				name='Tickets: Create'
			),
			Privilege(
				code='TICKETS_UPDATE',
				name='Tickets: Update'
			),
			Privilege(
				code='TICKETS_COMMENT',
				name='Tickets: Comment'
			),
			Privilege(
				code='TICKETS_ARCHIVAL',
				name='Tickets: Archival'
			),
			Privilege(
				code='TICKETS_DIRECT',
				name='Tickets: Direct access',
				can_be_set=False
			),
			Privilege(
				code='TICKETS_OWN_LIST',
				name='Tickets: List assigned to user'
			),
			Privilege(
				code='TICKETS_OWNGROUP_LIST',
				name='Tickets: List assigned to group'
			),
			Privilege(
				code='TICKETS_CHANGE_DATE',
				name='Tickets: Change date'
			),
			Privilege(
				code='TICKETS_CHANGE_UID',
				name='Tickets: Change assigned user'
			),
			Privilege(
				code='TICKETS_CHANGE_GID',
				name='Tickets: Change assigned group'
			),
			Privilege(
				code='TICKETS_CHANGE_STATE',
				name='Tickets: Change state'
			),
			Privilege(
				code='TICKETS_CHANGE_FLAGS',
				name='Tickets: Change flags'
			),
			Privilege(
				code='TICKETS_CHANGE_ENTITY',
				name='Tickets: Change entity'
			),
			Privilege(
				code='TICKETS_DEPENDENCIES',
				name='Tickets: Edit dependencies'
			),
			Privilege(
				code='FILES_ATTACH_2TICKETS',
				name='Files: Attach to tickets'
			),
			Privilege(
				code='TICKETS_STATES_CREATE',
				name='Tickets: Create states'
			),
			Privilege(
				code='TICKETS_STATES_EDIT',
				name='Tickets: Edit states'
			),
			Privilege(
				code='TICKETS_STATES_DELETE',
				name='Tickets: Delete states'
			),
			Privilege(
				code='TICKETS_FLAGTYPES_CREATE',
				name='Tickets: Create flag types'
			),
			Privilege(
				code='TICKETS_FLAGTYPES_EDIT',
				name='Tickets: Edit flag types'
			),
			Privilege(
				code='TICKETS_FLAGTYPES_DELETE',
				name='Tickets: Delete flag types'
			),
			Privilege(
				code='TICKETS_ORIGINS_CREATE',
				name='Tickets: Create origins'
			),
			Privilege(
				code='TICKETS_ORIGINS_EDIT',
				name='Tickets: Edit origins'
			),
			Privilege(
				code='TICKETS_ORIGINS_DELETE',
				name='Tickets: Delete origins'
			),
			Privilege(
				code='TICKETS_TRANSITIONS_CREATE',
				name='Tickets: Create transitions'
			),
			Privilege(
				code='TICKETS_TRANSITIONS_EDIT',
				name='Tickets: Edit transitions'
			),
			Privilege(
				code='TICKETS_TRANSITIONS_DELETE',
				name='Tickets: Delete transitions'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		origins = (
			TicketOrigin(
				id=1,
				name='Operator',
				description='Added manually via an administrative UI.'
			),
			TicketOrigin(
				id=2,
				name='Via site',
				description='Added via client portal.'
			),
			TicketOrigin(
				id=3,
				name='Via e-mail',
				description='Added via incoming e-mail message.'
			),
			TicketOrigin(
				id=4,
				name='Via voicemail',
				description='Added via incoming voicemail message.'
			)
		)

		for obj in origins:
			sess.add(obj)

		chfields = (
			TicketChangeField(
				id=1,
				name='User'
			),
			TicketChangeField(
				id=2,
				name='Group'
			),
			TicketChangeField(
				id=3,
				name='Time'
			),
			TicketChangeField(
				id=4,
				name='Archived'
			),
			TicketChangeField(
				id=5,
				name='Entity'
			)
		)

		for obj in chfields:
			sess.add(obj)
コード例 #30
0
ファイル: __init__.py プロジェクト: annndrey/npui
    def get_sql_data(cls, modobj, vpair, sess):
        from netprofile_stashes.models import (IOOperationType, IOFunctionType,
                                               OperationClass, StashIOType)
        from netprofile_core.models import (Group, GroupCapability, LogType,
                                            Privilege)

        if not vpair.is_install:
            return

        sess.add(LogType(id=12, name='Stashes'))
        sess.add(LogType(id=16, name='Promised Payments'))

        privs = (Privilege(code='BASE_STASHES', name=_('Menu: Stashes')),
                 Privilege(code='STASHES_LIST', name=_('Stashes: List')),
                 Privilege(code='STASHES_CREATE', name=_('Stashes: Create')),
                 Privilege(code='STASHES_EDIT', name=_('Stashes: Edit')),
                 Privilege(code='STASHES_DELETE', name=_('Stashes: Delete')),
                 Privilege(code='STASHES_IO', name=_('Stashes: Operations')),
                 Privilege(code='STASHES_IOTYPES_CREATE',
                           name=_('Stashes: Create op. types')),
                 Privilege(code='STASHES_IOTYPES_EDIT',
                           name=_('Stashes: Edit op. types')),
                 Privilege(code='STASHES_IOTYPES_DELETE',
                           name=_('Stashes: Delete op. types')),
                 Privilege(code='STASHES_CURRENCIES_CREATE',
                           name=_('Stashes: Create currencies')),
                 Privilege(code='STASHES_CURRENCIES_EDIT',
                           name=_('Stashes: Edit currencies')),
                 Privilege(code='STASHES_CURRENCIES_DELETE',
                           name=_('Stashes: Delete currencies')),
                 Privilege(code='BASE_FUTURES',
                           name=_('Menu: Promised payments')),
                 Privilege(code='FUTURES_LIST',
                           name=_('Promised payments: List')),
                 Privilege(code='FUTURES_CREATE',
                           name=_('Promised payments: Create')),
                 Privilege(code='FUTURES_EDIT',
                           name=_('Promised payments: Edit')),
                 Privilege(code='FUTURES_APPROVE',
                           name=_('Promised payments: Approve')),
                 Privilege(code='FUTURES_CANCEL',
                           name=_('Promised payments: Cancel')))
        for priv in privs:
            priv.module = modobj
            sess.add(priv)
        try:
            grp_admins = sess.query(Group).filter(
                Group.name == 'Administrators').one()
            for priv in privs:
                cap = GroupCapability()
                cap.group = grp_admins
                cap.privilege = priv
        except NoResultFound:
            pass

        siotypes = (
            StashIOType(
                id=1,
                name=_('Prepaid subscription fee'),
                io_class=OperationClass.system,
                type=IOOperationType.outgoing,
                function_type=IOFunctionType.rate_quota_prepaid,
                visible_to_operator=False,
                visible_to_user=True,
                description=_(
                    'Periodic withdrawal of funds for an active service.')),
            StashIOType(
                id=2,
                name=_('Postpaid service fee'),
                io_class=OperationClass.system,
                type=IOOperationType.outgoing,
                function_type=IOFunctionType.rate_quota_postpaid,
                visible_to_operator=False,
                visible_to_user=True,
                description=_('Withdrawal of funds for used service.')),
            StashIOType(
                id=3,
                name=_('Reimbursement on rate conversion'),
                io_class=OperationClass.system,
                type=IOOperationType.incoming,
                function_type=IOFunctionType.rate_rollback,
                visible_to_operator=False,
                visible_to_user=True,
                description=
                _('Addition of funds that is a result of tariff recalculation or operator action.'
                  )),
            # XXX: following one might be deprecated.
            StashIOType(
                id=4,
                name=_('Confirmation of promised payment'),
                io_class=OperationClass.system,
                type=IOOperationType.bidirectional,
                function_type=IOFunctionType.future_confirm,
                visible_to_operator=False,
                visible_to_user=True,
                fulfills_futures=True,
                description=
                _('This operation is a result of a payment promise being fulfilled.'
                  )),
            StashIOType(
                id=5,
                name=_('Transfer from another account'),
                io_class=OperationClass.system,
                type=IOOperationType.incoming,
                function_type=IOFunctionType.transfer_deposit,
                visible_to_operator=False,
                visible_to_user=True,
                description=
                _('Addition of funds that were transferred from another account.'
                  )),
            StashIOType(
                id=6,
                name=_('Transfer to another account'),
                io_class=OperationClass.system,
                type=IOOperationType.outgoing,
                function_type=IOFunctionType.transfer_withdrawal,
                visible_to_operator=False,
                visible_to_user=True,
                description=
                _('Withdrawal of funds that were transferred to another account.'
                  )),
            StashIOType(
                id=7,
                name=_('Service activation fee'),
                io_class=OperationClass.system,
                type=IOOperationType.outgoing,
                function_type=IOFunctionType.service_initial,
                visible_to_operator=False,
                visible_to_user=True,
                description=_(
                    'Initial payment for activation of an auxiliary service.')
            ),
            StashIOType(
                id=8,
                name=_('Service subscription fee'),
                io_class=OperationClass.system,
                type=IOOperationType.outgoing,
                function_type=IOFunctionType.service_quota,
                visible_to_operator=False,
                visible_to_user=True,
                description=_(
                    'Periodic payment for maintaining an auxiliary service.')))

        for siotype in siotypes:
            sess.add(siotype)
コード例 #31
0
ファイル: __init__.py プロジェクト: baloon11/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_networks.models import NetworkServiceType
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		sess.add(LogType(
			id=6,
			name='Networks'
		))

		privs = (
			Privilege(
				code='BASE_NETS',
				name='Access: Networks'
			),
			Privilege(
				code='NETS_LIST',
				name='Networks: List'
			),
			Privilege(
				code='NETS_CREATE',
				name='Networks: Create'
			),
			Privilege(
				code='NETS_EDIT',
				name='Networks: Edit'
			),
			Privilege(
				code='NETS_DELETE',
				name='Networks: Delete'
			),
			Privilege(
				code='NETGROUPS_CREATE',
				name='Networks: Create groups'
			),
			Privilege(
				code='NETGROUPS_EDIT',
				name='Networks: Edit groups'
			),
			Privilege(
				code='NETGROUPS_DELETE',
				name='Networks: Delete groups'
			),
			Privilege(
				code='NETS_SERVICETYPES_CREATE',
				name='Networks: Create service types'
			),
			Privilege(
				code='NETS_SERVICETYPES_EDIT',
				name='Networks: Edit service types'
			),
			Privilege(
				code='NETS_SERVICETYPES_DELETE',
				name='Networks: Delete service types'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		nstypes = (
			models.NetworkServiceType(
				id=1,
				name='Name Server'
			),
			models.NetworkServiceType(
				id=2,
				name='WINS Server'
			),
			models.NetworkServiceType(
				id=3,
				name='NTP Server'
			),
			models.NetworkServiceType(
				id=4,
				name='Gateway'
			),
			models.NetworkServiceType(
				id=5,
				name='SLP DA Server'
			),
			models.NetworkServiceType(
				id=6,
				name='DNSv6 Server'
			)
		)

		for nst in nstypes:
			sess.add(nst)
コード例 #32
0
ファイル: __init__.py プロジェクト: annndrey/npui
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_entities import models
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		if not vpair.is_install:
			return

		sess.add(LogType(
			id=2,
			name='Entities'
		))
		sess.flush()

		privs = (
			Privilege(
				code='BASE_ENTITIES',
				name=_('Menu: Entities')
			),
			Privilege(
				code='ENTITIES_LIST',
				name=_('Entities: List')
			),
			Privilege(
				code='ENTITIES_CREATE',
				name=_('Entities: Create')
			),
			Privilege(
				code='ENTITIES_EDIT',
				name=_('Entities: Edit')
			),
			Privilege(
				code='ENTITIES_DELETE',
				name=_('Entities: Delete')
			),
			Privilege(
				code='FILES_ATTACH_2ENTITIES',
				name=_('Files: Attach to entities')
			),
			Privilege(
				code='ENTITIES_STATES_CREATE',
				name=_('Entities: Create states')
			),
			Privilege(
				code='ENTITIES_STATES_EDIT',
				name=_('Entities: Edit states')
			),
			Privilege(
				code='ENTITIES_STATES_DELETE',
				name=_('Entities: Delete states')
			),
			Privilege(
				code='ENTITIES_FLAGTYPES_CREATE',
				name=_('Entities: Create flag types')
			),
			Privilege(
				code='ENTITIES_FLAGTYPES_EDIT',
				name=_('Entities: Edit flag types')
			),
			Privilege(
				code='ENTITIES_FLAGTYPES_DELETE',
				name=_('Entities: Delete flag types')
			),
			Privilege(
				code='ENTITIES_COMMENT',
				name=_('Entities: Add comments')
			),
			Privilege(
				code='ENTITIES_COMMENTS_EDIT',
				name=_('Entities: Edit comments')
			),
			Privilege(
				code='ENTITIES_COMMENTS_DELETE',
				name=_('Entities: Delete comments')
			),
			Privilege(
				code='ENTITIES_COMMENTS_MARK',
				name=_('Entities: Mark comments as obsolete')
			),
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		types = (
			models.EntityType(
				id=1,
				name=_('Individual'),
				model='PhysicalEntity',
				long_name=_('Individual'),
				plural=_('Individuals'),
				description=_('Definition of a single person.')
			),
			models.EntityType(
				id=2,
				name=_('Legal'),
				model='LegalEntity',
				long_name=_('Legal Entity'),
				plural=_('Legal Entities'),
				description=_('Definition of a legal entity (a company, corporation etc.).')
			),
			models.EntityType(
				id=3,
				name=_('Structure'),
				model='StructuralEntity',
				long_name=('Structure'),
				plural=_('Structures'),
				description=_('Definition of a building or a comparable structure.')
			),
			models.EntityType(
				id=4,
				name=_('Misc.'),
				model='ExternalEntity',
				long_name=('Miscellaneous'),
				plural=_('Miscellaneous'),
				description=_('Definition of an object without well-defined metadata.')
			)
		)
		for et in types:
			et.module = modobj
			sess.add(et)

		sess.add(models.EntityState(
			name='Default',
			description='Default entity state. You can safely rename and/or delete it if you wish.'
		))
コード例 #33
0
ファイル: __init__.py プロジェクト: baloon11/npui
	def get_sql_data(cls, modobj, sess):
		from netprofile_domains import models
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		sess.add(LogType(
			id=5,
			name='Domains'
		))
		sess.flush()

		privs = (
			Privilege(
				code='BASE_DOMAINS',
				name='Access: Domains'
			),
			Privilege(
				code='DOMAINS_LIST',
				name='Domains: List'
			),
			Privilege(
				code='DOMAINS_CREATE',
				name='Domains: Create'
			),
			Privilege(
				code='DOMAINS_EDIT',
				name='Domains: Edit'
			),
			Privilege(
				code='DOMAINS_DELETE',
				name='Domains: Delete'
			),
			Privilege(
				code='DOMAINS_SERVICETYPES_CREATE',
				name='Domains: Create service types'
			),
			Privilege(
				code='DOMAINS_SERVICETYPES_EDIT',
				name='Domains: Edit service types'
			),
			Privilege(
				code='DOMAINS_SERVICETYPES_DELETE',
				name='Domains: Delete service types'
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		dstypes = (
			models.DomainServiceType(
				id=1,
				name='Primary Name Server',
				unique=True
			),
			models.DomainServiceType(
				id=2,
				name='Secondary Name Server',
				unique=False
			),
			models.DomainServiceType(
				id=3,
				name='Primary Mail Server',
				unique=True
			),
			models.DomainServiceType(
				id=4,
				name='Secondary Mail Server',
				unique=False
			),
			models.DomainServiceType(
				id=5,
				name='Default Host',
				unique=False
			)
		)

		for dst in dstypes:
			sess.add(dst)
コード例 #34
0
	def get_sql_data(cls, modobj, vpair, sess):
		from netprofile_devices import models
		from netprofile_core.models import (
			Group,
			GroupCapability,
			LogType,
			Privilege
		)

		if not vpair.is_install:
			return

		sess.add(LogType(
			id=9,
			name='Devices'
		))
		sess.flush()

		privs = (
			Privilege(
				code='BASE_DEVICES',
				name=_('Menu: Devices')
			),
			Privilege(
				code='DEVICES_LIST',
				name=_('Devices: List')
			),
			Privilege(
				code='DEVICES_CREATE',
				name=_('Devices: Create')
			),
			Privilege(
				code='DEVICES_EDIT',
				name=_('Devices: Edit')
			),
			Privilege(
				code='DEVICES_DELETE',
				name=_('Devices: Delete')
			),
			Privilege(
				code='DEVICES_PASSWORDS',
				name=_('Devices: Access to passwords')
			),
			Privilege(
				code='FILES_ATTACH_2DEVICETYPES',
				name=_('Files: Attach to devices')
			),
			Privilege(
				code='DEVICES_FLAGTYPES_CREATE',
				name=_('Devices: Create flags')
			),
			Privilege(
				code='DEVICES_FLAGTYPES_EDIT',
				name=_('Devices: Edit flags')
			),
			Privilege(
				code='DEVICES_FLAGTYPES_DELETE',
				name=_('Devices: Delete flags')
			),

			Privilege(
				code='DEVICETYPES_FLAGTYPES_CREATE',
				name=_('Devices: Create device type flags')
			),
			Privilege(
				code='DEVICETYPES_FLAGTYPES_EDIT',
				name=_('Devices: Edit device type flags')
			),
			Privilege(
				code='DEVICETYPES_FLAGTYPES_DELETE',
				name=_('Devices: Delete device type flags')
			),

			Privilege(
				code='DEVICETYPES_MANUFACTURERS_CREATE',
				name=_('Devices: Create manufacturers')
			),
			Privilege(
				code='DEVICETYPES_MANUFACTURERS_EDIT',
				name=_('Devices: Edit manufacturers')
			),
			Privilege(
				code='DEVICETYPES_MANUFACTURERS_DELETE',
				name=_('Devices: Delete manufacturers')
			),

			Privilege(
				code='DEVICETYPES_LIST',
				name=_('Devices: List types')
			),
			Privilege(
				code='DEVICETYPES_CREATE',
				name=_('Devices: Create types')
			),
			Privilege(
				code='DEVICETYPES_EDIT',
				name=_('Devices: Edit types')
			),
			Privilege(
				code='DEVICETYPES_DELETE',
				name=_('Devices: Delete types')
			),

			Privilege(
				code='DEVICETYPES_CATEGORIES_CREATE',
				name=_('Devices: Create categories')
			),
			Privilege(
				code='DEVICETYPES_CATEGORIES_EDIT',
				name=_('Devices: Edit categories')
			),
			Privilege(
				code='DEVICETYPES_CATEGORIES_DELETE',
				name=_('Devices: Delete categories')
			),
			Privilege(
				code='HOSTS_PROBE',
				name=_('Devices: Probe hosts')
			)
		)
		for priv in privs:
			priv.module = modobj
			sess.add(priv)
		try:
			grp_admins = sess.query(Group).filter(Group.name == 'Administrators').one()
			for priv in privs:
				cap = GroupCapability()
				cap.group = grp_admins
				cap.privilege = priv
		except NoResultFound:
			pass

		classes = (
			models.DeviceClass(
				id=1,
				name=_('Simple'),
				model='SimpleDevice',
				long_name=_('Simple Device'),
				plural=_('Simple Devices'),
				description=_('Non-networking equipment.')
			),
			models.DeviceClass(
				id=2,
				name=_('Network'),
				model='NetworkDevice',
				long_name=_('Network Device'),
				plural=_('Network Devices'),
				description=_('Networking equipment.')
			)
		)
		for dcls in classes:
			dcls.module = modobj
			sess.add(dcls)

		medias = (
			# Name,                             ifT, ifTA, Physical, Speed,       Description
			(_('Other'),                        1,   None, False,    None,        'Other'),
			('BBN 1822 Regular',                2,   None, True,     None,        'BBN Report 1822 regular connection'),
			('BBN 1822 HDH',                    3,   None, True,     None,        'BBN Report 1822 HDH sync serial'),
			('DDN X.25',                        4,   None, True,     None,        'Defence Data Network X.25'),
			('RFC877 X.25',                     5,   None, True,     None,        'RFC877 IP over X.25'),
			('IEEE 802.3a 10Base2',             6,   7,    True,     10000000,    '10Base2 Ethernet over 50-ohm thin coax'),
			('IEEE 802.3b 10Broad36',           6,   7,    True,     10000000,    '10Broad36 Ethernet over 75-ohm CATV coax'),
			('IEEE 802.3e 10Base5',             6,   7,    True,     10000000,    '10Base5 Ethernet over 50-ohm thick coax'),
			('IEEE 802.3i 10BaseT',             6,   7,    True,     10000000,    '10BaseT Ethernet over cat3 2-twisted-pair cable'),
			('IEEE 802.3j 10BaseFL',            6,   7,    True,     10000000,    '10BaseFL Ethernet over multi-mode fiber pair'),
			('IEEE 802.3u 100Base-TX',          6,   62,   True,     100000000,   '100Base-TX Ethernet over cat5 2-twisted-pair cable'),
			('IEEE 802.3u 100Base-T4',          6,   62,   True,     100000000,   '100Base-T4 Ethernet over cat3 4-twisted-pair cable'),
			('IEEE 802.3u 100Base-FX',          6,   69,   True,     100000000,   '100Base-FX Ethernet over single-/multi-mode fiber pair'),
			('IEEE 802.3y 100Base-T2',          6,   62,   True,     100000000,   '100Base-T2 Ethernet over cat3 2-twisted-pair cable'),
			('Ethernet 100Base-SX',             6,   69,   True,     100000000,   '100Base-SX Ethernet over multi-mode fiber pair'),
			('Ethernet 100Base-BX',             6,   69,   True,     100000000,   '100Base-BX Ethernet over one single-mode fiber'),
			('IEEE 802.3ah 100Base-LX10',       6,   69,   True,     100000000,   '100Base-LX Ethernet over single-mode fiber pair'),
			('IEEE 802.3z 1000Base-LX',         6,   117,  True,     1000000000,  '1000Base-X Ethernet over single-/multi-mode fiber pair'),
			('IEEE 802.3ah 1000Base-LX10',      6,   117,  True,     1000000000,  '1000Base-X Ethernet over single-mode fiber pair (1000Base-LH)'),
			('IEEE 802.3ah 1000Base-BX10',      6,   117,  True,     1000000000,  '1000Base-X Ethernet over one single-mode fiber'),
			('IEEE 802.3z 1000Base-SX',         6,   117,  True,     1000000000,  '1000Base-X Ethernet over multi-mode fiber pair'),
			('IEEE 802.3z 1000Base-CX',         6,   117,  True,     1000000000,  '1000Base-X Ethernet over 150-ohm balanced STP cable'),
			('IEEE 802.3ab 1000Base-T',         6,   117,  True,     1000000000,  '1000Base-T Ethernet over cat5/5e 4-twisted-pair cable'),
			('Ethernet 1000Base-EX',            6,   117,  True,     1000000000,  '1000Base-X Ethernet over single-mode fiber pair (1000Base-LH)'),
			('Ethernet 1000Base-ZX',            6,   117,  True,     1000000000,  '1000Base-X Ethernet over single-mode fiber pair (1000Base-LH)'),
			('IEEE 802.3ae 10GBase-SR',         6,   None, True,     10000000000, '10GBase-SR Ethernet over multi-mode fiber pair (LAN PHY)'),
			('IEEE 802.3ae 10GBase-LR',         6,   None, True,     10000000000, '10GBase-LR Ethernet over single-mode fiber pair (LAN PHY)'),
			('IEEE 802.3ae 10GBase-ER',         6,   None, True,     10000000000, '10GBase-ER Ethernet over single-mode fiber pair (LAN PHY)'),
			('IEEE 802.3ae 10GBase-SW',         6,   None, True,     10000000000, '10GBase-SW Ethernet over multi-mode fiber pair (WAN PHY)'),
			('IEEE 802.3ae 10GBase-LW',         6,   None, True,     10000000000, '10GBase-LW Ethernet over single-mode fiber pair (WAN PHY)'),
			('IEEE 802.3ae 10GBase-EW',         6,   None, True,     10000000000, '10GBase-EW Ethernet over single-mode fiber pair (WAN PHY)'),
			('Ethernet 10GBase-ZR',             6,   None, True,     10000000000, '10GBase-ZR Ethernet over single-mode fiber pair (LAN PHY)'),
			('Ethernet 10GBase-ZW',             6,   None, True,     10000000000, '10GBase-ZW Ethernet over single-mode fiber pair (WAN PHY)'),
			('IEEE 802.3ak 10GBase-CX4',        6,   None, True,     10000000000, '10GBase-CX4 Ethernet over twinaxial 8-pair cable'),
			('IEEE 802.3an 10GBase-T',          6,   None, True,     10000000000, '10GBase-T Ethernet over cat6/6a 4-twisted-pair cable'),
			('IEEE 802.3aq 10GBase-LRM',        6,   None, True,     10000000000, '10GBase-LR Ethernet over multi-mode fiber pair'),
			('IEEE 802.4 Token Bus',            8,   None, True,     20000000,    'Token Bus over OnB'),
			('IEEE 802.5 Token Ring',           9,   None, True,     16000000,    'Token Ring'),
			('IEEE 802.6 MAN DQDB',             10,  None, True,     150000000,   'Metropolitan Area Network over DQDB'),
			# 11-14
			('FDDI',                            15,  None, True,     100000000,   'Fiber Distributed Data Interface'),
			('LAPB',                            16,  None, True,     None,        'Link Access Procedure, Balanced (ITU-T X.25, ISO/IEC 7776)'),
			('SDLC',                            17,  None, False,    None,        'Synchronous Data Link Control (IBM SNA)'),
			('ITU-T G.703 DS1',                 18,  19,   True,     1544000,     'DS1 carrier (ITU-T G.703)'),
			('ITU-T G.703 J1',                  18,  19,   True,     1544000,     'J1 carrier (ITU-T G.703)'),
			('ITU-T G.703 E1',                  18,  19,   True,     2048000,     'E1 carrier (ITU-T G.703)'),
			('ITU-T G.703 DS2',                 18,  19,   True,     6312000,     'DS2 carrier (ITU-T G.703)'),
			('ITU-T G.703 E2',                  18,  19,   True,     8448000,     'E2 carrier (ITU-T G.703)'),
			('I.430 ISDN BRI',                  20,  None, True,     16000,       'I.430 ISDN Basic Rate Interface'),
			('I.431 ISDN PRI',                  21,  None, True,     64000,       'I.431 ISDN Primary Rate Interface'),
			(_('P2P Serial'),                   22,  None, True,     None,        'Proprietary peer-to-peer serial'),
			('PPP',                             23,  None, False,    None,        'Point-to-Point Protocol (RFC 1661)'),
			(_('Loopback'),                     24,  None, False,    None,        'Software loopback'),
			# 25-27
			('SLIP',                            28,  None, False,    None,        'Serial Line Internet Protocol'),
			# 29
			('ITU-T G.751 DS3',                 30,  None, True,     44736000,    'DS3 carrier (ITU-T G.751)'),
			('ITU-T G.751 E3',                  30,  None, True,     34368000,    'E3 carrier (ITU-T G.751)'),
			# 31
			('Frame Relay DTE',                 32,  None, True,     None,        'Frame Relay DTE'),
			('RS-232',                          33,  None, True,     None,        'RS-232 serial interface'),
			('IEEE 1284 ParPort',               34,  None, True,     None,        'IEEE 1284 parallel port interface (LPT)'),
			('ARCnet',                          35,  None, True,     2500000,     'Attached Resource Computer NETwork'),
			('ARCnet Plus',                     36,  None, True,     20000000,    'Attached Resource Computer NETwork Plus'),
			# 37-38
			('SONET/SDH OC-3/STM-1',            39,  None, True,     155520000,   'Synchronous Optical Networking / Synchronous Digital Hierarchy optical carrier 3'),
			('SONET/SDH OC-12/STM-4',           39,  None, True,     622080000,   'Synchronous Optical Networking / Synchronous Digital Hierarchy optical carrier 12'),
			('SONET/SDH OC-24/STM-8',           39,  None, True,     1244160000,  'Synchronous Optical Networking / Synchronous Digital Hierarchy optical carrier 24'),
			('SONET/SDH OC-48/STM-16',          39,  None, True,     2488320000,  'Synchronous Optical Networking / Synchronous Digital Hierarchy optical carrier 48'),
			('SONET/SDH OC-96/STM-32',          39,  None, True,     4976640000,  'Synchronous Optical Networking / Synchronous Digital Hierarchy optical carrier 96'),
			('SONET/SDH OC-192/STM-64',         39,  None, True,     9953280000,  'Synchronous Optical Networking / Synchronous Digital Hierarchy optical carrier 192'),
			('SONET/SDH OC-768/STM-256',        39,  None, True,     39813120000, 'Synchronous Optical Networking / Synchronous Digital Hierarchy optical carrier 768'),
			('SONET/SDH OC-1536/STM-512',       39,  None, True,     79626240000, 'Synchronous Optical Networking / Synchronous Digital Hierarchy optical carrier 1536'),
			('X.25 PLE',                        40,  None, False,    None,        'X.25 Packet Level Entity'),
			('IEEE 802.2 LLC',                  41,  None, False,    None,        'IEEE 802.2 Logical Link Control'),
			# 42-44
			('V.35',                            45,  None, True,     None,        'ITU-T V.35 wideband'),
			('HSSI',                            46,  None, True,     None,        'High-Speed Serial Interface (EIA-612, EIA-613)'),
			('HIPPI-800',                       47,  None, True,     800000000,   'High-Performance Parallel Interface 800Mbps'),
			('HIPPI-1600',                      47,  None, True,     1600000000,  'High-Performance Parallel Interface 1600Mbps'),
			('HIPPI-6400',                      47,  145,  True,     6400000000,  'High-Performance Parallel Interface 6400Mbps (GSN)'),
			(_('Generic modem'),                48,  None, True,     None,        'Generic modem interface'),
			# 49-52
			(_('Proprietary virtual/internal'), 53,  None, False,    None,        'Non-standard proprietary virtual/internal interface'),
			(_('Proprietary multiplexing'),     54,  None, False,    None,        'Non-standard proprietary multiplexing interface'),
			('IEEE 802.12 100BaseVG',           55,  None, True,     100000000,   '100BaseVG Ethernet over cat3 4-twisted-pair cable (voice grade)'),
			('Fibre Channel',                   56,  None, True,     None,        'Fibre Channel'),
			# 57 - hippi again?
			# 58-72
			('IBM ESCON',                       73,  None, True,     None,        'IBM Enterprise Systems Connection'),
			# 74-93
			('ADSL',                            94,  None, True,     None,        'Asymmetric Digital Subscriber Line (ITU-T G.992)'),
			('RADSL',                           95,  None, True,     None,        'Rate-Adaptive Digital Subscriber Line (ANSI T1.TR.59)'),
			('SDSL',                            96,  None, True,     None,        'Symmetric Digital Subscriber Line'),
			('VDSL',                            97,  None, True,     None,        'Very-high-data-rate Digital Subscriber Line (ITU-T G.993.1)'),
			# 98
			('Myrinet',                         99,  None, True,     None,        'Myricom Myrinet (ANSI/VITA 26-1998)'),
			# 100-117
			('HDLC',                            118, None, False,    None,        'High-Level Data Link Control (ISO/IEC 13239)'),
			# 119-130
			(_('Tunnel'),                       131, None, False,    None,        'Encapsulation interface'),
			# 132-133
			(_('ATM Sub Interface'),            134, None, False,    None,        'ATM sub interface'),
			('L2 802.1Q VLAN',                  135, None, False,    None,        'Layer 2 Virtual LAN using IEEE 802.1Q'),
			('L3 IP VLAN',                      136, None, False,    None,        'Layer 3 Virtual LAN using IP'),
			('L3 IPX VLAN',                     137, None, False,    None,        'Layer 3 Virtual LAN using IPX'),
			(_('IP over Power Line'),           138, None, True,     None,        'IP over power lines'),
			# 139-141
			(_('IP Forward'),                   142, None, False,    None,        'IP forwarding interface'),
			# 143
			('IEEE 1394 Firewire',              144, None, True,     None,        'IEEE 1394 High Performance Serial Bus (Firewire / i.LINK / Lynx)'),
			# 146-148
			(_('ATM Virtual'),                  149, None, False,    None,        'ATM virtual interface'),
			(_('MPLS Tunnel'),                  150, None, False,    None,        'MPLS tunnel virtual interface'),
			# 151
			('VoATM',                           152, None, False,    None,        'Voice over ATM'),
			('VoFR',                            153, None, False,    None,        'Voice over Frame Relay'),
			('IDSL',                            154, None, False,    None,        'Digital Subscriber Line over ISDN (ANSI T1.418)'),
			# 155
			(_('SS7 Signaling'),                156, None, False,    None,        'SS7 signaling link'),
			(_('Proprietary P2P wireless'),     157, None, True,     None,        'Non-standard proprietary peer-to-peer wireless interface'),
			# 158-159
			('USB',                             160, None, True,     None,        'Universal Serial Bus interface'),
			('IEEE 802.3ad LAG',                161, None, False,    None,        'IEEE 802.3ad Link Aggregation Group'),
			# 162-165
			('MPLS',                            166, None, False,    None,        'Multiprotocol Label Switching'),
			# 167
			('HDSL2 (T1)',                      168, None, True,     1552000,     'High bit rate Digital Subscriber Line 2 over T1 (ANSI T1.418)'),
			('HDSL2 (E1)',                      168, None, True,     2048000,     'High bit rate Digital Subscriber Line 2 over E1 (ANSI T1.418)'),
			('SHDSL',                           169, None, True,     None,        'Single-pair High-speed Digital Subscriber Line (ITU-T G.991.2)'),
			# 170
			('POS',                             171, None, False,    None,        'Packet over SONET/SDH'),
			# 172-173
			('PowerLine',                       174, None, True,     None,        'Power Line Communications'),
			# 175-198
			('InfiniBand',                      199, None, True,     None,        'InfiniBand'),
			# 200-205
			('Acorn Econet',                    206, None, True,     None,        'Acorn Econet'),
			# 207-208
			(_('Bridge'),                       209, None, False,    None,        'Transparent bridge interface'),
			# 210-219
			('HomePNA',                         220, None, True,     None,        'HomePNA (ITU-T G.9951 through G.9954)'),
			# 221
			('L2 ISL VLAN',                     222, None, False,    None,        'Layer 2 Virtual LAN using Cisco ISL'),
			# 223-229
			('ADSL2',                           230, None, True,     None,        'Asymmetric Digital Subscriber Line 2 (ITU-T G.992.3)'),
			# 231-237
			('ADSL2+',                          238, None, True,     None,        'Asymmetric Digital Subscriber Line 2+ (ITU-T G.992.5)'),
			# 239-249
			('G-PON',                           250, None, True,     None,        'Gigabit-capable Passive Optical Network (ITU-T G.984.1)'),
			('VDSL2',                           251, None, True,     None,        'Very-high-data-rate Digital Subscriber Line 2 (ITU-T G.993.2)'),
			# 252-278
			('G.fast',                          279, None, True,     None,        'G.fast Digital Subscriber Line (ITU-T G.9700, ITU-T G.9701)')
		)
		for mdata in medias:
			media = models.NetworkDeviceMediaType(
				name=mdata[0],
				iftype=mdata[1],
				iftype_alternate=mdata[2],
				is_physical=mdata[3],
				speed=mdata[4],
				description=mdata[5]
			)
			sess.add(media)

		mibs = ('IF-MIB', 'BRIDGE-MIB', 'P-BRIDGE-MIB', 'Q-BRIDGE-MIB', 'IP-MIB', 'LLDP-MIB')

		for mib in mibs:
			sess.add(models.DeviceTypeFlagType(
				name='SNMP: %s' % (mib,),
				description='Support for %s SNMP values and tables' % (mib,)
			))