def update_asset_properties(self, props, name, existing_params=None): if existing_params is None: asset = self.get_asset_by_name(name, simplify=False) existing_params = AssetParameters( assetName=asset.theName, shortCode=asset.theShortCode, assetDesc=asset.theDescription, assetSig=asset.theSignificance, assetType=asset.theType, cFlag=asset.isCritical, cRationale=asset.theCriticalRationale, tags=asset.theTags, ifs=asset.theInterfaces, cProperties=[]) existing_params.setId(asset.theId) existing_params.theEnvironmentProperties = props try: self.db_proxy.updateAsset(existing_params) except ARM.DatabaseProxyException as ex: self.close() raise ARMHTTPError(ex) except ARM.ARMException as ex: self.close() raise ARMHTTPError(ex)
def update_asset_properties(self, props, name, existing_params=None): if existing_params is None: asset = self.get_asset_by_name(name, simplify=False) existing_params = AssetParameters( assetName=asset.theName, shortCode=asset.theShortCode, assetDesc=asset.theDescription, assetSig=asset.theSignificance, assetType=asset.theType, cFlag=asset.isCritical, cRationale=asset.theCriticalRationale, tags=asset.theTags, ifs=asset.theInterfaces, cProperties=[] ) existing_params.setId(asset.theId) existing_params.theEnvironmentProperties = props try: self.db_proxy.updateAsset(existing_params) except ARM.DatabaseProxyException as ex: self.close() raise ARMHTTPError(ex) except ARM.ARMException as ex: self.close() raise ARMHTTPError(ex)
def update_asset(self, asset, name): old_asset = self.get_asset_by_name(name, simplify=False) id = old_asset.theId params = AssetParameters( assetName=asset.theName, shortCode=asset.theShortCode, assetDesc=asset.theDescription, assetSig=asset.theSignificance, assetType=asset.theType, cFlag=asset.isCritical, cRationale=asset.theCriticalRationale, tags=asset.theTags, ifs=asset.theInterfaces, cProperties=asset.theEnvironmentProperties ) params.setId(id) try: self.db_proxy.updateAsset(params) except ARM.DatabaseProxyException as ex: self.close() raise ARMHTTPError(ex) except ARM.ARMException as ex: self.close() raise ARMHTTPError(ex)
def parameters(self): parameters = AssetParameters( self.theAssetName, self.theShortCode, self.theAssetDescription, self.theAssetSignificance, self.theType, self.theCriticalIndicator, self.theCriticalRationale, self.theTags, self.theInterfaces, self.theEnvironmentProperties) parameters.setId(self.theAssetId) return parameters
def assetParameters(self,assetId = -1): cMitigated = self.theSecurityProperties[armid.C_PROPERTY] iMitigated = self.theSecurityProperties[armid.I_PROPERTY] avMitigated = self.theSecurityProperties[armid.AV_PROPERTY] acMitigated = self.theSecurityProperties[armid.AC_PROPERTY] assetProperties = array((cMitigated,iMitigated,avMitigated,acMitigated)) mitName = self.theName + ' response' parameters = AssetParameters(mitName,self.theDescription,'Mitigation',assetProperties) parameters.setId(assetId) return parameters
def assetParameters(self,assetId = -1): cMitigated = 1 iMitigated = 1 avMitigated = 1 acMitigated = 1 anMitigated = 1 panMitigated = 1 unlMitigated = 1 unoMitigated = 1 for idx,propertyName in enumerate(self.theMitigatedProperties): if (propertyName == 'Confidentiality'): cMitigated = 3 elif (propertyName == 'Integrity'): iMitigated = 3 elif (propertyName == 'Availability'): avMitigated = 3 elif (propertyName == 'Accountability'): acMitigated = 3 elif (propertyName == 'Anonymity'): acMitigated = 4 elif (propertyName == 'Pseudonymity'): acMitigated = 5 elif (propertyName == 'Unlinkability'): acMitigated = 6 elif (propertyName == 'Unobservability'): acMitigated = 7 assetProperties = array((cMitigated,iMitigated,avMitigated,acMitigate,anMitigated,panMitigated,unlMitigated,unoMitigated)) mitName = self.theName + ' response' parameters = AssetParameters(mitName,self.theDescription,assetProperties) parameters.setId(assetId) return parameters
def update_asset(self, asset, name): old_asset = self.get_asset_by_name(name, simplify=False) id = old_asset.theId params = AssetParameters(assetName=asset.theName, shortCode=asset.theShortCode, assetDesc=asset.theDescription, assetSig=asset.theSignificance, assetType=asset.theType, cFlag=asset.isCritical, cRationale=asset.theCriticalRationale, tags=asset.theTags, ifs=asset.theInterfaces, cProperties=asset.theEnvironmentProperties) params.setId(id) try: self.db_proxy.updateAsset(params) except ARM.DatabaseProxyException as ex: self.close() raise ARMHTTPError(ex) except ARM.ARMException as ex: self.close() raise ARMHTTPError(ex)
def parameters(self): parameters = AssetParameters(self.theAssetName,self.theShortCode,self.theAssetDescription,self.theAssetSignificance,self.theType,self.theCriticalIndicator,self.theCriticalRationale,self.theTags,self.theInterfaces,self.theEnvironmentProperties) parameters.setId(self.theAssetId) return parameters