Patch level : 10.0 1024
Files correlati : ba0 Ricompilazione Demo : [ ] Commento : Corretta gestione permessi utente per esecuzione delle singole applcazioni (Possamai) Nella richoesta di conferma di elminazione di un record, il bottone predefinito ora è no invece di si (Tassan) git-svn-id: svn://10.65.10.50/branches/R_10_00@22246 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
88dc261367
commit
89d22e2b8c
@ -2,7 +2,6 @@
|
||||
|
||||
#include <dongle.h>
|
||||
#include <execp.h>
|
||||
#include <prefix.h>
|
||||
#include <recarray.h>
|
||||
#include <user.h>
|
||||
|
||||
@ -138,36 +137,28 @@ long TExternal_app::run(
|
||||
bool TExternal_app::can_run() const
|
||||
{
|
||||
if (*prefix().name() <= '.')
|
||||
return TRUE;
|
||||
|
||||
const TLocalisamfile test(LF_USER);
|
||||
if (test.curr().exist(USR_PERMISSION))
|
||||
return true;
|
||||
|
||||
const TString& usr = user();
|
||||
if (usr.blank() || usr == dongle().administrator())
|
||||
return true;
|
||||
|
||||
const TString_array& uag = user_and_groups();
|
||||
TToken_string perm(255, '\n'), row(80,SAFE_PIPE_CHR);
|
||||
FOR_EACH_ARRAY_ROW(uag, i, rec)
|
||||
{
|
||||
TRecord_cache utonti(LF_USER); // Non uso cache() per problemi durante conversioni
|
||||
TToken_string perm(4096, '\n'), row(80,SAFE_PIPE_CHR);
|
||||
for (TString16 u = user(); u.not_empty(); u = utonti.get(u, USR_GROUPNAME))
|
||||
perm = rec->after(rec->separator());
|
||||
if (perm.full())
|
||||
{
|
||||
if (utonti.already_loaded(u))
|
||||
{
|
||||
NFCHECK("L'utente %s ha dei permessi ricorsivi", (const char*)u);
|
||||
break;
|
||||
}
|
||||
perm = utonti.get(u, USR_PERMISSION);
|
||||
if (!perm.blank())
|
||||
FOR_EACH_TOKEN(perm, tok)
|
||||
{
|
||||
FOR_EACH_TOKEN(perm, tok)
|
||||
{
|
||||
row = tok;
|
||||
if (_path == row.get(0)) // Il nome corrisponde
|
||||
{
|
||||
if (*row.get(1) == 'N')
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
row = tok;
|
||||
if (_path.compare(row.get(0), -1, true) == 0 && row.get_char(1) == 'N')
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
TExternal_app::TExternal_app(const char* p)
|
||||
|
@ -180,10 +180,11 @@ void TMask::read_mask(
|
||||
// Costruisce la lista dei gruppi di appartenenza dell'utente
|
||||
const TString_array& uag = user_and_groups();
|
||||
TConfig ini(prof);
|
||||
FOR_EACH_ARRAY_ROW_BACK(uag, c, utonto)
|
||||
FOR_EACH_ARRAY_ROW_BACK(uag, c, rec)
|
||||
{
|
||||
*utonto << "_Locks";
|
||||
if (ini.set_paragraph(*utonto))
|
||||
TString utonto = rec->get(0);
|
||||
utonto << "_Locks";
|
||||
if (ini.set_paragraph(utonto))
|
||||
{
|
||||
TBit_array read_only;
|
||||
TAuto_token_string lfields(ini.get("Lock"));
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include <utility.h>
|
||||
#include <xml.h>
|
||||
|
||||
#include <user.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRecipient
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -411,8 +413,6 @@ bool TPostman::dispatch_transaction(const TRectype& rec,
|
||||
|
||||
void TPostman::load_filters()
|
||||
{
|
||||
TRecord_cache users(LF_USER);
|
||||
|
||||
TToken_string perm(4096, '\n');
|
||||
TAuto_token_string row(80);
|
||||
|
||||
@ -434,14 +434,10 @@ void TPostman::load_filters()
|
||||
TAssoc_array expr;
|
||||
|
||||
// Scandisce l'albero degli utenti/gruppi
|
||||
for (TString16 u = user(); u.not_empty() && !users.already_loaded(u); )
|
||||
{
|
||||
const TRectype& urec = users.get(u);
|
||||
|
||||
// Test di validita'del record da eseguire solo la prima volta
|
||||
if (u == user() && !urec.exist("PERMISSION"))
|
||||
break;
|
||||
perm = urec.get("PERMISSION"); // Permessi del nodo corrente
|
||||
const TString_array& uag = user_and_groups();
|
||||
FOR_EACH_ARRAY_ROW(uag, r, rec)
|
||||
{
|
||||
perm = rec->after(rec->separator()); // Permessi del nodo corrente
|
||||
if (!perm.blank())
|
||||
{
|
||||
FOR_EACH_TOKEN(perm, tok)
|
||||
@ -482,7 +478,6 @@ void TPostman::load_filters()
|
||||
}
|
||||
}
|
||||
}
|
||||
u = urec.get("GROUPNAME");
|
||||
}
|
||||
|
||||
// Trasforma le stringhe in espressioni
|
||||
|
@ -1,27 +1,27 @@
|
||||
#include <dongle.h>
|
||||
#include <prefix.h>
|
||||
#include <recarray.h>
|
||||
#include <tabmod.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include <user.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TFast_isamfile
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TFast_isamfile : public TIsamfile
|
||||
{
|
||||
public:
|
||||
TFast_isamfile(int logicnum);
|
||||
~TFast_isamfile() { close(); }
|
||||
};
|
||||
|
||||
TFast_isamfile::TFast_isamfile(int logicnum) : TIsamfile(logicnum)
|
||||
{
|
||||
int err = open(_excllock);
|
||||
if (err != NOERR)
|
||||
err = open(_manulock);
|
||||
if (err != NOERR)
|
||||
cantread_box(name());
|
||||
}
|
||||
|
||||
TFast_isamfile::~TFast_isamfile()
|
||||
{ close(); }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRecord_Array
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -956,28 +956,34 @@ TRecord_cache& rec_cache(int file)
|
||||
const TString_array& user_and_groups()
|
||||
{
|
||||
static TString_array _uag;
|
||||
if (_uag.empty() || _uag.row(0) != user())
|
||||
|
||||
TString80 u = user();
|
||||
if (u.blank())
|
||||
u = dongle().administrator();
|
||||
|
||||
if (_uag.empty() || u != _uag.row(0).get(0))
|
||||
{
|
||||
_uag.destroy();
|
||||
_uag.add(user()); // Inserisco l'utente corrente come primo
|
||||
if (prefix_valid()) // Costruisce lista dei gruppi solo se possibile
|
||||
{
|
||||
TLocalisamfile user(LF_USER);
|
||||
int err = NOERR;
|
||||
while (err == NOERR)
|
||||
TFast_isamfile user(LF_USER);
|
||||
while (u.full())
|
||||
{
|
||||
user.put(USR_USERNAME, _uag.row(_uag.last()));
|
||||
err = user.read();
|
||||
if (err == NOERR)
|
||||
TToken_string* usr = new TToken_string(u);
|
||||
_uag.add(usr);
|
||||
user.put(USR_USERNAME, u);
|
||||
if (user.read() == NOERR)
|
||||
{
|
||||
const TString& group = user.get(USR_GROUPNAME);
|
||||
if (group.full())
|
||||
_uag.add(group);
|
||||
else
|
||||
err = _iskeynotfound;
|
||||
if (user.curr().exist(USR_PERMISSION))
|
||||
usr->add(user.get(USR_PERMISSION));
|
||||
u = user.get(USR_GROUPNAME);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
_uag.add(u);
|
||||
}
|
||||
return _uag;
|
||||
}
|
||||
|
@ -271,6 +271,14 @@ public:
|
||||
{ rec_cache(file).test_file_changes(t); }
|
||||
};
|
||||
|
||||
// Best performance by exclusive locking ... when possible :-)
|
||||
class TFast_isamfile : public TIsamfile
|
||||
{
|
||||
public:
|
||||
TFast_isamfile(int logicnum);
|
||||
~TFast_isamfile();
|
||||
};
|
||||
|
||||
TDB_cache& cache();
|
||||
TRecord_cache& rec_cache(int file);
|
||||
const TString_array& user_and_groups();
|
||||
|
@ -833,11 +833,11 @@ int TRelation_application::delete_mode()
|
||||
long deleting = sht.checked();
|
||||
TString msg;
|
||||
msg.format(FR("Confermare l'eliminazione di %d elementi"), deleting);
|
||||
bool can_delete = yesno_box(msg);
|
||||
bool can_delete = noyes_box(msg);
|
||||
if (can_delete && deleting > 100)
|
||||
{
|
||||
msg.insert(TR("ATTENZIONE: "), 0);
|
||||
can_delete = yesno_box(msg);
|
||||
can_delete = noyes_box(msg);
|
||||
}
|
||||
if (can_delete)
|
||||
{
|
||||
@ -1238,7 +1238,8 @@ bool TRelation_application::relation_remove()
|
||||
if (protected_record(r))
|
||||
return message_box(TR("Elemento non eliminabile"));
|
||||
|
||||
if (_curr_transaction == TRANSACTION_DELETE || yesno_box(TR("Confermare l'eliminazione")))
|
||||
if (_curr_transaction == TRANSACTION_DELETE ||
|
||||
noyes_box(FR("Confermare l'eliminazione del record %s"), r.file().description()))
|
||||
{
|
||||
r.restore_status();
|
||||
const bool ok = remove();
|
||||
|
@ -1,9 +0,0 @@
|
||||
#include <ctype.h>
|
||||
|
||||
char* CUpString(char* s)
|
||||
{
|
||||
char* c;
|
||||
for (c = s; *c; c++)
|
||||
*c = toupper(*c);
|
||||
return s;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user