Patch level :4.0 706
Files correlati :ba0, ba1 Ricompilazione Demo : [ ] Commento :riporto gestione usr/groups scritto sulla 3.0 git-svn-id: svn://10.65.10.50/trunk@15333 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6e15286344
commit
1baacbd057
@ -202,23 +202,19 @@ void TMask::read_mask(
|
||||
|
||||
if (num == 0)
|
||||
{
|
||||
_total_time = clock()-start_t;
|
||||
|
||||
TFilename prof;
|
||||
if (make_profile_name(prof))
|
||||
|
||||
TFilename prof; make_profile_name(prof);
|
||||
if (prof.exist())
|
||||
{
|
||||
// Costruisce la lista dei gruppi di appartenenza dell'utente
|
||||
TString_array users_and_groups;
|
||||
for (TString u = user(); u.full(); u = cache().get(LF_USER, u, USR_GROUPNAME))
|
||||
users_and_groups.add(u);
|
||||
|
||||
TConfig ini(prof);
|
||||
FOR_EACH_ARRAY_ROW_BACK(users_and_groups, c, utonto)
|
||||
{
|
||||
const TString_array& uag = user_and_groups();
|
||||
TConfig ini(prof);
|
||||
FOR_EACH_ARRAY_ROW_BACK(uag, c, utonto)
|
||||
{
|
||||
*utonto << "_Locks";
|
||||
if (ini.set_paragraph(*utonto))
|
||||
{
|
||||
TBit_array read_only;
|
||||
TBit_array read_only;
|
||||
TAuto_token_string lfields(ini.get("Lock"));
|
||||
TAuto_token_string ufields(ini.get("Unlock"));
|
||||
if (ufields.find("*")>=0)
|
||||
|
@ -872,4 +872,34 @@ TDB_cache& cache()
|
||||
}
|
||||
|
||||
TRecord_cache& rec_cache(int file)
|
||||
{ return cache().rec_cache(file); }
|
||||
{ return cache().rec_cache(file); }
|
||||
|
||||
// Utente corrente (elemento 0) e suoi gruppi di appartenenza (dall'elemento 1 in poi)
|
||||
const TString_array& user_and_groups()
|
||||
{
|
||||
static TString_array _uag;
|
||||
if (_uag.empty() || _uag.row(0) != user())
|
||||
{
|
||||
_uag.destroy();
|
||||
_uag.add(user()); // Inserisco l'utente stesso come primo
|
||||
if (prefix_valid()) // Costruisce lista dei gruppi solo se possibile
|
||||
{
|
||||
TLocalisamfile user(LF_USER);
|
||||
int err = NOERR;
|
||||
while (err == NOERR)
|
||||
{
|
||||
user.put(USR_USERNAME, _uag.row(_uag.last()));
|
||||
err = user.read();
|
||||
if (err == NOERR)
|
||||
{
|
||||
const TString& group = user.get(USR_GROUPNAME);
|
||||
if (group.full())
|
||||
_uag.add(group);
|
||||
else
|
||||
err = _iskeynotfound;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return _uag;
|
||||
}
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <isam.h>
|
||||
#endif
|
||||
|
||||
#include <user.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRecord_Array
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -269,7 +271,7 @@ public:
|
||||
|
||||
TDB_cache& cache();
|
||||
TRecord_cache& rec_cache(int file);
|
||||
|
||||
const TString_array& user_and_groups();
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user