From 6377f2a67807327d6061b694010a4a44290e65fb Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Tue, 27 Aug 2019 15:35:10 +0200 Subject: [PATCH] fix ScanService warnings --- .../_____SYSTEMALIAS/_____SYSTEMALIAS.aod | 2 +- process/DataPrivacy_lib/process.js | 348 +++++++++--------- process/Data_lib/process.js | 4 +- process/DuplicateScanner_lib/process.js | 1 + 4 files changed, 178 insertions(+), 177 deletions(-) diff --git a/aliasDefinition/_____SYSTEMALIAS/_____SYSTEMALIAS.aod b/aliasDefinition/_____SYSTEMALIAS/_____SYSTEMALIAS.aod index e796fca249..19853f665b 100644 --- a/aliasDefinition/_____SYSTEMALIAS/_____SYSTEMALIAS.aod +++ b/aliasDefinition/_____SYSTEMALIAS/_____SYSTEMALIAS.aod @@ -3198,7 +3198,7 @@ <entityDb> <name>ASYS_PERMISSION</name> <dbName></dbName> - <idColumn>PERMISSIONID</idColumn> + <idColumn>ASYS_PERMISSIONID</idColumn> <idGeneratorType v="0" /> <idGeneratorInterval v="1" /> <documentation></documentation> diff --git a/process/DataPrivacy_lib/process.js b/process/DataPrivacy_lib/process.js index 0d8eed3748..20a1c113bb 100644 --- a/process/DataPrivacy_lib/process.js +++ b/process/DataPrivacy_lib/process.js @@ -657,177 +657,177 @@ Muster-Datenschutzberatung"; //////////////////////////////////////////////////////////////////////// // Deprecated functions: they need to be updated or rewritten to Adito 2019 // Currently not used - -/** - * makes selected data from a private contact anonymous - * - * @param pPersId - * @param pContactId - * @deprecated - */ -DataPrivacyUtils.dsgvoMkDataAnonymous = function(pPersId, pContactId) -{ - // TODO Only Data that comes from private contacts - // TODO ggf. nur ein Param notwendig? oder pRowId statt pPersId - - //Hat die Privat-Person auch eine Funktion an einer Firma - var hasFunction = db.cell(SqlCondition.begin() - .andPrepare("CONTACT.PERSON_ID", pPersId) - .andPrepare("CONTACT.ORGANISATION_ID", "0", "# != ?") // TODO ungleich 0, stimmt das so? - .build(" select count(*) from CONTACT", "1=2")); - // db.cell(" select count(*) from RELATION where PERS_ID = '" + pPersId + "' and ORGANISATION != '0' "); - - var prompts = new Array(); - prompts["PERSREL"] = hasFunction; - var jsonResult = openOkCancelDialog("DLG_CHOOSE_DATA_PRIVACY_ANONYMISATION", prompts); - var newAnonymCategories = new Array(); - var updArray = []; - - if (jsonResult["button"] != "ok") - return; - - var data, values, columns, columnTypes, condition; - - //Namen - if ((jsonResult["comp.chb_Names"] == "true")) - { - data = db.array(db.ROW, SqlCondition.begin() - .andPrepare("CONTACT.PERSON_ID", pPersId) - .build("select SALUTATION, TITLE, FIRSTNAME, MIDDLENAME, LASTNAME from PERS ", "1=2") - ); - /*data = db.array(db.ROW, "select SALUTATION, TITLE, FIRSTNAME, MIDDLENAME, LASTNAME " - + " from PERS " - + " where PERSID = '" + pPersId + "'");*/ - - values = [DataPrivacyUtils.anonymizeText(data[0]), DataPrivacyUtils.anonymizeText(data[1]), DataPrivacyUtils.anonymizeText(data[2]), DataPrivacyUtils.anonymizeText(data[3]), DataPrivacyUtils.anonymizeText(data[4])]; - columns = ["SALUTATION", "TITLE", "FIRSTNAME", "MIDDLENAME", "LASTNAME"]; - columnTypes = db.getColumnTypes("PERSON", columns); - condition = SqlCondition.andPrepare("PERSONID", pPersId) - .and("1=2"); - //condition = "PERSONID = '" + pPersId + "'"; - updArray.push(["PERSON", columns, columnTypes, values, condition]) - - newAnonymCategories.push(translate.text("Names")); - } - - //sonstige personenbezogene Daten - if (jsonResult["comp.chb_others"] == "true") - { - data = db.array(db.ROW, SqlCondition.begin() - .andPrepare("CONTACT.PERSON_ID", pPersId) - .build("select DOB, GENDER, SUFFIX, PERSINFO from PERS ", "1=2")); - - /*, "select DOB, GENDER, SUFFIX, PERSINFO " - + " from PERS " - + " where PERSID = '" + pPersId + "' ") - */ - values = ["", "", "", ""]; - columns = ["DOB", "GENDER", "SUFFIX", "PERSINFO"]; - columnTypes = db.getColumnTypes("PERS", columns); - condition = SqlCondition.andPrepare("PERSONID", pPersId) - .and("1=2"); - //condition = "PERSID = '" + pPersId + "'"; - updArray.push(["PERS", columns, columnTypes, values, condition]) - - newAnonymCategories.push(translate.text("other personal data")); - } - - //Addressen - if(jsonResult["comp.chb_Address"] == "true") - { - data = db.table(SqlCondition.begin() - .andPrepare("CONTACT_ID", pContactId) - .build("select ADDRESS, PROVINCE, CITY, COUNTRY, REGION, BUILDINGNO, ADDRESSADDITION, ZIP, DISTRICT, ADDRESSID " - + " from ADDRESS ", "1=2" )); - - /*" select ADDRESS, PROVINCE, CITY, COUNTRY, REGION, BUILDINGNO, ADDRESSADDITION, ZIP, DISTRICT, ADDRESSID " - + " from ADDRESS " - + " where RELATION_ID = '" + pContactId + "' "); -*/ - columns = ["ADDRESS", "PROVINCE", "CITY", "COUNTRY", "REGION", "BUILDINGNO", "ADDRESSADDITION", "ZIP", "DISTRICT"]; - columnTypes = db.getColumnTypes("ADDRESS", columns); - - //Jede Addresse muss separat anonymisiert werden - for (let i = 0; i < data.length; i++) { - values = [DataPrivacyUtils.anonymizeText(data[i][0]), DataPrivacyUtils.anonymizeText(data[i][1]), - DataPrivacyUtils.anonymizeText(data[i][2]), DataPrivacyUtils.anonymizeText(data[i][3]), - DataPrivacyUtils.anonymizeText(data[i][4]), DataPrivacyUtils.anonymizeText(data[i][5]), - DataPrivacyUtils.anonymizeText(data[i][6]), DataPrivacyUtils.anonymizeText(data[i][7]), - DataPrivacyUtils.anonymizeText(data[i][8])]; - - // TODO prüfen - condition = SqlCondition.andPrepare("CONTACT_ID", pContactId) - .andPrepare("ADDRESSID", data[i][9]) - .and("1=2"); - //condition = " CONTACT_ID = '" + pContactId + "' and ADDRESSID = '" + data[i][9] + "' "; - updArray.push(["ADDRESS", columns, columnTypes, values, condition]); - } - newAnonymCategories.push(KeywordUtils.getViewValue($KeywordRegistry.dsgvoTablename(), $KeywordRegistry.dsgvoTablename$address())); - } - - //Kommunikationsdaten - if (jsonResult["comp.chb_Comm"] == "true") - { - data = db.table(SqlCondition.begin() - .andPrepare("CONTACT_ID", pContactId) - .build("select ADDRESS, SEARCHADDR, COMMUNICATIONID from COMMUNICATION", "1=2")); - //data = db.table("select ADDR, SEARCHADDR, COMMID from COMM where RELATION_ID = '" + pContactId + "'"); - - columns = ["ADDR", "SEARCHADDR"]; - columnTypes = db.getColumnTypes("COMM", columns); - - for (let i = 0; i < data.length; i++) { - values = [DataPrivacyUtils.anonymizeText(data[i][0]), DataPrivacyUtils.anonymizeText(data[i][1])]; - - condition = SqlCondition.andPrepare("CONTACT_ID", pContactId) - .andPrepare("COMMUNICATIONID", data[i][2]).and("1=2"); - // TODO prüfen - //"RELATION_ID = '" + pContactId + "' and COMMID = '" + data[i][2] + "' "; - - updArray.push(["COMM", columns, columnTypes, values, condition]); - } - newAnonymCategories.push(KeywordUtils.getViewValue($KeywordRegistry.dsgvoTablename(), $KeywordRegistry.dsgvoTablename$communication())); - } - - if (updArray.length > 0) - db.updates(updArray); - - if(newAnonymCategories.length > 0) - { - subject = translate.text("DSGVO anonymisation"); - info = translate.withArguments("The following data has been anonymised: %0", [newAnonymCategories.join(", ")]); - // TODO UX Abwarten - question.showMessage(info); - newHistory(vars.get("$global.user").relationid, getKeyValue("Intern", "HistoryMedium"), "o", subject, info, [[pContactId, 2]]); - } - else - question.showMessage(translate.text("No data has been anonymized.")); -} - -/** - * utility function to make a String anonymous. Replaces all letters between the first an last one with * - * - * @param {String} pText Text to be made anonymous - * @return {String} first and last letter from pText with (pText.length-2) stars(*) between them - * - * @example DataPrivacyUtils.anonymizeText("Buchstabe") - * @exampleresult B*******e - * @deprecated - */ -DataPrivacyUtils.anonymizeText = function(pText) -{ - if (pText == null) - return null; - if (pText.length <= 2) - return "**"; - - var res = pText.charAt(0); - - for(i = 0; i < pText.length - 2; i++) - { - res += "*"; - } - - return res += pText.charAt(pText.length - 1); -} - +// +///** +// * makes selected data from a private contact anonymous +// * +// * @param pPersId +// * @param pContactId +// * @deprecated +// */ +//DataPrivacyUtils.dsgvoMkDataAnonymous = function(pPersId, pContactId) +//{ +// // TODO Only Data that comes from private contacts +// // TODO ggf. nur ein Param notwendig? oder pRowId statt pPersId +// +// //Hat die Privat-Person auch eine Funktion an einer Firma +// var hasFunction = db.cell(SqlCondition.begin() +// .andPrepare("CONTACT.PERSON_ID", pPersId) +// .andPrepare("CONTACT.ORGANISATION_ID", "0", "# != ?") // TODO ungleich 0, stimmt das so? +// .build(" select count(*) from CONTACT", "1=2")); +// // db.cell(" select count(*) from RELATION where PERS_ID = '" + pPersId + "' and ORGANISATION != '0' "); +// +// var prompts = new Array(); +// prompts["PERSREL"] = hasFunction; +// var jsonResult = openOkCancelDialog("DLG_CHOOSE_DATA_PRIVACY_ANONYMISATION", prompts); +// var newAnonymCategories = new Array(); +// var updArray = []; +// +// if (jsonResult["button"] != "ok") +// return; +// +// var data, values, columns, columnTypes, condition; +// +// //Namen +// if ((jsonResult["comp.chb_Names"] == "true")) +// { +// data = db.array(db.ROW, SqlCondition.begin() +// .andPrepare("CONTACT.PERSON_ID", pPersId) +// .build("select SALUTATION, TITLE, FIRSTNAME, MIDDLENAME, LASTNAME from PERS ", "1=2") +// ); +// /*data = db.array(db.ROW, "select SALUTATION, TITLE, FIRSTNAME, MIDDLENAME, LASTNAME " +// + " from PERS " +// + " where PERSID = '" + pPersId + "'");*/ +// +// values = [DataPrivacyUtils.anonymizeText(data[0]), DataPrivacyUtils.anonymizeText(data[1]), DataPrivacyUtils.anonymizeText(data[2]), DataPrivacyUtils.anonymizeText(data[3]), DataPrivacyUtils.anonymizeText(data[4])]; +// columns = ["SALUTATION", "TITLE", "FIRSTNAME", "MIDDLENAME", "LASTNAME"]; +// columnTypes = db.getColumnTypes("PERSON", columns); +// condition = SqlCondition.andPrepare("PERSONID", pPersId) +// .and("1=2"); +// //condition = "PERSONID = '" + pPersId + "'"; +// updArray.push(["PERSON", columns, columnTypes, values, condition]) +// +// newAnonymCategories.push(translate.text("Names")); +// } +// +// //sonstige personenbezogene Daten +// if (jsonResult["comp.chb_others"] == "true") +// { +// data = db.array(db.ROW, SqlCondition.begin() +// .andPrepare("CONTACT.PERSON_ID", pPersId) +// .build("select DOB, GENDER, SUFFIX, PERSINFO from PERS ", "1=2")); +// +// /*, "select DOB, GENDER, SUFFIX, PERSINFO " +// + " from PERS " +// + " where PERSID = '" + pPersId + "' ") +// */ +// values = ["", "", "", ""]; +// columns = ["DOB", "GENDER", "SUFFIX", "PERSINFO"]; +// columnTypes = db.getColumnTypes("PERS", columns); +// condition = SqlCondition.andPrepare("PERSONID", pPersId) +// .and("1=2"); +// //condition = "PERSID = '" + pPersId + "'"; +// updArray.push(["PERS", columns, columnTypes, values, condition]) +// +// newAnonymCategories.push(translate.text("other personal data")); +// } +// +// //Addressen +// if(jsonResult["comp.chb_Address"] == "true") +// { +// data = db.table(SqlCondition.begin() +// .andPrepare("CONTACT_ID", pContactId) +// .build("select ADDRESS, PROVINCE, CITY, COUNTRY, REGION, BUILDINGNO, ADDRESSADDITION, ZIP, DISTRICT, ADDRESSID " +// + " from ADDRESS ", "1=2" )); +// +// /*" select ADDRESS, PROVINCE, CITY, COUNTRY, REGION, BUILDINGNO, ADDRESSADDITION, ZIP, DISTRICT, ADDRESSID " +// + " from ADDRESS " +// + " where RELATION_ID = '" + pContactId + "' "); +//*/ +// columns = ["ADDRESS", "PROVINCE", "CITY", "COUNTRY", "REGION", "BUILDINGNO", "ADDRESSADDITION", "ZIP", "DISTRICT"]; +// columnTypes = db.getColumnTypes("ADDRESS", columns); +// +// //Jede Addresse muss separat anonymisiert werden +// for (let i = 0; i < data.length; i++) { +// values = [DataPrivacyUtils.anonymizeText(data[i][0]), DataPrivacyUtils.anonymizeText(data[i][1]), +// DataPrivacyUtils.anonymizeText(data[i][2]), DataPrivacyUtils.anonymizeText(data[i][3]), +// DataPrivacyUtils.anonymizeText(data[i][4]), DataPrivacyUtils.anonymizeText(data[i][5]), +// DataPrivacyUtils.anonymizeText(data[i][6]), DataPrivacyUtils.anonymizeText(data[i][7]), +// DataPrivacyUtils.anonymizeText(data[i][8])]; +// +// // TODO prüfen +// condition = SqlCondition.andPrepare("CONTACT_ID", pContactId) +// .andPrepare("ADDRESSID", data[i][9]) +// .and("1=2"); +// //condition = " CONTACT_ID = '" + pContactId + "' and ADDRESSID = '" + data[i][9] + "' "; +// updArray.push(["ADDRESS", columns, columnTypes, values, condition]); +// } +// newAnonymCategories.push(KeywordUtils.getViewValue($KeywordRegistry.dsgvoTablename(), $KeywordRegistry.dsgvoTablename$address())); +// } +// +// //Kommunikationsdaten +// if (jsonResult["comp.chb_Comm"] == "true") +// { +// data = db.table(SqlCondition.begin() +// .andPrepare("CONTACT_ID", pContactId) +// .build("select ADDRESS, SEARCHADDR, COMMUNICATIONID from COMMUNICATION", "1=2")); +// //data = db.table("select ADDR, SEARCHADDR, COMMID from COMM where RELATION_ID = '" + pContactId + "'"); +// +// columns = ["ADDR", "SEARCHADDR"]; +// columnTypes = db.getColumnTypes("COMM", columns); +// +// for (let i = 0; i < data.length; i++) { +// values = [DataPrivacyUtils.anonymizeText(data[i][0]), DataPrivacyUtils.anonymizeText(data[i][1])]; +// +// condition = SqlCondition.andPrepare("CONTACT_ID", pContactId) +// .andPrepare("COMMUNICATIONID", data[i][2]).and("1=2"); +// // TODO prüfen +// //"RELATION_ID = '" + pContactId + "' and COMMID = '" + data[i][2] + "' "; +// +// updArray.push(["COMM", columns, columnTypes, values, condition]); +// } +// newAnonymCategories.push(KeywordUtils.getViewValue($KeywordRegistry.dsgvoTablename(), $KeywordRegistry.dsgvoTablename$communication())); +// } +// +// if (updArray.length > 0) +// db.updates(updArray); +// +// if(newAnonymCategories.length > 0) +// { +// subject = translate.text("DSGVO anonymisation"); +// info = translate.withArguments("The following data has been anonymised: %0", [newAnonymCategories.join(", ")]); +// // TODO UX Abwarten +// question.showMessage(info); +// newHistory(vars.get("$global.user").relationid, getKeyValue("Intern", "HistoryMedium"), "o", subject, info, [[pContactId, 2]]); +// } +// else +// question.showMessage(translate.text("No data has been anonymized.")); +//} +// +///** +// * utility function to make a String anonymous. Replaces all letters between the first an last one with * +// * +// * @param {String} pText Text to be made anonymous +// * @return {String} first and last letter from pText with (pText.length-2) stars(*) between them +// * +// * @example DataPrivacyUtils.anonymizeText("Buchstabe") +// * @exampleresult B*******e +// * @deprecated +// */ +//DataPrivacyUtils.anonymizeText = function(pText) +//{ +// if (pText == null) +// return null; +// if (pText.length <= 2) +// return "**"; +// +// var res = pText.charAt(0); +// +// for(i = 0; i < pText.length - 2; i++) +// { +// res += "*"; +// } +// +// return res += pText.charAt(pText.length - 1); +//} +// diff --git a/process/Data_lib/process.js b/process/Data_lib/process.js index dcc6c00e81..08212a250a 100644 --- a/process/Data_lib/process.js +++ b/process/Data_lib/process.js @@ -173,8 +173,8 @@ ReferencingData.prototype._convertToTree = function() { if (this._dataTree == undefined) { - this._dataTree = DataTree.begin(this._rootId) - .addArray(this._data); + this._dataTree = new DataTree(this._rootId); + this._dataTree.addArray(this._data); this._data = undefined; } } diff --git a/process/DuplicateScanner_lib/process.js b/process/DuplicateScanner_lib/process.js index ffc05eb37c..5af12b860c 100644 --- a/process/DuplicateScanner_lib/process.js +++ b/process/DuplicateScanner_lib/process.js @@ -60,6 +60,7 @@ _DuplicateScannerUtils._applyPreFilter = function(pTargetEntity, pFilterCountCha } + return undefined; } _DuplicateScannerUtils._isExternalScanServiceAvailable = function() -- GitLab