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]
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 StandardAbapAuthSelectionOptionMixin: SIGN = Column( String, nullable=False, default=InclusionChoice.INCLUDE, qt_label='Incl./Excl.', qt_description= 'Should the specified items be included or excluded? Default is to include them', choices=InclusionChoice.CHOICES) OPTION = Column( String, nullable=False, default=OptionChoice.EQ, qt_label='Sel. Option', qt_description='Selection option', choices=OptionChoice.CHOICES, ) LOW = Column( String(12), nullable=False, qt_label='Lower Range Value', qt_description='Lower Range Value. Must be specified.', ) HIGH = Column( String(12), nullable=True, qt_label='Higher Range Value', qt_description='Higher Range Value. Optional.', )
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 GenericSystemTreeNode(Base, QtModelMixin, BaseMixin): """ A generic node that is the foundation of the tree stored in a database table""" __tablename__ = 'systems' __table_args__ = {'extend_existing': True} id = Column(Integer, primary_key=True, qt_label='Primary Key') parent_id = Column(Integer, ForeignKey('systems.id'), qt_label='Parent Key') type = Column(String(50), qt_show=False, qt_label='Type') name = Column(String(50), qt_show=True, qt_label='Name') description = Column( RichString, nullable=True, qt_label='Description', qt_description='Brief description', ) children = relationship( 'GenericSystemTreeNode', cascade="all, delete-orphan", backref=backref("parent_node", remote_side=id), ) __mapper_args__ = { 'polymorphic_identity': 'GenericSystemTreeNode', 'polymorphic_on': type, } __qtmap__ = [name, description] def _dump(self, _indent=0) -> str: """ Recursively return the structure of the node and all its children as text """ return " " * _indent + repr(self) + \ "\n" + \ "".join([ c._dump(_indent + 1) for c in self.children ]) def _system_node(self): return None def logon_info(self): """ Provide the Logon Information to the system Reimplement this method for all relevant system nodes """ return None
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 ActionAbapClientSpecificMixin: """ Creates a checkbox for all ABAP checks to define whether they are client specific or not """ client_specific = Column( Boolean, name='client_specific', default=YesNoChoice.YES, choices=YesNoChoice.CHOICES, qt_label='Client Specific', qt_description='Check the box if the check is client specific')
class ActionAbapIsNotClientSpecificMixin: """ Define a readonly property for client independent checks """ client_specific = Column( Boolean, default=YesNoChoice.NO, choices=YesNoChoice.CHOICES, qt_description= "This check is not client specific. It's not possible to manually " "change this value", qt_enabled=False)
class NumberRange: """ A Number Range Implementation Unique numbers are important. This approach follows a similar approach as SAP's ABAP System. """ __tablename__ = 'NumberRanges' id = Column(Integer, primary_key=True) name = Column(String, unique=True, qt_label='Number Range Name', nullable=False) value = Column(Integer, qt_label='Value', nullable=False, default=0) start = Column(Integer, qt_label='Value', nullable=True, default=0) end = Column(Integer, qt_label='Value', nullable=True, default=0) @validates('name') def convert_upper(self, key, value): return value.upper()
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 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 StandardAuthSelectionOptionMixin(QtModelMixin): SIGN = Column( String, name='SIGN', nullable=False, default=SystemAbapIncludeChoice.INCLUDE, qt_label='Incl./Excl.', qt_description= 'Should the specified items be included or excluded? Default is to include them', choices=SystemAbapIncludeChoice.CHOICES, ) OPTION = Column( Integer, name='OPTION', nullable=False, default=SystemAbapOptionChoice.EQ, qt_label='Sel. Option', qt_description='Selection option', choices=SystemAbapOptionChoice.CHOICES, ) LOW = Column( String(12), name='LOW', nullable=False, qt_label='Lower Range Value', qt_description='Lower Range Value. Must be specified.', ) HIGH = Column( String(12), name='HIGH', nullable=True, qt_label='Higher Range Value', qt_description='Higher Range Value. Optional.', ) __qtmap__ = [SIGN, OPTION, LOW, HIGH]
class GenericSystem(GenericSystemTreeNode): category = Column(Integer, choices=SystemCategoryChoices.CHOICES, default=SystemCategoryChoices.DEV, qt_label='System Category', qt_description='System Category') __mapper_args__ = { 'polymorphic_identity': 'GenericSystem', } __table_args__ = {'extend_existing': True}
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_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_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_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_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 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 ]
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 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, }
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 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 Check(CheckTreeStructure): """ The Generic Data Model of a Check Similar to the generic tree for systems, this is a tree structure for checks. """ __tablename__ = 'checks_metadata' __table_args__ = (UniqueConstraint("type", "name"), { 'extend_existing': True }) criticality = Column( String, nullable=False, qt_label='Criticality', qt_description= 'Describes the criticality of the finding or whether it is informational only', choices=CriticalityChoice.CHOICES, default=CriticalityChoice.INFO) failcriteria = Column( String, default=CheckFailCriteriaOptions.FAIL_IF_ANY_FAILS, qt_description='Defines when a check is considered as failed. ', qt_label='Fail Criteria', choices=CheckFailCriteriaOptions.CHOICES, ) technical_name = Column( String, qt_label='Technical Name', qt_description='Each Check has a unique technical name') __qtmap__ = [ CheckTreeStructure.name, CheckTreeStructure.description, criticality, failcriteria ] __icon__ = ':Checkmark' def _parameter_count(self): count = len(self.params) return count def _restriction_count(self): return len(self.restrictions) def _add_parameter_set(self, parameterDict): paramClass = Base._decl_class_registry.get(self.__class__.__name__ + '__params') if paramClass: paramObject = paramClass(**parameterDict) self.params.append(paramObject) __mapper_args__ = { 'polymorphic_identity': 'Check', }
class Abap_BPJOBSTEP_Mixin: PROGRAM = Column(String(128), nullable=True, qt_label='Program Name') TYP = Column(String(1), nullable=True, qt_description= 'Identification of Step as ABAP, ext. command or program', qt_label='Step Type') PARAMETER = Column(String(255), nullable=True, qt_description='Parameters of external program', qt_label='Ext. Prog. Params') OPSYSTEM = Column(String(10), nullable=True, choices=AbapAppServerOsChoices, qt_label='App Server OS') AUTHCKNAM = Column( String(12), qt_label='Step User', qt_description='Background User Name for Authorization Check', nullable=True) LISTIDENT = Column( String(10), qt_label='Job Output Id', qt_description='ID of batch job output list in the spool', nullable=True) XPGPID = Column(String(10), qt_label='ID of ext. Program', qt_description='ID of External Program', nullable=True) XPGTGTSYS = Column(String(32), qt_label='Target System', qt_description='Target System to Run Background Job', nullable=True) XPGRFCDEST = Column( String(32), qt_label='Logical Destination', qt_description='Logical Destination (Specified in function call)', nullable=True) LANGUAGE = Column(String(10), choices=AbapLanguageChoices.CHOICES, default=AbapLanguageChoices.EN, qt_label='Language', qt_description='Language', nullable=True) STATUS = Column(String(1), qt_label='Step Status', qt_description='Language', nullable=True) CONNCNTL = Column(String(1), qt_label='Control Flag for ext. Prog', qt_description='Language', nullable=True)
class AbapSpoolParams_BAPIPRIPAR_Mixin: PDEST = Column(String(4), qt_label='Spool Output Device', nullable=True, name='PDEST', default='LP01') PRCOP = Column(Integer, qt_label='Number of Spool Copies', name='PRCOP', nullable=True) PLIST = Column(String(12), qt_label='Spool Request', name='PLIST', nullable=True) PRTXT = Column(String(68), qt_label='Spool Description', name='PRTXT', nullable=True) PRIMM = Column(Boolean, qt_label='Immediate Spool Print', choices=YesNoChoice.CHOICES, default=YesNoChoice.NO, name='PRIMM', nullable=False) PRREL = Column(Boolean, qt_label='Immediate Spool Deletion', choices=YesNoChoice.CHOICES, name='PRREL', nullable=True) PRNEW = Column(Boolean, qt_label='Immediate Spool Deletion', choices=YesNoChoice.CHOICES, name='PRNEW', nullable=True) PEXPI = Column(Integer, qt_label='Spool Retention Period', nullable=True, name='PEXPI') LINCT = Column(Integer, qt_label='Page Lenth of List', name='LINCT', nullable=True) LINSZ = Column(Integer, qt_label='Line Width of List', name='LINSZ', nullable=True) PAART = Column(String(68), qt_label='Spool Format', nullable=True, name='PAART') PRBIG = Column(Boolean, qt_label='Spool Cover Sheet', choices=YesNoChoice.CHOICES, nullable=True, name='PRBIG') PRSAP = Column(Boolean, qt_label='Print: SAP Cover Page', choices=YesNoChoice.CHOICES, nullable=True, name='PRSAP') PRREC = Column(String(12), qt_label='Spool Receipient Name', nullable=True, name='PRREC') PRABT = Column(String(12), qt_label='Spool Department Name', nullable=True, name='PRABT') PRBER = Column(String(12), qt_label='Print: Authorization', nullable=True, name='PRBER') PRDSN = Column(String(6), qt_label='Spool File', nullable=True, name='PRDSN') PTYPE = Column(String(12), qt_label='Print: Type of Spool Request', nullable=True, name='PTYPE') ARMOD = Column(Boolean, qt_label='Print: Archiving mode', choices=YesNoChoice.CHOICES, nullable=True, name='ARMOD') FOOTL = Column(Boolean, qt_label='Print: Output Footer', choices=YesNoChoice.CHOICES, nullable=True, name='FOOTL') PRIOT = Column(Integer, qt_label='Print: Spool Request Priority', nullable=True, name='PRIOT') PRUNX = Column(Boolean, qt_label='Print: Host Spool Cover Page', choices=YesNoChoice.CHOICES, nullable=True, name='PRUNX')
class AbapSpoolParams_BAPIXMPRNT_Mixin: DESTIN = Column(String(4), qt_label='Spool Output Device', nullable=False) PRINTIMM = Column(Boolean, qt_label='Immediate Spool Print', choices=YesNoChoice.CHOICES, default=YesNoChoice.NO, nullable=False) RELEASE = Column(Boolean, qt_label='Immediate Spool Deletion', choices=YesNoChoice.CHOICES, default=YesNoChoice.NO, nullable=False) COPIES = Column(Integer, qt_label='Number of Spool Copies', nullable=True) PRIARCMODE = Column(Boolean, qt_label='Print: Archiving mode', choices=YesNoChoice.CHOICES, default=YesNoChoice.NO, nullable=True) SHOWPASSWD = Column(String(12), qt_label='Print: Authorization', nullable=True) SAPBANNER = Column(Boolean, qt_label='Print: SAP Cover Page', choices=YesNoChoice.CHOICES, default=YesNoChoice.NO, nullable=True) BANNERPAGE = Column(Boolean, qt_label='Spool Cover Sheet', choices=YesNoChoice.CHOICES, default=YesNoChoice.NO, nullable=True) EXPIRATION = Column(Integer, qt_label='Spool Retention Period', nullable=True) PRINTRECEIP = Column(String(12), qt_label='Spool Receipient Name', nullable=True) NUMLINES = Column(Integer, qt_label='Page Lenth of List', nullable=True) NUMCOLUMNS = Column(Integer, qt_label='Line Width of List', nullable=True)
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
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')