Patch level : 10.0 212
Files correlati : ba0.exe Ricompilazione Demo : [ ] Commento : Corretta gestione permessi utente. Migliorata cancellazione record con memo Sostituite le parole "Precedente" e "Succesivo" con "Indietro" e "Avanti" nella barra di navigazione standard git-svn-id: svn://10.65.10.50/trunk@18026 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
151780a8b7
commit
1688a6827d
include
@ -406,18 +406,14 @@ const char* TApplication::get_module_name() const
|
||||
|
||||
void TApplication::set_perms()
|
||||
{
|
||||
_user_aut.reset(); // disabilita tutto ...
|
||||
_user_aut.set(0, true); // ... tranne la BASE
|
||||
_user_aut.set(ENDAUT, true); // Forza dimensioni corrette del bit array!
|
||||
_user_aut.reset(); // disabilita tutto ...
|
||||
_user_aut.set(0, true); // ... tranne la BASE
|
||||
|
||||
const TString& utente = user();
|
||||
if (utente.full())
|
||||
{
|
||||
if (utente == ::dongle().administrator())
|
||||
{
|
||||
_user_aut.set(ENDAUT, true);
|
||||
_user_aut.set(); // abilita tutto
|
||||
}
|
||||
else
|
||||
if (utente.compare(::dongle().administrator(), -1, 0) != 0)
|
||||
{
|
||||
int err = _iskeynotfound;
|
||||
if (use_files())
|
||||
@ -428,23 +424,19 @@ void TApplication::set_perms()
|
||||
if (err == NOERR)
|
||||
{
|
||||
const TString& aut = users.get(USR_AUTSTR);
|
||||
if (aut.blank())
|
||||
{
|
||||
_user_aut.reset(); // disabilita tutto ...
|
||||
_user_aut.set(0, true); // ... tranne la BASE
|
||||
}
|
||||
else
|
||||
if (aut.full())
|
||||
{
|
||||
for (int i = aut.len()-1; i > 0; i--)
|
||||
_user_aut.set(i, aut[i] == 'X');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (err != NOERR && utente == "GUEST")
|
||||
{
|
||||
_user_aut.set(ENDAUT, true);
|
||||
if (err != NOERR && utente.compare("GUEST", -1, true) == 0)
|
||||
_user_aut.set(); // abilita tutto
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_user_aut.set(); // abilita tutto
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -465,7 +457,7 @@ void TApplication::check_parameters(
|
||||
const TFixed_string u(argv[argc-1]);
|
||||
if (u.starts_with("-u", true) || u.starts_with("/u", true))
|
||||
{
|
||||
TString80 usr = u.mid(2);
|
||||
TString16 usr = u.mid(2,16);
|
||||
usr.upper();
|
||||
user() = usr;
|
||||
argc--;
|
||||
|
@ -507,7 +507,7 @@ HIDDEN void browse_null(char *start, int nc)
|
||||
return tmp;
|
||||
} */
|
||||
|
||||
HIDDEN int __build_key(const RecDes& recd, int numkey, RecType recin, char *key, bool build_x_cb)
|
||||
HIDDEN int __build_key(const RecDes& recd, int numkey, const RecType recin, char *key, bool build_x_cb)
|
||||
/* *recd; descrittore record */
|
||||
/* numkey; numero chiave */
|
||||
/* recin; buffer contenente il record */
|
||||
@ -938,7 +938,6 @@ int TBaseisamfile::read(TRectype& rec, word op, word lockop)
|
||||
}
|
||||
|
||||
int TBaseisamfile::read(word op, word lockop)
|
||||
|
||||
{
|
||||
return TBaseisamfile::read(curr(), op, lockop);
|
||||
}
|
||||
@ -957,13 +956,13 @@ int TBaseisamfile::_readat(TRectype& rec, TRecnotype nrec, word lockop)
|
||||
{
|
||||
const int fhnd = handle();
|
||||
rec.setdirty();
|
||||
_lasterr=DB_go(fhnd,nrec);
|
||||
_lasterr = DB_go(fhnd, nrec);
|
||||
if (_lasterr != NOERR)
|
||||
_lasterr = get_error(_lasterr);
|
||||
else
|
||||
rec = (const char *) DB_getrecord(fhnd);
|
||||
_recno = DB_recno(fhnd);
|
||||
if(rec.has_memo())
|
||||
if (rec.has_memo())
|
||||
rec.init_memo(_recno, _isam_handle);
|
||||
return _lasterr;
|
||||
}
|
||||
@ -999,13 +998,15 @@ int TBaseisamfile::_write(const TRectype& rec)
|
||||
browse_null(rec.string(), dst_len);
|
||||
memcpy(DB_getrecord(fhnd), rec.string(), dst_len);
|
||||
_lasterr = DB_add(fhnd);
|
||||
|
||||
if (_lasterr != NOERR)
|
||||
_lasterr = get_error(_lasterr);
|
||||
|
||||
_recno = DB_recno(fhnd);
|
||||
if (_lasterr == NOERR && rec.has_memo())
|
||||
((TRectype&)rec).write_memo(_isam_handle, _recno );
|
||||
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
if (rec.has_memo())
|
||||
((TRectype&)rec).write_memo(_isam_handle, _recno );
|
||||
}
|
||||
else
|
||||
_lasterr = get_error(_lasterr);
|
||||
|
||||
return _lasterr;
|
||||
}
|
||||
@ -1102,7 +1103,8 @@ int TBaseisamfile::rewriteat(const TRectype& rec, TRecnotype nrec)
|
||||
memcpy(DB_getrecord(fhnd),rec.string(),DB_reclen(fhnd));
|
||||
_lasterr=DB_rewrite(fhnd);
|
||||
if (_lasterr != NOERR) _lasterr = get_error(_lasterr);
|
||||
} else
|
||||
}
|
||||
else
|
||||
_lasterr = get_error(_lasterr);
|
||||
_recno = DB_recno(fhnd);
|
||||
|
||||
@ -1121,13 +1123,13 @@ int TBaseisamfile::rewriteat(TRecnotype nrec)
|
||||
return TBaseisamfile::rewriteat(curr(),nrec);
|
||||
}
|
||||
|
||||
|
||||
int TBaseisamfile::_remove(const TRectype& rec)
|
||||
{
|
||||
CHECK(!rec.empty(), "Can't remove an empty record");
|
||||
|
||||
TRectype save_rec(rec);
|
||||
const int fhnd = handle(1); // Forza l'uso della chiave principale (per chiavi duplicate?)
|
||||
|
||||
TRectype save_rec(rec);
|
||||
_lasterr = cisread(fhnd, 1, save_rec, _isequal + _nolock, _recno); // Si Posiziona per sicurezza...
|
||||
|
||||
if (_lasterr == NOERR)
|
||||
@ -1135,21 +1137,17 @@ int TBaseisamfile::_remove(const TRectype& rec)
|
||||
_lasterr = DB_delete(fhnd); // Put only deletion flag on record, must remove keys too!
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
if (curr().has_memo( ))
|
||||
curr().init_memo();
|
||||
rec_cache(_logicnum).notify_change();
|
||||
DB_flush(fhnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
_lasterr = get_error(_lasterr);
|
||||
DB_recall(fhnd);
|
||||
}
|
||||
}
|
||||
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
if (curr().has_memo( ))
|
||||
curr().init_memo();
|
||||
rec_cache(_logicnum).notify_change();
|
||||
}
|
||||
|
||||
if (_lasterr != NOERR)
|
||||
DB_recall(fhnd);
|
||||
|
||||
return _lasterr;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ END
|
||||
|
||||
BUTTON DLG_PREVREC 2 2
|
||||
BEGIN
|
||||
PROMPT 5 1 "Precedente"
|
||||
PROMPT 5 1 "Indietro"
|
||||
MESSAGE EXIT,K_PREV
|
||||
PICTURE 122
|
||||
END
|
||||
@ -21,7 +21,7 @@ END
|
||||
|
||||
BUTTON DLG_NEXTREC 2 2
|
||||
BEGIN
|
||||
PROMPT 7 1 "Prossimo"
|
||||
PROMPT 7 1 "Avanti"
|
||||
MESSAGE EXIT,K_NEXT
|
||||
PICTURE 124
|
||||
END
|
||||
|
Loading…
x
Reference in New Issue
Block a user