Corretta gestione utenti in ambiente Windows
git-svn-id: svn://10.65.10.50/trunk@571 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									7ab438abb8
								
							
						
					
					
						commit
						3cc4af2dae
					
				| @ -24,7 +24,8 @@ | |||||||
| 
 | 
 | ||||||
| HIDDEN TApplication* _application = NULL; | HIDDEN TApplication* _application = NULL; | ||||||
| HIDDEN long savefirm = 0; | HIDDEN long savefirm = 0; | ||||||
| HIDDEN TString80 __user; | 
 | ||||||
|  | TString16 TApplication::_user; | ||||||
| 
 | 
 | ||||||
| TApplication* MainApp() | TApplication* MainApp() | ||||||
| { | { | ||||||
| @ -307,7 +308,7 @@ void TApplication::stop_run() | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| TApplication::TApplication() : _printer(NULL), _user("PRASSI") | TApplication::TApplication() : _printer(NULL) | ||||||
| { | { | ||||||
|   init_global_vars(); |   init_global_vars(); | ||||||
|   _bar = TASK_MENUBAR; |   _bar = TASK_MENUBAR; | ||||||
| @ -391,15 +392,14 @@ void TApplication::set_perms() | |||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   CGetAut(1); |   CGetAut(1); | ||||||
|   _dongle_aut.set(0); |   _dongle_aut.set(0, TRUE); | ||||||
|   for (int i = 1 ; i < ENDAUT; i++) |   for (int i = 1 ; i < ENDAUT; i++) | ||||||
|   { |   { | ||||||
|     const int af = i - 1; |     const int af = i - 1; | ||||||
|     const bool val = BITTEST(_int_tab0[af / 16], af % 16); |     const bool val = BITTEST(_int_tab0[af / 16], af % 16); | ||||||
| 
 |  | ||||||
|     _dongle_aut.set(i, val); |     _dongle_aut.set(i, val); | ||||||
|   } |   } | ||||||
|   _user_aut.set(0); |   _user_aut.set(0, TRUE); | ||||||
|   if (_user.not_empty()) |   if (_user.not_empty()) | ||||||
|   { |   { | ||||||
|     if (_user == "PRASSI") |     if (_user == "PRASSI") | ||||||
| @ -426,14 +426,16 @@ void TApplication::set_perms() | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| void check_parameters(int & argc, char* argv[]) | void TApplication::check_parameters(int & argc, char* argv[]) | ||||||
| 
 | 
 | ||||||
| { | { | ||||||
|   if (strncmp(argv[argc - 1], "-u", 2) == 0) |   if (strncmp(argv[argc - 1], "-u", 2) == 0) | ||||||
|   { |   { | ||||||
|     __user = &argv[argc - 1][2]; |     _user = &argv[argc - 1][2]; | ||||||
|     argc--; |     argc--; | ||||||
|   } |   } | ||||||
|  |   else | ||||||
|  |     _user = "PRASSI"; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void TApplication::run(int argc, char* argv[], const char* title) | void TApplication::run(int argc, char* argv[], const char* title) | ||||||
| @ -442,9 +444,8 @@ void TApplication::run(int argc, char* argv[], const char* title) | |||||||
| 
 | 
 | ||||||
|   base.ext(""); base.lower(); |   base.ext(""); base.lower(); | ||||||
|   _title = title; |   _title = title; | ||||||
|   if (__user.empty()) |   if (_user.empty()) | ||||||
|     check_parameters(argc, argv); |     check_parameters(argc, argv); | ||||||
|   if(__user.not_empty()) _user = __user; |  | ||||||
| 
 | 
 | ||||||
|   __argc = argc; |   __argc = argc; | ||||||
|   __argv = (const char**)argv; |   __argv = (const char**)argv; | ||||||
|  | |||||||
| @ -30,9 +30,10 @@ class TApplication | |||||||
|   TBit_array _user_aut; |   TBit_array _user_aut; | ||||||
| 
 | 
 | ||||||
|   TString80 _name, _title; |   TString80 _name, _title; | ||||||
|   TString16 _user; |  | ||||||
|   TPrinter* _printer; |   TPrinter* _printer; | ||||||
| 
 | 
 | ||||||
|  |   static TString16 _user; | ||||||
|  | 
 | ||||||
| protected: | protected: | ||||||
|   const char* get_module_name() const; |   const char* get_module_name() const; | ||||||
|   static long task_eh(WINDOW win, EVENT* ep); |   static long task_eh(WINDOW win, EVENT* ep); | ||||||
| @ -40,6 +41,14 @@ protected: | |||||||
|   virtual long handler(WINDOW win, EVENT* ep); |   virtual long handler(WINDOW win, EVENT* ep); | ||||||
|   virtual bool extended_firm() const { return FALSE; } // Extended set_firm dialog box
 |   virtual bool extended_firm() const { return FALSE; } // Extended set_firm dialog box
 | ||||||
| 
 | 
 | ||||||
|  |   virtual bool create();        // Crea la finestra principale
 | ||||||
|  |   virtual bool menu(MENU_TAG) { return TRUE; }  // Controlla il menu
 | ||||||
|  |   virtual bool destroy();       // Rimuove l'applicazione
 | ||||||
|  |   virtual void print(); | ||||||
|  | 
 | ||||||
|  |   virtual bool change_config(const char* var, const char* oldv, const char* newv); | ||||||
|  |   void set_user(const char * user) { _user = user; } | ||||||
|  | 
 | ||||||
|   void terminate(); |   void terminate(); | ||||||
|   bool config(); |   bool config(); | ||||||
|   void about() const; |   void about() const; | ||||||
| @ -52,10 +61,6 @@ public: | |||||||
| 
 | 
 | ||||||
|   // @DES Queste funzioni possono essere ridefinite da ogni applicazione
 |   // @DES Queste funzioni possono essere ridefinite da ogni applicazione
 | ||||||
|   // @FPUB
 |   // @FPUB
 | ||||||
|   virtual bool create();        // Crea la finestra principale
 |  | ||||||
|   virtual bool menu(MENU_TAG) { return TRUE; }  // Controlla il menu
 |  | ||||||
|   virtual bool destroy();       // Rimuove l'applicazione
 |  | ||||||
|   virtual void print(); |  | ||||||
|   virtual word class_id() const { return CLASS_APPLICATION; } |   virtual word class_id() const { return CLASS_APPLICATION; } | ||||||
|   void stop_run();                              // Forza chiusura applicazione
 |   void stop_run();                              // Forza chiusura applicazione
 | ||||||
| 
 | 
 | ||||||
| @ -79,11 +84,10 @@ public: | |||||||
|   TPrinter* set_printer(TPrinter* p); |   TPrinter* set_printer(TPrinter* p); | ||||||
|   TPrinter& printer(); |   TPrinter& printer(); | ||||||
| 
 | 
 | ||||||
|   virtual bool change_config(const char* var, const char* oldv, const char* newv); |   static void check_parameters(int & argc, char *argv[]); | ||||||
|    |    | ||||||
|   void set_perms(); |   void set_perms(); | ||||||
|   void set_user(const char * user) { _user = user; } |   const TString& user() const { return _user; } | ||||||
|   const char * user() const { return _user; } |  | ||||||
|   bool has_module(int module, int checktype = CHK_ALL) const; |   bool has_module(int module, int checktype = CHK_ALL) const; | ||||||
|   bool set_firm(long cod = -1); |   bool set_firm(long cod = -1); | ||||||
|   long get_firm() const; |   long get_firm() const; | ||||||
| @ -96,6 +100,5 @@ public: | |||||||
| bool xvt_running();        // xvt is running?
 | bool xvt_running();        // xvt is running?
 | ||||||
| TApplication* MainApp();   // main application (old fashioned: will be removed soon
 | TApplication* MainApp();   // main application (old fashioned: will be removed soon
 | ||||||
| TApplication& main_app(); | TApplication& main_app(); | ||||||
| void check_parameters(int & argc, char *argv[]); |  | ||||||
| 
 | 
 | ||||||
| #endif // __APPLICATION_H
 | #endif // __APPLICATION_H
 | ||||||
|  | |||||||
| @ -75,19 +75,6 @@ inline TObject& TArray::operator[] (int index) const | |||||||
|   return *o; |   return *o; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| class TBit_array; |  | ||||||
| 
 |  | ||||||
| class TBit |  | ||||||
| { |  | ||||||
|   TBit_array* _a; |  | ||||||
|   long _b; |  | ||||||
| 
 |  | ||||||
| public: |  | ||||||
|   TBit(TBit_array* a, word b) : _a(a), _b(b) {} |  | ||||||
|   bool operator =(bool on); |  | ||||||
|   operator bool(); |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| class TBit_array : public TObject | class TBit_array : public TObject | ||||||
| { | { | ||||||
|   word _size; |   word _size; | ||||||
| @ -110,7 +97,7 @@ public: | |||||||
|   TBit_array& operator=(const TBit_array& ba); |   TBit_array& operator=(const TBit_array& ba); | ||||||
|   bool operator[] (long n) const; |   bool operator[] (long n) const; | ||||||
|   TBit_array& operator |=(const TBit_array& b);  |   TBit_array& operator |=(const TBit_array& b);  | ||||||
|   //    TBit operator[] (long n) { return TBit(this, n); }
 | 
 | ||||||
|   long first_one() const; |   long first_one() const; | ||||||
|   long last_one() const; |   long last_one() const; | ||||||
|   long ones() const; |   long ones() const; | ||||||
| @ -125,7 +112,5 @@ public: | |||||||
|   void set(const char* numbers); |   void set(const char* numbers); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| inline bool TBit::operator =(bool on) { _a->set(_b, on); return on; } |  | ||||||
| inline TBit::operator bool() { return _a->operator[](_b); } |  | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -32,10 +32,8 @@ | |||||||
| 
 | 
 | ||||||
| int TExternal_app::run(bool async) | int TExternal_app::run(bool async) | ||||||
| { | { | ||||||
|   TApplication & app = main_app(); |  | ||||||
|   TString256 path(_path); |   TString256 path(_path); | ||||||
| 
 |   path << " -u" << main_app().user(); | ||||||
|   path << " -u" << app.user(); |  | ||||||
|   _error = 0; |   _error = 0; | ||||||
|   _exitcode =  0; |   _exitcode =  0; | ||||||
| 
 | 
 | ||||||
| @ -58,7 +56,7 @@ int TExternal_app::run(bool async) | |||||||
|    |    | ||||||
|   if (perc >= req) |   if (perc >= req) | ||||||
|   { |   { | ||||||
|     _exitcode = WinExec((char*)_path, SW_SHOW); |     _exitcode = WinExec((char*)(const char*)path, SW_SHOW); | ||||||
|      |      | ||||||
|     if (_exitcode >= 32) |     if (_exitcode >= 32) | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -554,7 +554,7 @@ break; | |||||||
|   }   |   }   | ||||||
|   else |   else | ||||||
|   { |   { | ||||||
|     xvt_statbar_set(""); |     xvt_statbar_refresh(); | ||||||
|   }   |   }   | ||||||
|   _check_enabled = TRUE; |   _check_enabled = TRUE; | ||||||
| } | } | ||||||
|  | |||||||
| @ -1 +1 @@ | |||||||
| #define VERSION 1.14 | #define VERSION 1.15 | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| //      $Id: relapp.cpp,v 1.24 1994-11-08 14:42:38 alex Exp $        
 | //      $Id: relapp.cpp,v 1.25 1994-11-08 16:50:58 guy Exp $        
 | ||||||
| #include <mailbox.h> | #include <mailbox.h> | ||||||
| #include <sheet.h> | #include <sheet.h> | ||||||
| #include <urldefid.h> | #include <urldefid.h> | ||||||
| @ -291,7 +291,7 @@ int TRelation_application::set_mode(int mode) | |||||||
|     break; |     break; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   xvt_statbar_set(t); |   xvt_statbar_set(t, TRUE); | ||||||
| 
 | 
 | ||||||
|   return _mode; |   return _mode; | ||||||
| } | } | ||||||
|  | |||||||
| @ -796,7 +796,6 @@ int xvt_get_checked_radio(const WINDOW* ctls, int count) | |||||||
| ///////////////////////////////////////////////////////////
 | ///////////////////////////////////////////////////////////
 | ||||||
| 
 | 
 | ||||||
| HIDDEN WINDOW statbar = NULL_WIN; | HIDDEN WINDOW statbar = NULL_WIN; | ||||||
| HIDDEN TString256 stattext; |  | ||||||
| 
 | 
 | ||||||
| WINDOW xvt_create_statbar() | WINDOW xvt_create_statbar() | ||||||
| { | { | ||||||
| @ -824,23 +823,23 @@ WINDOW xvt_create_statbar() | |||||||
|   return statbar; |   return statbar; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void xvt_statbar_set(const char* text) | void xvt_statbar_set(const char* text, bool def) | ||||||
| {                     | {                     | ||||||
| #if XVT_OS == XVT_OS_WIN | #if XVT_OS == XVT_OS_WIN | ||||||
|   if (text != NULL)  |   TString256 t(text); | ||||||
|   { |  | ||||||
|     stattext.strncpy(text, 56); |  | ||||||
|   const TDate oggi(TODAY); |   const TDate oggi(TODAY); | ||||||
|     stattext << '\t' << oggi.string() << " - " << main_app().title(); |   t << '\t' << oggi.string() << " - " << main_app().title(); | ||||||
|   }   |   if (def)                                           | ||||||
|   statbar_set_title(statbar, (char*)(const char*)stattext); |     statbar_set_default_title(statbar, (char*)(const char*)t); | ||||||
|  |   else   | ||||||
|  |     statbar_set_title(statbar, (char*)(const char*)t); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void xvt_statbar_refresh() | void xvt_statbar_refresh() | ||||||
| { | { | ||||||
| #if XVT_OS == XVT_OS_WIN | #if XVT_OS == XVT_OS_WIN | ||||||
|   statbar_set_title(statbar, (char*)(const char*)stattext); |   statbar_set_title(statbar, NULL); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ WINDOW xvt_create_window(WIN_TYPE wt, | |||||||
|                                                    int id); |                                                    int id); | ||||||
| 
 | 
 | ||||||
|                                                    WINDOW xvt_create_statbar(); |                                                    WINDOW xvt_create_statbar(); | ||||||
|                                                    void xvt_statbar_set(const char* text); |                                                    void xvt_statbar_set(const char* text, bool def = FALSE); | ||||||
|                                                    void xvt_statbar_refresh(); |                                                    void xvt_statbar_refresh(); | ||||||
| 
 | 
 | ||||||
|                                                    void beep(); |                                                    void beep(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user