alsmanager_lib 2.0.94 → 2.0.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/modules.js +33 -27
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -11712,99 +11712,105 @@ function insertNetworkFromTemplateIntoDevice(db_used, id_dev_ref) {
11712
11712
  }
11713
11713
  // End Manage template models
11714
11714
  // Manage credentials
11715
- function insertCredentialSQLite(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active) {
11716
- var query = "insert into pwd_archive (user, password, service, date_change, note, encrypted, days_life, is_active) values ";
11717
- query += "('" + pa_user + "', '" + pa_pwd + "', '" + pa_service + "', date('now'), '" + pa_note + "', 1, " + pa_days + ", " + pa_active + ")";
11715
+ function insertCredentialSQLite(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url) {
11716
+ var query = "insert into pwd_archive (user, password, service, date_change, note, encrypted, days_life, is_active, url) values ";
11717
+ query += "('" + pa_user + "', '" + pa_pwd + "', '" + pa_service + "', date('now'), '" + pa_note + "', 1, " + pa_days + ", " + pa_active + ", '" + pa_url + "')";
11718
11718
  return query;
11719
11719
  }
11720
- function insertCredentialMySQL(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active) {
11721
- var query = "insert into pwd_archive (user, password, service, date_change, note, encrypted, days_life, is_active) values ";
11722
- query += "(:pa_user, :pa_pwd, :pa_service, CURDATE(), :pa_note 1, :pa_days, :pa_active)";
11720
+ function insertCredentialMySQL(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url) {
11721
+ var query = "insert into pwd_archive (user, password, service, date_change, note, encrypted, days_life, is_active, url) values ";
11722
+ query += "(:pa_user, :pa_pwd, :pa_service, CURDATE(), :pa_note 1, :pa_days, :pa_active, :pa_url)";
11723
11723
  return query;
11724
11724
  }
11725
11725
 
11726
- function insertCredential(db_used, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active) {
11726
+ function insertCredential(db_used, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url) {
11727
11727
  var query = "";
11728
11728
  if (db_used) {
11729
11729
  switch (db_used) {
11730
11730
  case 'SQLITE':
11731
- query = insertCredentialSQLite(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active);
11731
+ query = insertCredentialSQLite(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url);
11732
11732
  break;
11733
11733
  case 'MYSQL':
11734
- query = insertCredentialMySQL(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active);
11734
+ query = insertCredentialMySQL(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url);
11735
11735
  break;
11736
11736
  case 'MYSQL2':
11737
- query = insertCredentialSQLite(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active);
11737
+ query = insertCredentialSQLite(pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url);
11738
11738
  break;
11739
11739
  }
11740
11740
  }
11741
11741
  return query;
11742
11742
  }
11743
11743
 
11744
- function updateCredentialSQLite(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active) {
11744
+ function updateCredentialSQLite(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url, update_date) {
11745
11745
  var query = "update pwd_archive set ";
11746
11746
  query += "user = '" + pa_user + "', ";
11747
11747
  query += "password = '" + pa_pwd + "', ";
11748
11748
  query += "service = '" + pa_service + "', ";
11749
- query += "date_change = date('now'), ";
11749
+ if (update_date && update_date > 1)
11750
+ query += "date_change = date('now'), ";
11750
11751
  query += "note = '" + pa_note + "', ";
11751
11752
  query += "encrypted = 1, ",
11752
11753
  query += "days_life = " + pa_days + ", ";
11753
- query += "is_active = " + pa_active + " ";
11754
+ query += "is_active = " + pa_active + ", ";
11755
+ query += "url = '" + pa_url + "' ";
11754
11756
  query += "where id = " + id_credential;
11755
11757
  return query;
11756
11758
  }
11757
- function updateCredentialMySQL(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active) {
11759
+ function updateCredentialMySQL(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url, update_date) {
11758
11760
  var query = "update pwd_archive set ";
11759
11761
  query += "user = :pa_user, ";
11760
11762
  query += "password = :pa_pwd, ";
11761
11763
  query += "service = :pa_service, ";
11762
- query += "date_change = CURDATE(), ";
11764
+ if (update_date && update_date > 1)
11765
+ query += "date_change = CURDATE(), ";
11763
11766
  query += "note = :pa_note, ";
11764
11767
  query += "encrypted = 1, ",
11765
11768
  query += "days_life = :pa_days, ";
11766
- query += "is_active = :pa_active ";
11769
+ query += "is_active = :pa_active, ";
11770
+ query += "url = :pa_url ";
11767
11771
  query += "where id = :id_credential";
11768
11772
  return query;
11769
11773
  }
11770
- function updateCredentialMySQL2(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active) {
11774
+ function updateCredentialMySQL2(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url, update_date) {
11771
11775
  var query = "update pwd_archive set ";
11772
11776
  query += "user = '" + pa_user + "', ";
11773
11777
  query += "password = '" + pa_pwd + "', ";
11774
11778
  query += "service = '" + pa_service + "', ";
11775
- query += "date_change = CURDATE(), ";
11779
+ if (update_date && update_date > 1)
11780
+ query += "date_change = CURDATE(), ";
11776
11781
  query += "note = '" + pa_note + "', ";
11777
11782
  query += "encrypted = 1, ",
11778
11783
  query += "days_life = " + pa_days + ", ";
11779
- query += "is_active = " + pa_active + " ";
11784
+ query += "is_active = " + pa_active + ", ";
11785
+ query += "url = '" + pa_url + "' ";
11780
11786
  query += "where id = " + id_credential;
11781
11787
  return query;
11782
11788
  }
11783
11789
 
11784
- function updateCredential(db_used, id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active) {
11790
+ function updateCredential(db_used, id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url, update_date) {
11785
11791
  var query = "";
11786
11792
  if (db_used) {
11787
11793
  switch (db_used) {
11788
11794
  case 'SQLITE':
11789
- query = updateCredentialSQLite(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active);
11795
+ query = updateCredentialSQLite(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url, update_date);
11790
11796
  break;
11791
11797
  case 'MYSQL':
11792
- query = updateCredentialMySQL(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active);
11798
+ query = updateCredentialMySQL(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url, update_date);
11793
11799
  break;
11794
11800
  case 'MYSQL2':
11795
- query = updateCredentialMySQL2(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active);
11801
+ query = updateCredentialMySQL2(id_credential, pa_user, pa_pwd, pa_service, pa_note, pa_days, pa_active, pa_url, update_date);
11796
11802
  break;
11797
11803
  }
11798
11804
  }
11799
11805
  return query;
11800
11806
  }
11801
11807
  function selectCredentialsSQLite() {
11802
- var query = "select id, user, password, service, date_change, days_life, is_active, encrypted from pwd_archive ";
11808
+ var query = "select id, user, password, service, date_change, days_life, is_active, encrypted, url from pwd_archive ";
11803
11809
  query += "order by service";
11804
11810
  return query;
11805
11811
  }
11806
11812
  function selectCredentialsMySQL() {
11807
- var query = "select id, user, password, service, date_change, days_life, is_active, encrypted from pwd_archive ";
11813
+ var query = "select id, user, password, service, date_change, days_life, is_active, encrypted, url from pwd_archive ";
11808
11814
  query += "order by service";
11809
11815
  return query;
11810
11816
  }
@@ -11826,12 +11832,12 @@ function selectCredentials(db_used) {
11826
11832
  return query;
11827
11833
  }
11828
11834
  function selectCredentialByIdSQLite(id_credential) {
11829
- var query = "select id, user, password, service, date_change, days_life, is_active, encrypted from pwd_archive ";
11835
+ var query = "select id, user, password, service, date_change, days_life, is_active, encrypted, url from pwd_archive ";
11830
11836
  query += "where id = " + id_credential;
11831
11837
  return query;
11832
11838
  }
11833
11839
  function selectCredentialByIdMySQL(id_credential) {
11834
- var query = "select id, user, password, service, date_change, days_life, is_active, encrypted from pwd_archive ";
11840
+ var query = "select id, user, password, service, date_change, days_life, is_active, encrypted, url from pwd_archive ";
11835
11841
  query += "where id = :id_credential";
11836
11842
  return query;
11837
11843
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "2.0.94",
7
+ "version": "2.0.95",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",