class ActionAbapRsusr002__IT_UTYPE(Base, StandardAuthSelectionOptionMixin,
                                   BaseMixin):
    """ Selection Options for User Types """
    __tablename__ = pluginName + '__IT_UTYPE'
    __table_args__ = {'extend_existing': True}

    CHOICE_USERTYPE = [('A', 'Dialog'), ('B', 'System'),
                       ('C', 'Communications Data'),
                       ('L', 'Reference (Logn not possible)'),
                       ('S', 'Service')]

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(pluginName + '__params.id'))

    LOW = Column(String,
                 nullable=False,
                 default=ActionAbapSuimUserTypeChoice.DIALOG,
                 qt_label='User Type',
                 qt_description='User Type',
                 choices=ActionAbapSuimUserTypeChoice.CHOICES)

    HIGH = Column(String,
                  nullable=True,
                  default=ActionAbapSuimUserTypeChoice.DIALOG,
                  qt_label='User Type',
                  qt_description='User Type',
                  choices=ActionAbapSuimUserTypeChoice.CHOICES)
class ActionAbapProfileValidation__params(QtModelMixin, Base, OperatorMixin, BaseMixin):
    """ Configuration for the profile validation :



    """

    __tablename__ = pluginName+'__params'

    check = relationship(pluginName, back_populates="params")
# TODO: Reenable when developing a restriction approach
#    restrictions = relationship(pluginName+'__params__restrictions')

    id = Column(Integer, ForeignKey('checks_metadata.id'), primary_key=True)


    param_set_name = Column(String,
                            qt_label='Parameter Set Name',
                            qt_description='Parameter Set Description')


    profiletype = Column(Integer,
                         qt_label='Profile',
                         choices=AbapProfileChoice.CHOICES,
                         default=AbapProfileChoice.DEFAULT)

    parameter = Column(String,
                       qt_label='Parameter',
                       qt_description='Profile Parameter')

    expected=Column(String,
                    qt_label='Expected')

    __qtmap__ = [param_set_name, parameter, profiletype, OperatorMixin.operator, expected]
class ActionAbapManualCheck__params(QtModelMixin, Base, BaseMixin,
                                    TableNameMixin):

    __tablename__ = plugin_name + '__params'

    __table_args__ = {'extend_existing': True}

    id = Column(Integer, primary_key=True)

    parent_id = Column(Integer, ForeignKey(plugin_name + '.id'))

    param_set_name = Column(
        String,
        nullable=False,
        qt_description=
        'Name of the parameter set. It is easier to navigate a large list of parameter sets, if they have a descriptive name',
        qt_label='Parameter Set Name',
        qt_show=False,
        default='Please Maintain')

    description = Column(
        RichString,
        nullable=True,
        qt_description='Detailed description of the manual activity',
        qt_label='Manual Action',
    )

    check = relationship("ActionAbapCountTableEntries",
                         back_populates="params")

    __qtmap__ = [param_set_name, description]
Beispiel #4
0
class ActionAbapJobSchedulingValidation(Check, ActionAbapIsNotClientSpecificMixin):

    __tablename__ = pluginName

    id = Column(Integer, ForeignKey('checks_metadata.id'), primary_key=True)
    params = relationship(pluginName+'__params', cascade="all, delete-orphan")

    __mapper_args__ = {
        'polymorphic_identity':pluginName,
    }

    __qtmap__ = [Check.name, Check.description, Check.failcriteria, Check.criticality]
class ActionAbapCountTableEntries__params(QtModelMixin, Base, OperatorMixin,
                                          BaseMixin, TableNameMixin):

    __table_args__ = {'extend_existing': True}

    id = Column(Integer, primary_key=True)

    parent_id = Column(Integer, ForeignKey('ActionAbapCountTableEntries.id'))

    param_set_name = Column(
        String,
        nullable=False,
        qt_description=
        'Name of the parameter set. It is easier to navigate a large list of parameter sets, if they have a descriptive name',
        qt_label='Parameter Set Name',
        qt_show=False,
        default='Please Maintain')

    table_name = Column(String,
                        nullable=False,
                        qt_description='Table Name',
                        qt_label='Table Name',
                        qt_show=False,
                        default='Please Maintain')

    table_fields = Column(String,
                          nullable=True,
                          qt_description='Table Fields, separated by a ";"',
                          qt_label='Table Fields',
                          qt_show=False)

    where_clause = Column(String,
                          nullable=True,
                          qt_description='Where Clause',
                          qt_label='Where Clause',
                          qt_show=False)

    expected_count = Column(
        Integer,
        nullable=True,
        qt_description='Expected Count',
        qt_label='Expected Count',
        qt_show=False,
    )

    check = relationship("ActionAbapCountTableEntries",
                         back_populates="params")

    __qtmap__ = [
        param_set_name, table_name, table_fields, where_clause, expected_count,
        OperatorMixin.operator
    ]
