Corretta gestione permessi di lettura/scrittura per utente

git-svn-id: svn://10.65.10.50/branches/R_10_00@22820 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2013-03-15 10:56:25 +00:00
parent eb127dd845
commit f7330b37c5

View File

@ -1,4 +1,5 @@
#include <defmask.h>
#include <postman.h>
#include <recset.h>
#include "ca2.h"
@ -81,7 +82,6 @@ protected:
virtual bool user_create();
virtual bool user_destroy();
virtual TMask* get_mask(int);
virtual TRelation* get_relation() const;
virtual bool get_next_key(TToken_string& key);
void write_rows(const TMask& m);
@ -98,6 +98,9 @@ protected:
virtual void init_query_mode(TMask& m);
virtual void init_insert_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
public:
virtual TRelation* get_relation() const;
};
static TMovanal_app& app() { return (TMovanal_app&)main_app(); }
@ -125,14 +128,15 @@ bool TMovanal_msk::on_key(KEY key)
void TMovanal_msk::show_locked_buttons()
{
const bool is_trans = app().is_transaction();
const TRelation* rel = app().get_relation();
const bool modifying = mode() == MODE_MOD;
const bool inserting = mode() == MODE_INS;
const bool editing = modifying || inserting;
const bool unlocked = !(modifying && get_bool(F_BLOCCATO));
const bool unlocked = !(modifying && get_bool(F_BLOCCATO)) && user_can_write(rel);
show (F_BLOCCATO, modifying);
enable(F_BLOCCATO, unlocked);
enable(DLG_SAVEREC, unlocked && editing);
enable(DLG_DELREC, unlocked && !inserting);
enable(DLG_DELREC, unlocked && !inserting && user_can_delete(rel));
enable(DLG_QUIT, !is_trans || !inserting);
enable(DLG_CANCEL, !is_trans || !inserting);
enable(F_RESET, unlocked && editing);