Patch level :4.0 790
Files correlati : Ricompilazione Demo : [ ] Commento :nuove procedure aggiornamento client git-svn-id: svn://10.65.10.50/trunk@15643 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									8678ec432c
								
							
						
					
					
						commit
						3283e4b731
					
				| @ -4,7 +4,6 @@ | |||||||
| #include <automask.h> | #include <automask.h> | ||||||
| #include <controls.h> | #include <controls.h> | ||||||
| #include <dongle.h> | #include <dongle.h> | ||||||
| #include <execp.h> |  | ||||||
| #include <modaut.h> | #include <modaut.h> | ||||||
| #include <execp.h> | #include <execp.h> | ||||||
| #include <recarray.h> | #include <recarray.h> | ||||||
| @ -67,8 +66,6 @@ protected: | |||||||
|   int do_tree(); |   int do_tree(); | ||||||
| 	int do_explore(); | 	int do_explore(); | ||||||
| 
 | 
 | ||||||
|   int get_user_status(const char* usr) const; |  | ||||||
|   bool set_user_status(const char* usr, int status) const; |  | ||||||
|   bool check_user(); |   bool check_user(); | ||||||
|    |    | ||||||
|   static bool menu_item_handler(TMask_field& f, KEY k); |   static bool menu_item_handler(TMask_field& f, KEY k); | ||||||
| @ -1070,61 +1067,6 @@ bool TMenu_application::ask_user_password(TString& utente) | |||||||
|   return ok; |   return ok; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Testa stato utente: 0 inesistente; 1 = esiste; 2 connesso; 4 conversione in corso
 |  | ||||||
| // ATTENZIONE: non usare mai cache() in ba0!
 |  | ||||||