Beispiel #6
0
class CheckTreeStructure(QtModelMixin, Base, BaseMixin, TableNameMixin):

    __tablename__ = 'checks_metadata'

    __table_args__ = (UniqueConstraint("type", "name"), {
        'extend_existing': True
    })

    id = Column(Integer, primary_key=True, qt_show=False)

    parent_id = Column(Integer,
                       ForeignKey('checks_metadata.id'),
                       qt_label='Parent Key',
                       qt_show=False)

    name = Column(String(250),
                  nullable=False,
                  qt_label='Folder or Check Name',
                  qt_description='Name of the check or folder',
                  qt_show=True)

    description = Column(
        RichString,
        nullable=True,
        qt_label='Check Description',
        qt_description='Brief description what the check does',
    )

    children = relationship(
        'CheckTreeStructure',
        cascade="all, delete-orphan",
        backref=backref("parent_node", remote_side=id),
    )

    type = Column(
        String(250),
        nullable=False,
        qt_label='Node Type',
        qt_description='Node Type',
    )

    __qtmap__ = [name, description]

    __icon__ = ':Folder'

    __mapper_args__ = {
        'polymorphic_identity': 'CheckFolder',
        'polymorphic_on': type,
    }
class ActionAbapRuntimeParameter(Check, ActionAbapIsNotClientSpecificMixin):

    __tablename__ = 'ActionAbapRuntimeParameter'

    __table_args__ = {'extend_existing': True}

    id = Column(Integer, ForeignKey('checks_metadata.id'), primary_key=True)
    params = qtRelationship('ActionAbapRuntimeParameter__params',
                            cascade="all, delete-orphan")

    __mapper_args__ = {
        'polymorphic_identity': 'ActionAbapRuntimeParameter',
    }

    __qtmap__ = [
        Check.name, Check.description, Check.failcriteria, Check.criticality
    ]
class ActionAbapRsusr002__IT_PROF1(Base, StandardAuthSelectionOptionMixin,
                                   BaseMixin):
    """ Selection Options for Profiles """
    __tablename__ = pluginName + '__IT_PROF1'

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(pluginName + '__params.id'))

    LOW = Column(
        String(12),
        nullable=False,
        qt_label='Profile Name',
        qt_description='Profile Name',
    )

    HIGH = Column(
        String(12),
        nullable=True,
        qt_label='Profile Name',
        qt_description='Profile Name',
    )
class ActionAbapRsusr002__IT_SECPOL(Base, StandardAuthSelectionOptionMixin,
                                    BaseMixin):
    """ Selection Options for Security Policy """
    __tablename__ = pluginName + '__IT_SECPOL'
    __table_args__ = {'extend_existing': True}

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(pluginName + '__params.id'))

    LOW = Column(
        String(40),
        nullable=False,
        qt_label='Security Policy',
        qt_description='Security Policy. Must be specified.',
    )

    HIGH = Column(
        String(40),
        nullable=True,
        qt_label='Security Policy',
        qt_description='Security Policy (Upper range limit). Optional.',
    )
class ActionAbapRuntimeParameter__params(QtModelMixin, Base, OperatorMixin,
                                         BaseMixin):
    __tablename__ = 'ActionAbapRuntimeParameter__params'

    __table_args__ = {'extend_existing': True}

    id = Column(Integer, primary_key=True)

    parent_id = Column(Integer, ForeignKey('ActionAbapRuntimeParameter.id'))

    param_set_name = Column(
        String,
        nullable=False,
        qt_description=
        'Name of the parameter set. It is easier to navigate a large list of parameter sets, if they have a descriptive name',
        qt_label='Parameter Set Name',
        qt_show=False,
        default='Please Maintain')

    parameter = Column(String,
                       nullable=False,
                       qt_description='Runtime Parameter Name',
                       qt_label='Runtime Parameter Name',
                       default='Please Maintain')

    expected_value = Column(
        String,
        nullable=True,
        qt_description=
        'The expected value of the parameter. Regular Expressions are initiated with regex: at the beginning',
        qt_label='Expected Value',
    )

    check = qtRelationship("ActionAbapRuntimeParameter",
                           back_populates="params")

    __qtmap__ = [
        param_set_name, parameter, OperatorMixin.operator, expected_value
    ]
class ActionAbapRsusr002__IT_OBJCT(Base, StandardAuthSelectionOptionMixin,
                                   BaseMixin):

    __tablename__ = pluginName + '__IT_OBJCT'
    __table_args__ = {'extend_existing': True}

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(pluginName + '__params.id'))

    LOW = Column(
        String(10),
        nullable=False,
        qt_label='Authorization Object',
        qt_description='Authorization Object',
    )

    HIGH = Column(
        String(10),
        nullable=True,
        qt_label='Authorzation Object',
        qt_description='Authorization Object',
    )
class ActionAbapRsusr002__IT_UREF(Base, StandardAuthSelectionOptionMixin,
                                  BaseMixin):
    """ Selection Options for Reference Users """
    __tablename__ = pluginName + '__IT_UREF'
    __table_args__ = {'extend_existing': True}

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(pluginName + '__params.id'))

    LOW = Column(
        String(12),
        nullable=False,
        qt_label='Reference User',
        qt_description='Refernce User',
    )

    HIGH = Column(
        String(12),
        nullable=True,
        qt_label='Reference User',
        qt_description='Refernce User',
    )
class ActionAbapRsusr002__IT_UGROUP(Base, StandardAuthSelectionOptionMixin,
                                    BaseMixin):
    """ Selection Options for User Groups  """

    __tablename__ = pluginName + '__IT_UGROUP'
    __table_args__ = {'extend_existing': True}

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(pluginName + '__params.id'))

    LOW = Column(
        String(12),
        nullable=False,
        qt_label='User Group',
        qt_description='User Goup. Must be specified.',
    )

    HIGH = Column(
        String(12),
        nullable=True,
        qt_label='User Group',
        qt_description='User Group (Upper range limit). Optional.',
    )
class ActionAbapRsusr002__IT_SNC(Base, StandardAuthSelectionOptionMixin,
                                 BaseMixin):
    """ Selection Options for SNC """

    __tablename__ = pluginName + '__IT_SNC'
    __table_args__ = {'extend_existing': True}

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(pluginName + '__params.id'))

    LOW = Column(
        String(255),
        nullable=False,
        qt_label='SNC: Printable Name',
        qt_description='SNC Printable Name',
    )

    HIGH = Column(
        String(255),
        nullable=True,
        qt_label='SNC: Printable Name',
        qt_description='SNC: Printable Name',
    )
class ActionAbapRsusr002__IT_USER(Base, StandardAuthSelectionOptionMixin,
                                  BaseMixin):
    """ Selection Options for Users"""
    __tablename__ = pluginName + '__IT_USER'

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(pluginName + '__params.id'))

    LOW = Column(
        String(12),
        nullable=False,
        default='',
        qt_label='User Name in User Master Record',
        qt_description='User Name in User Master Record. Must be specified.',
    )

    HIGH = Column(
        String(12),
        nullable=True,
        default='',
        qt_label='User Name in User Master Record',
        qt_description=
        'User Name in User Master Record (Upper range limit). Optional.',
    )
class ActionAbapCountTableEntries(Check, ActionAbapClientSpecificMixin):

    __tablename__ = 'ActionAbapCountTableEntries'

    __table_args__ = {'extend_existing': True}

    id = Column(Integer,
                ForeignKey('checks_metadata.id'),
                primary_key=True,
                qt_show=False)

    params = qtRelationship('ActionAbapCountTableEntries__params',
                            qt_show=True,
                            cascade="all, delete-orphan",
                            back_populates="check")

    __mapper_args__ = {
        'polymorphic_identity': 'ActionAbapCountTableEntries',
    }

    __qtmap__ = [
        Check.name, Check.description, Check.failcriteria, Check.criticality,
        ActionAbapClientSpecificMixin.client_specific
    ]
class ActionAbapRsusr002(Check, ActionAbapIsClientSpecificMixin):

    __tablename__ = pluginName

    __table_args__ = {'extend_existing': True}

    id = Column(Integer, ForeignKey('checks_metadata.id'), primary_key=True)
    params = relationship(pluginName + '__params',
                          cascade="all, delete-orphan")
    consolidation = Column(
        Integer,
        default=ActionAbapRsusr002ResultConsolidationChoice.INDIVIDUAL,
        qt_description='Merge so that only common results are presented',
        qt_label='Result Set Merge Strategy',
        choices=ActionAbapRsusr002ResultConsolidationChoice.CHOICES)

    __qtmap__ = [
        Check.name, Check.description, Check.failcriteria, consolidation,
        Check.criticality
    ]

    __mapper_args__ = {
        'polymorphic_identity': pluginName,
    }