| int TMenu_application::get_user_status(const char* usr) const |  | ||||||
| { |  | ||||||
|   CHECK(usr && *usr, "Utente nullo"); |  | ||||||
| 
 |  | ||||||
|   int status = 0; |  | ||||||
|   if (prefix_valid()) |  | ||||||
|   { |  | ||||||
|     TLocalisamfile utonti(LF_USER); |  | ||||||
|     utonti.put(USR_USERNAME, usr); |  | ||||||
|     status = utonti.read() == NOERR; |  | ||||||
|     if (status)  |  | ||||||
|     { |  | ||||||
|       if (utonti.get_bool(USR_CONNECTED)) |  | ||||||
|         status |= 2; |  | ||||||
|       if (dongle().administrator() == usr && utonti.get(USR_AUTSTR) == "CONVERTING") |  | ||||||
|         status |= 4; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   else |  | ||||||
|   { |  | ||||||
|     // Senza file aperti questo e' il massimo che posso fare
 |  | ||||||
|     status = dongle().administrator() == usr;   |  | ||||||
|   } |  | ||||||
|    |  | ||||||
|   return status; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool TMenu_application::set_user_status(const char* usr, int status) const |  | ||||||
| { |  | ||||||
|   CHECK(usr && *usr, "Utente nullo"); |  | ||||||
| 
 |  | ||||||
|   bool ok = false; |  | ||||||
|   if (prefix_valid()) |  | ||||||
|   { |  | ||||||
|     TLocalisamfile utonti(LF_USER); |  | ||||||
|     utonti.put(USR_USERNAME, usr); |  | ||||||
|     if (utonti.read(_isequal, _lock) == NOERR) |  | ||||||
|     { |  | ||||||
|       utonti.put(USR_CONNECTED, status & 2 ? "X" : ""); |  | ||||||
|       ok = utonti.rewrite() == NOERR; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   if (status & 2) |  | ||||||
|   { |  | ||||||
|     // Memorizza utente per riproporlo la prossima volta
 |  | ||||||
|     TConfig campo_ini(CONFIG_INSTALL, "Main"); |  | ||||||
|     campo_ini.set("User", usr); |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   return ok; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| bool TMenu_application::check_user() | bool TMenu_application::check_user() | ||||||
| {  | {  | ||||||
|   bool ok = dongle().type() == _no_dongle; |   bool ok = dongle().type() == _no_dongle; | ||||||
| @ -1137,7 +1079,7 @@ bool TMenu_application::check_user() | |||||||
|       TConfig campo_ini(CONFIG_INSTALL, "Main"); |       TConfig campo_ini(CONFIG_INSTALL, "Main"); | ||||||
|       const bool use_system_user = campo_ini.get_bool("AutoLogin"); |       const bool use_system_user = campo_ini.get_bool("AutoLogin"); | ||||||
|       if (use_system_user) |       if (use_system_user) | ||||||
|       ok = get_user_status(utente) != 0; // L'utente esiste!
 |         ok = !cache().get(LF_USER, utente).empty(); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     if (!ok) |     if (!ok) | ||||||
| @ -1145,8 +1087,8 @@ bool TMenu_application::check_user() | |||||||
| 
 | 
 | ||||||
|     if (ok)  |     if (ok)  | ||||||
|     { |     { | ||||||
| 			const bool converting = (get_user_status(dongle().administrator()) & 4) != 0; |       const TString& autstr = cache().get(LF_USER, dongle().administrator(), USR_AUTSTR); | ||||||
| 			if (converting) |       if (autstr == "CONVERTING") | ||||||
|       { |       { | ||||||
|         TString msg; msg << TR("E' in corso una conversione archivi") << ":\n"; |         TString msg; msg << TR("E' in corso una conversione archivi") << ":\n"; | ||||||
|         if (utente == dongle().administrator()) |         if (utente == dongle().administrator()) | ||||||
| @ -1162,7 +1104,13 @@ bool TMenu_application::check_user() | |||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       if (ok) |       if (ok) | ||||||
| 	      set_user_status(utente, 3); // Esistente e connesso (1 | 2 = 3) 
 |       { | ||||||
|  |         dongle().logout(); | ||||||
|  |         user() = utente; | ||||||
|  |         ok = get_serial_number() >= 0; | ||||||
|  |         if (!ok)  | ||||||
|  |           error_box(TR("Probabilmente è stato superato il numero massimo di utenti")); | ||||||
|  |       } | ||||||
| 
 | 
 | ||||||
|       if (ok)  |       if (ok)  | ||||||
|       { |       { | ||||||
| @ -1336,7 +1284,8 @@ bool TMenu_application::test_programs() | |||||||
|       //mette il flag di installing
 |       //mette il flag di installing
 | ||||||
| 		  set_installing_flag(); | 		  set_installing_flag(); | ||||||
|       //lancia setup in modalita' aggiornamento client e si suicida! (banzai!!)
 |       //lancia setup in modalita' aggiornamento client e si suicida! (banzai!!)
 | ||||||
|       TExternal_app app("setup/setup.exe -uc"); |        | ||||||
|  |       TExternal_app app("setup\\setup.exe -uc"); | ||||||
|       app.run(true); |       app.run(true); | ||||||
| 
 | 
 | ||||||
| 		  //se lancia un'installazione->esce!!!
 | 		  //se lancia un'installazione->esce!!!
 | ||||||
| @ -1391,8 +1340,17 @@ bool TMenu_application::user_create() | |||||||
| 
 | 
 | ||||||
| void TMenu_application::deconnect_user() | void TMenu_application::deconnect_user() | ||||||
| { | { | ||||||
|   if (get_user_status(user()) & 2)  // Se e' connesso
 |   if (prefix_valid()) | ||||||
|     set_user_status(user(), 1);     // Sconnettilo
 |   { | ||||||
|  |     TLocalisamfile users(LF_USER); | ||||||
|  |     users.put("USERNAME", user()); | ||||||
|  |     const int err = users.read(_isequal, _lock); | ||||||
|  |     if (err == NOERR) | ||||||
|  |     { | ||||||
|  |       users.zero("CONNECTED"); | ||||||
|  |       users.rewrite(); | ||||||
|  |     } | ||||||
|  |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool TMenu_application::destroy() | bool TMenu_application::destroy() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user