Beispiel #18
0
class ActionAbapJobSchedulingValidation__params(QtModelMixin, Base, OperatorMixin, BaseMixin):
    """ Job Scheduling Validation:



    """

    __tablename__ = pluginName+'__params'

    check = relationship(pluginName, back_populates="params")

    id = Column(Integer, ForeignKey('checks_metadata.id'), primary_key=True)


    param_set_name = Column(String,
                            qt_label='Parameter Set Name',
                            qt_description='Parameter Set Description')

    expected_count = Column(Integer,
                            qt_label='Expected Executions')

    operator = Column(String,
                      qt_label='Comparison Operator',
                      choices=ActionAbapJobSchedulingValidationComparisonOperator.CHOICES,
                      default=ActionAbapJobSchedulingValidationComparisonOperator.LE)

    interval = Column(Integer,
                      qt_label='Interval',
                      qt_description='Interval, for example 3 for 3 hours')

    interval_type=Column(String,
                         qt_label='Interval Type',
                         qt_description='Interval Type',
                         choices=ActionAbapJobSchedulingValidationIntervalType.CHOICES,
                         default=ActionAbapJobSchedulingValidationIntervalType.HOUR)

    #executionclient = Column(String, qt_label='Client', qt_description='Client')
    abapname = Column(String, qt_label='ABAP Program Name', qt_description='Name of the ABAP Program')
    sel_jobname = Column(String, qt_label='Job Name', qt_description='Name of the Job')
    sel_jobcount = Column(String, qt_label='Job Count', qt_description='Internal Number of the job')
    sel_jobgroup = Column(String, qt_label='Job Group', qt_description='Job Group')
    sel_username = Column(String, qt_label='Username', qt_description='Job Scheduler')
    sel_from_date = Column(Date, qt_label='From Date', qt_description='From Date')
    sel_from_time = Column(Time, qt_label='From Time', qt_description='From Time')
    sel_to_date  = Column(Date, qt_label='To Date', qt_description='To Date')
    sel_to_time = Column(Time, qt_label='To Time', qt_description='To Time')

    sel_no_date = Column(Boolean,
                         qt_label='Without Date',
                         qt_description='No Date',
                         choices=models.meta.YesNoChoice.CHOICES)

    sel_with_pred = Column(Boolean,
                           qt_label='With Predecessor',
                           qt_description='With Predecessor',
                           choices=models.meta.YesNoChoice.CHOICES)

    sel_eventid = Column(String, qt_label='Event ID', qt_description='Event ID')
    sel_eventpara = Column(String, qt_label='Event Parameter', qt_description='Event Parameter')

    sel_prelim = Column(Boolean,
                        qt_label='Status Preliminary',
                        qt_description='Status Preliminary',
                        choices=models.meta.YesNoChoice.CHOICES)

    sel_schedul= Column(Boolean,
                        qt_label='Status Scheduled',
                        qt_description='Status Scheduled',
                        choices=models.meta.YesNoChoice.CHOICES)

    sel_ready = Column(Boolean,
                       qt_label='Status Ready',
                       qt_description='Status Ready',
                       choices=models.meta.YesNoChoice.CHOICES)

    sel_running = Column(Boolean,
                         qt_label='Status Running',
                         qt_description='Status Running',
                         choices=models.meta.YesNoChoice.CHOICES)

    sel_finished  = Column(Boolean,
                           qt_label='Status Finished',
                           qt_description='Status Finished',
                           choices=models.meta.YesNoChoice.CHOICES)

    sel_aborted  = Column(Boolean,
                          qt_label='Status Aborted',
                          qt_description='Status Aborted',
                          choices=models.meta.YesNoChoice.CHOICES)


    #TODO: At some point, add the selection options for dates and time

    __qtmap__ = [param_set_name, expected_count, operator, interval, interval_type, abapname, sel_jobname, sel_jobcount,
                 sel_jobgroup, sel_username, sel_with_pred, sel_eventid, sel_prelim, sel_schedul, sel_ready, sel_running, sel_finished, sel_aborted]
Beispiel #19
0
class SystemAbapClient(generic.models.GenericSystemTreeNode,
                       PasswordKeyringMixin):
    """ Contains ABAP specific information"""
    __tablename__ = 'SystemAbapClient'
    __table_args__ = {'extend_existing': True}
    __mapper_args__ = {
        'polymorphic_identity': 'SystemAbapClient',
    }

    __icon__ = ':Brief'

    id = Column(Integer,
                ForeignKey('systems.id'),
                primary_key=True,
                qt_show=False)

    client = Column(
        String(3),
        nullable=False,
        qt_label='Client',
        qt_description='The 3 digit number that describes the client',
    )

    use_sso = Column(
        Boolean,
        default=YesNoChoice.YES,
        choices=YesNoChoice.CHOICES,
        qt_label='Use SSO',
        qt_description='Use Single Sign On',
    )
    username = Column(String(40),
                      default='<initial>',
                      nullable=True,
                      qt_label='Username',
                      qt_description='Username to logon to the ABAP Client')

    __qtmap__ = [
        client, generic.models.GenericSystem.description, use_sso, username
    ]

    def __init__(self, **kwargs):
        uuid_string = str(uuid.uuid4())
        self.keyring_uuid = uuid_string
        self.client = kwargs.get('client')
        self.description = kwargs.get('description')
        self.username = kwargs.get('username')
        self.password = kwargs.get('password')
        self.use_sso = kwargs.get('use_sso')

    def _icon(self):
        return ":Client"

    def getDefaultClient(self):

        parent = self.parent_node
        return parent.getDefaultClient()

    def logon_info(self):
        snc_qop = None
        snc_partnername = None
        logon_info = {}
        self.logger = logging.getLogger('{}.{}'.format(
            __name__, self.__class__.__name__))
        abap_system = self.parent_node
        if abap_system:
            sysid = abap_system.sid
            logon_info[
                'sysid'] = sysid  #technically only required for load balancing, but we specify it
            # anyway since it's handy down the road.
            logon_info['client'] = self.client
            if abap_system.ms_hostname and abap_system.ms_sysnr and abap_system.ms_logongroup:
                mshost = abap_system.ms_hostname
                msserv = '36' + abap_system.ms_sysnr
                group = abap_system.ms_logongroup
                self.logger.debug(
                    'Logon using Load Balancing. mshost: %s, msserv: %s, sysid: %s, group: %s',
                    mshost, msserv, sysid, group)
                logon_info['mshost'] = mshost
                logon_info['msserv'] = msserv
                logon_info['group'] = group
            elif abap_system.as_hostname and abap_system.as_sysnr:
                logon_info['ashost'] = abap_system.as_hostname
                logon_info['sysnr'] = abap_system.as_sysnr
                self.logger.debug(
                    'Logon using direct as connection. ashost: %s, sysnr: %s',
                    logon_info['ashost'], logon_info['sysnr'])
            else:
                return False

            if abap_system.use_snc:
                snc_qop = abap_system.snc_qop
                snc_partnername = abap_system.snc_partnername
                self.logger.debug('Use SNC: snc_qop: %s, snc_partnername: %s',
                                  snc_qop, snc_partnername)

                if CONFIG['systemtype_ABAP'].get('snc.library'):
                    snc_lib = CONFIG['systemtype_ABAP'].get('snc.library')
                    self.logger.debug('SNC Lib specified in config: %s',
                                      snc_lib)
                    logon_info['snc_lib'] = snc_lib

            if self.use_sso and abap_system.use_snc:
                snc_myname = get_snc_name()
                self.logger.debug('Use SSO: snc_myname: %s', snc_myname)

                if snc_myname and snc_partnername and snc_qop:
                    self.logger.debug(
                        'Use SNC: snc_qop: %s, snc_partnername: %s, snc_myname: %s',
                        snc_qop, snc_partnername, snc_myname)
                    logon_info['snc_qop'] = snc_qop
                    logon_info['snc_partnername'] = snc_partnername
                    logon_info['snc_myname'] = snc_myname

                else:
                    self.logger.error(
                        'SSO usage configured, but parameters are incomplete: '
                        'snc_qop: %s, snc_partnername: %s, snc_myname: %s',
                        snc_qop, snc_partnername, snc_myname)
                    return False
            else:
                user = self.username
                passwd = self.password

                if user and passwd:
                    if CONFIG['application'].getboolean(
                            'app.log_sensitive_info'):
                        self.logger.debug('no SSO: user: %s, passwd: %s', user,
                                          passwd)
                    else:
                        self.logger.debug('no SSO: user: %s, passwd: XXXXXXXX',
                                          user)

                    logon_info['user'] = user
                    logon_info['passwd'] = passwd
                else:
                    self.logger.error(
                        'No SSO, but username or Password missing')
                    return False
        return logon_info
Beispiel #20
0
class SystemAbap(generic.models.GenericSystem):
    """ ABAP System Specification
    """

    __tablename__ = 'systems_ABAP'
    __table_args__ = {'extend_existing': True}

    __icon__ = ':Server'

    id = Column(Integer,
                ForeignKey('systems.id'),
                primary_key=True,
                qt_show=False)

    sid = Column(String(32),
                 unique=False,
                 nullable=False,
                 default='NEW',
                 qt_label='SID',
                 qt_description='Unique System Identifier')

    tier = Column(
        String(32),
        nullable=True,
        default='Unspecified',
        qt_label='Tier',
        qt_description=
        'Tier the system resides in (for example DEV, PRD, or others)',
    )

    rail = Column(
        String(32),
        nullable=True,
        default='Unspecified',
        qt_label='Rail',
        qt_description='The rail the system resides in (N, N+1)',
    )

    enabled = Column(
        Boolean,
        default=YesNoChoice.YES,
        choices=YesNoChoice.CHOICES,
        qt_label='Enabled',
        qt_description='System enabled',
    )

    snc_partnername = Column(
        String(250),
        nullable=True,
        qt_label="SNC Partner Name",
        qt_description="SNC Partner Name",
    )

    snc_qop = Column(
        String,
        nullable=True,
        default=SystemAbapSncChoice.MAX,
        qt_label='SNC QoP',
        qt_description='SNC Quality of Protection',
        choices=SystemAbapSncChoice.CHOICES,
    )

    use_snc = Column(
        Boolean,
        default=YesNoChoice.YES,
        choices=YesNoChoice.CHOICES,
        qt_label='Use SNC',
        qt_description='Use a secured connection',
    )

    default_client = Column(
        String(3),
        unique=False,
        nullable=False,
        default='000',
        qt_label='Default Client',
        qt_description=
        'The client that should be used for client independent checks',
    )

    ms_hostname = Column(
        String(250),
        nullable=True,
        qt_label='MS Hostname',
        qt_description=
        'Specify the Message Server for load balanced connections',
    )

    ms_sysnr = Column(
        String(2),
        default='00',
        nullable=True,
        qt_label='MS SysNr.',
        qt_description='System Number of the message server',
    )

    ms_logongroup = Column(
        String(32),
        nullable=True,
        qt_label='Logon Group',
        default='PUBLIC',
        qt_description='Logon Group to use for load balanced connections',
    )

    as_hostname = Column(
        String(250),
        nullable=True,
        qt_label='AS Hostname',
        qt_description=
        'Application Server Hostname, to be used in case load balancing should not be used.',
    )

    as_sysnr = Column(String(2),
                      nullable=True,
                      default='00',
                      qt_label='AS SysNr.',
                      qt_description='System Number of the application server')

    __mapper_args__ = {
        'polymorphic_identity': 'systems_ABAP',
    }

    __qtmap__ = [
        generic.models.GenericSystem.name,
        generic.models.GenericSystem.description,
        generic.models.GenericSystem.category, sid, tier, rail, enabled,
        snc_partnername, snc_qop, use_snc, default_client, ms_hostname,
        ms_sysnr, ms_logongroup, as_hostname, as_sysnr
    ]

    def _icon(self):
        return ":SAP"

    def getDefaultClient(self):

        for client in self.children:
            if client.client == self.default_client:
                return client
        raise ValueError('No definition of default client for the system')
class ActionAbapRsusr002__params(QtModelMixin, Base, BaseMixin):
    """ The config data for the RSUSR002 plugin. Possible Parameters of the Function Module:

    ok: IT_USER	TYPE	SUSR_T_RANGE_4_XUBNAME	                     	Benutzerliste
    ok: IT_GROUP	TYPE	SUSR_T_SEL_OPT_GROUP	                     	Benutzergruppeliste
    ok: IT_UGROUP	TYPE	SUSR_T_SEL_OPT_GROUP	                     	Selektionsoptionen für Benutzergruppe
    ok: IT_UALIAS	TYPE	SUSR_T_SEL_OPT_ALIAS	                     	Selektionsoptionen für Alias
    ok: IT_UTYPE	TYPE	SUSR_T_SEL_OPT_UTYPE	                     	Selektionsoptionen für Benutzetyp
    ok: IT_SECPOL	TYPE	SUSR_T_SEL_OPT_SECPOL	                     	Selektionsoptionen für Sicherheitsrichtlinie
    ok: IT_SNC	TYPE	SUSR_T_SEL_OPT_SNC	                     	Selektionsoptionen für SNC
    ok: IV_USER_LOCK	TYPE	SUIM_LOCK_SEL	                     	Sperrestatus Y=gesperrt, N=nicht gesperrt, Space = irrelevant
    ok: IV_PWD_LOCK	TYPE	SUIM_LOCK_SEL	                     	Sperrestatus Y=gesperrt, N=nicht gesperrt, Space = irrelevant
    ok: IV_LOCK	TYPE	BOOLE_D	                     	Alle Benutzer mit Administrator- oder Kennwortspe: TRUE (='X') und FALSE (=' ')
    ok: IV_UNLOCK	TYPE	BOOLE_D	                     	Nur Benutzer ohne Sperren: TRUE (='X') und FALSE (=' ')
    ok: IV_FDATE	TYPE	CDDATUM	                     	Ablauf Gültigkeit von
    ok: IV_TDATE	TYPE	CDDATUM	                     	Ablauf Gültigkeit bis
    later: IT_LIC_TYPE	TYPE	SUSR_T_SEL_OPT_LIC_TYPE	                     	Selektionsoptionen für Lizenztypen
    later: IT_ACCNT	TYPE	SUSR_T_SEL_OPT_ACCNT	                     	Selektionsoptionen für Account-Id
    later: IT_KOSTL	TYPE	SUSR_T_SEL_OPT_KOSTL	                     	Selektionsoptionen für Kostenstelle
    later: IT_STCOD	TYPE	SUSR_T_SEL_OPT_STCOD	                     	Selektionsoptionen für Startmenü
    later: IT_LANGU	TYPE	SUSR_T_SEL_OPT_LANGU	                     	Selektionsoptionen für Sprache
    later: IV_DCPFM	TYPE	SUSR_T_SEL_OPT_DCPFM	                     	Dezimaldarstellung
    later: IV_DATFM	TYPE	SUSR_T_SEL_OPT_DATFM	                     	Datumsdarstellung
    later: IV_TIMEFM	TYPE	SUSR_T_SEL_OPT_TIMEFM	                     	Zeitformat (12-/24-Stundenangabe)
    later: IT_SPLD	TYPE	SUSR_T_SEL_OPT_SPLD	                     	Selektionsoptionen für Gerätenamen
    later: IV_TZONE	TYPE	TZNZONE	                     	Zeitzone
    later: IV_CATTK	TYPE	BOOLE_D	                     	Datenelement zur Domäne BOOLE: TRUE (='X') und FALSE (=' ')
    later: IT_PARID	TYPE	SUSR_T_SEL_OPT_PARID	                     	Selektionsoptionen für Set-/Get-Paramter-Id

    ok: IV_TCODE	TYPE	TCODE	                     	Transaktionscode
    ok: IV_START_TX	TYPE	BOOLE_D	                     	nur ausführbare Transaktion
    ok: IT_UREF	TYPE	SUSR_T_SEL_OPT_REF	                     	Selektionsoptionen für Referenzbenutzer
    ok: IT_ACTGRPS	TYPE	SUSR_T_SEL_OPT_AGR	                     	Selektionsoptionen für Rolle
    ok: IT_PROF1	TYPE	SUSR_T_SEL_OPT_PROF	                     	Selektionsoptionen für Profile
    ok: IV_PROF2	TYPE	XUPROFNAME	                     	Berechtigungsprofil in Benutzerstammpflege
    ok: IV_PROF3	TYPE	XUPROFNAME	                     	Berechtigungsprofil in Benutzerstammpflege
    ok: IV_CONV1	TYPE	BOOLE_D	                     	Datenelement zur Domäne BOOLE: TRUE (='X') und FALSE (=' ')
    ok: IV_AUTH_FLD	TYPE	FIELDNAME	                     	Feldname
    ok: IV_AUTH_VAL	TYPE	XUVAL	                     	Berechtigungswert
    ok: IT_OBJCT	TYPE	SUSR_T_SEL_OPT_OBJECT	                     	Selektionsoptionen für Berechtigungsobjekte
    ok: IT_AUTH	TYPE	SUSR_T_SEL_OPT_AUTH	                     	Selektionsoptionen für Berechtigungen
    ok: IV_CONV	TYPE	BOOLE_D	                     	Datenelement zur Domäne BOOLE: TRUE (='X') und FALSE (=' ')
    ok: IT_VALUES	TYPE	SUSR_T_SEL_OPT_VAL	                     	Übergabestruk. für Abgrenzungen bei Sel. nach Berecht.werten


    """

    __tablename__ = pluginName + '__params'

    __table_args__ = {'extend_existing': True}

    check = relationship(pluginName, back_populates="params")

    id = Column(Integer, ForeignKey('checks_metadata.id'), primary_key=True)

    param_set_name = Column(String,
                            qt_label='Parameter Set Name',
                            qt_description='Parameter Set Description')

    IT_USER = qtRelationship(pluginName + '__IT_USER',
                             qt_label='User',
                             cascade="all, delete-orphan")
    IT_GROUP = qtRelationship(pluginName + '__IT_GROUP',
                              qt_label='Group for Authorization',
                              cascade="all, delete-orphan")
    IT_UGROUP = qtRelationship(pluginName + '__IT_UGROUP',
                               qt_label='User group (general)',
                               cascade="all, delete-orphan")
    IT_UALIAS = qtRelationship(pluginName + '__IT_UALIAS',
                               qt_label='Alias',
                               cascade="all, delete-orphan")
    IT_UTYPE = qtRelationship(pluginName + '__IT_UTYPE',
                              qt_label='User Type',
                              cascade="all, delete-orphan")
    IT_SECPOL = qtRelationship(pluginName + '__IT_SECPOL',
                               qt_label='Security Policy',
                               cascade="all, delete-orphan")
    IT_SNC = qtRelationship(pluginName + '__IT_SNC',
                            qt_label='SNC Name',
                            cascade="all, delete-orphan")

    IV_USER_LOCK = Column(String,
                          nullable=False,
                          default=ActionAbapSuimLockStatusChoice.IGNORE,
                          qt_label='Administrator Lock',
                          qt_description='Administrator Lock Status',
                          choices=ActionAbapSuimLockStatusChoice.CHOICES)

    IV_PWD_LOCK = Column(String,
                         nullable=False,
                         default=ActionAbapSuimLockStatusChoice.IGNORE,
                         qt_label='Invalid Password Locks',
                         qt_description='Invalid Password Locks',
                         choices=ActionAbapSuimLockStatusChoice.CHOICES)

    IV_LOCK = Column(
        Boolean,
        default=False,
        qt_label='All Users with Admin and Password Locks',
        qt_description='All Users with Admin and Password Locks',
    )

    IV_UNLOCK = Column(
        Boolean,
        default=True,
        qt_label='Only Unlocked Users',
        qt_description='Only Unlocked Users',
    )

    IV_FDATE = Column(
        String,
        qt_label='Valid From Date',
        qt_description='Valid From Date',
    )

    IV_TDATE = Column(
        String,
        qt_label='Valid To Date',
        qt_description='Valid To Date',
    )

    IV_TCODE = Column(
        String(20),
        default='',
        qt_label='Transaction Code',
        qt_description='Transaction Code',
    )

    IV_START_TX = Column(
        Boolean,
        default=True,
        qt_label='Only Executable Transactions',
        qt_description='Only Executable Transactions',
    )

    IT_UREF = qtRelationship(pluginName + '__IT_UREF',
                             qt_label='Reference User',
                             cascade="all, delete-orphan")

    IT_ACTGRPS = qtRelationship(pluginName + '__IT_ACTGRPS',
                                qt_label='Role',
                                cascade="all, delete-orphan")

    IT_PROF1 = qtRelationship(pluginName + '__IT_PROF1',
                              qt_label='Profile Name',
                              cascade="all, delete-orphan")

    IV_PROF2 = Column(
        String(12),
        nullable=True,
        qt_label='AND Profile',
        qt_description='Additional Authorization Profile Name',
    )

    IV_PROF3 = Column(
        String(12),
        nullable=True,
        qt_label='AND Profile',
        qt_description='Authorization Profile Name',
    )

    IV_CONV1 = Column(
        Boolean,
        default=False,
        qt_label='Always Convert Value',
        qt_description='Always Convert Value',
    )

    IV_AUTH_FLD = Column(
        String(12),
        nullable=True,
        qt_label='Authorization Field',
        qt_description='Authorization Field',
    )

    IV_AUTH_VAL = Column(
        String(12),
        nullable=True,
        qt_label='Authorization Value',
        qt_description='Authorization Value',
    )

    IT_OBJCT = qtRelationship(pluginName + '__IT_OBJCT',
                              qt_label='Authorization Object',
                              cascade="all, delete-orphan")
    IT_AUTH = qtRelationship(pluginName + '__IT_AUTH',
                             qt_label='Authorization',
                             cascade="all, delete-orphan")

    IV_CONV = Column(
        Boolean,
        default=False,
        qt_label='Always Convert Value',
        qt_description='Always Convert Value',
    )

    IT_VALUES = qtRelationship(pluginName + '__IT_VALUES')

    __qtmap__ = [
        param_set_name, IV_PWD_LOCK, IV_TCODE, IT_USER, IT_GROUP, IT_UGROUP
    ]
class ActionAbapRsusr002__IT_VALUES(QtModelMixin, Base, BaseMixin):
    """ Sel. According to Authorization Values """

    __tablename__ = pluginName + '__IT_VALUES'

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey(pluginName + '__params.id'))

    NR = Column(
        String(1),
        nullable=False,
        qt_label='Auth. Name',
        qt_description='Auth. Name',
    )

    OBJCT = Column(
        String(10),
        nullable=False,
        qt_label='Auth. Object',
        qt_description='Auth. Object',
    )

    FIELD = Column(
        String(10),
        nullable=False,
        qt_label='Value',
        qt_description='Value',
    )

    VAL1 = Column(
        String(40),
        nullable=False,
        qt_label='Value',
        qt_description='Value',
    )

    VAL2 = Column(
        String(40),
        nullable=True,
        qt_label='Value',
        qt_description='Value',
    )

    VAL3 = Column(
        String(40),
        nullable=True,
        qt_label='Value',
        qt_description='Value',
    )

    VAL4 = Column(
        String(40),
        nullable=True,
        qt_label='Value',
        qt_description='Value',
    )

    VAL5 = Column(
        String(40),
        nullable=True,
        qt_label='Value',
        qt_description='Value',
    )