You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1240 lines
36 KiB
1240 lines
36 KiB
unit ucadUsuarios;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|
System.Classes, Vcl.Graphics, System.UITypes,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, umstMaster, Data.DB, Vcl.ComCtrls,
|
|
rDBTreeView, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls, Vcl.Buttons, Vcl.Menus,
|
|
System.ImageList, Vcl.ImgList, Vcl.ExtCtrls, Vcl.DBCtrls, Vcl.Mask,
|
|
ZAbstractRODataset, ZAbstractDataset, ZDataset, ACBrBase, ACBrMail;
|
|
|
|
type
|
|
THackDBNavigator = class(TDBNavigator);
|
|
|
|
type
|
|
TcadUsuarios = class(TmstMaster)
|
|
rdbtv_permissoes: TrDBTreeView;
|
|
pcCad: TPageControl;
|
|
pgAcessos: TTabSheet;
|
|
dbGrupos: TDBGrid;
|
|
dbUsuarios: TDBGrid;
|
|
lbl_grupos: TLabel;
|
|
lbl_usuarios: TLabel;
|
|
lbl_permissoes: TLabel;
|
|
bitbtn_liberar: TBitBtn;
|
|
bitbtn_bloquear: TBitBtn;
|
|
mnu_opcoes: TMainMenu;
|
|
Opes1: TMenuItem;
|
|
mnu_attperm: TMenuItem;
|
|
N1: TMenuItem;
|
|
mnu_delperm: TMenuItem;
|
|
ImageList1: TImageList;
|
|
btn_movuser: TButton;
|
|
pgGrupos: TTabSheet;
|
|
pgUsuarios: TTabSheet;
|
|
dblulb_grupos: TDBLookupListBox;
|
|
navgrupos: TDBNavigator;
|
|
ImageList2: TImageList;
|
|
pcUsuarios: TPageControl;
|
|
pgDados: TTabSheet;
|
|
pgemail: TTabSheet;
|
|
navusuarios: TDBNavigator;
|
|
lbl_login: TLabel;
|
|
lbl_senha: TLabel;
|
|
dbedt_login: TDBEdit;
|
|
dbedt_senha: TDBEdit;
|
|
dbcbx_trocasenha: TDBCheckBox;
|
|
dbcbx_bloqueado: TDBCheckBox;
|
|
cb_senha: TCheckBox;
|
|
dtsUsuarios: TDataSource;
|
|
dbedt_nome: TDBEdit;
|
|
lbl_nome: TLabel;
|
|
lbl_escolhegrupo: TLabel;
|
|
dtsGrupo: TDataSource;
|
|
dblulb_usuarios: TDBLookupListBox;
|
|
pnl_grupo: TPanel;
|
|
lbl_gruponome: TLabel;
|
|
dbedt_gruponome: TDBEdit;
|
|
lbl_sudo: TLabel;
|
|
dbcb_sudo: TDBCheckBox;
|
|
dblucb_grupos: TDBLookupComboBox;
|
|
lbl_grupoacesso: TLabel;
|
|
dblucb_grupoacesso: TDBLookupComboBox;
|
|
dtsConsulta: TDataSource;
|
|
qryConsulta: TZQuery;
|
|
lbl_nomeemail: TLabel;
|
|
Label1: TLabel;
|
|
lbl_useremail: TLabel;
|
|
lbl_senhaemail: TLabel;
|
|
lbl_portasmtp: TLabel;
|
|
lbl_smtp: TLabel;
|
|
dbedt_nomeemail: TDBEdit;
|
|
DBEdit2: TDBEdit;
|
|
dbedt_useremail: TDBEdit;
|
|
dbedt_senhaemail: TDBEdit;
|
|
dbedt_portasmtp: TDBEdit;
|
|
dbedt_smtp: TDBEdit;
|
|
btn_testconex: TButton;
|
|
dbcb_ssl: TDBCheckBox;
|
|
dbcb_tls: TDBCheckBox;
|
|
ACBrMail: TACBrMail;
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure mnu_attpermClick(Sender: TObject);
|
|
procedure btnnovogrupoClick(Sender: TObject);
|
|
procedure btnadelgrupoClick(Sender: TObject);
|
|
procedure btnnovousergrupoClick(Sender: TObject);
|
|
procedure btnmodusergrupoClick(Sender: TObject);
|
|
procedure bitbtn_liberarClick(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure rdbtv_permissoesClick(Sender: TObject);
|
|
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
procedure bitbtn_bloquearClick(Sender: TObject);
|
|
procedure rdbtv_permissoesGetImageIndex(Sender: TObject; Node: TTreeNode);
|
|
procedure btndelusergrupoClick(Sender: TObject);
|
|
procedure btn_movuserClick(Sender: TObject);
|
|
procedure mnu_mudarnomeClick(Sender: TObject);
|
|
procedure cb_senhaClick(Sender: TObject);
|
|
procedure dtsUsuariosStateChange(Sender: TObject);
|
|
procedure dtsGrupoStateChange(Sender: TObject);
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
procedure navgruposBeforeAction(Sender: TObject; Button: TNavigateBtn);
|
|
procedure pcCadChanging(Sender: TObject; var AllowChange: Boolean);
|
|
procedure pcCadChange(Sender: TObject);
|
|
procedure btn_testconexClick(Sender: TObject);
|
|
private
|
|
old_id_u: integer;
|
|
old_id_g: integer;
|
|
procedure SetupHackedNavigator(const Navigator: TDBNavigator;
|
|
const Glyphs: TImageList; S: string);
|
|
procedure WMMoving(var Msg: TWMMoving); message WM_MOVING;
|
|
// procedure AtualizarRdbtreeview;
|
|
{ Private declarations }
|
|
public
|
|
add_user: Boolean;
|
|
id_grupomov: string;
|
|
nome_grupmov: string;
|
|
|
|
procedure InserirIDnaPerm;
|
|
|
|
procedure AcessoCobranca; // CBR - 01 ~ 04
|
|
|
|
procedure AcessoFerramentas; // CBR.01 - 01 ~ 10
|
|
|
|
procedure AcessoCobrancaTel; // CBR.01.01 - 01 ~ 02
|
|
|
|
procedure AcessoAtendimento; // CBR.01.02
|
|
|
|
procedure AcessoCadastros; // CBR.02
|
|
|
|
procedure AcessoDevedores;
|
|
|
|
procedure AcessoCredores;
|
|
|
|
procedure AcessoUsuarios;
|
|
|
|
procedure AcessoRelatorios;
|
|
|
|
procedure AcessoOpcoes;
|
|
|
|
procedure AtualizarPermissoesGrupos;
|
|
procedure ChecaPermissoes;
|
|
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
cadUsuarios: TcadUsuarios;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses udtmSystem, {ucadUsuarioseditar,} ufrmMovUsuarios, ufrmLiberaPermissao;
|
|
|
|
// felipe conhece como funciona o sistema de permissões dessa janela
|
|
|
|
procedure TcadUsuarios.mnu_attpermClick(Sender: TObject);
|
|
begin
|
|
try
|
|
AcessoCobranca;
|
|
AcessoFerramentas;
|
|
AcessoCobrancaTel;
|
|
AcessoAtendimento;
|
|
AcessoCadastros;
|
|
AcessoDevedores;
|
|
AcessoCredores;
|
|
AcessoUsuarios;
|
|
AcessoRelatorios;
|
|
AcessoOpcoes;
|
|
|
|
AtualizarPermissoesGrupos;
|
|
dtmSystem.MakePermissoes;
|
|
Showmessage('Permissões atualizadas com sucesso!');
|
|
except
|
|
on E: Exception do
|
|
MessageDlg('Erro ao atualizar as permissões!' + sLineBreak + E.message,
|
|
mtError, [mbOK], 0);
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.btnadelgrupoClick(Sender: TObject);
|
|
var
|
|
resp: integer;
|
|
begin
|
|
resp := MessageDlg('Deseja realmente remover este grupo?', mtConfirmation,
|
|
mbOKCancel, 0);
|
|
// tratamento pra realmente poder remover o grupo está na udtmSystem
|
|
if resp = mrOk then
|
|
begin
|
|
dtmSystem.tblGrupos.Delete;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.btndelusergrupoClick(Sender: TObject);
|
|
var
|
|
resp: integer;
|
|
begin
|
|
|
|
resp := MessageDlg('Deseja realmente remover este usuário?', mtConfirmation,
|
|
mbOKCancel, 0);
|
|
if resp = mrOk then
|
|
begin // remover usuário do grupo
|
|
dtmSystem.tblUsuarios.Delete;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.btnmodusergrupoClick(Sender: TObject);
|
|
begin
|
|
// dtmSystem.add_user := false; // modificar usuario
|
|
// TcadUsuarioseditar.Create(self).ShowModal;
|
|
end;
|
|
|
|
procedure TcadUsuarios.btnnovogrupoClick(Sender: TObject);
|
|
var
|
|
nome: string;
|
|
begin
|
|
// criar novo grupo
|
|
with dtmSystem do
|
|
begin
|
|
tblGrupos.Open;
|
|
if InputQuery('Novo Grupo', 'Insira um nome para o novo grupo.', nome) then
|
|
begin
|
|
tblGrupos.Append;
|
|
tblGruposTX_NOME.AsString := nome;
|
|
tblGruposTP_SU.AsString := 'N';
|
|
tblGrupos.Post;
|
|
end;
|
|
end;
|
|
|
|
AtualizarPermissoesGrupos;
|
|
|
|
end;
|
|
|
|
procedure TcadUsuarios.btnnovousergrupoClick(Sender: TObject);
|
|
begin
|
|
// dtmSystem.add_user := true; // novo usuário
|
|
// TcadUsuarioseditar.Create(self).ShowModal;
|
|
end;
|
|
|
|
procedure TcadUsuarios.btn_movuserClick(Sender: TObject);
|
|
var
|
|
i: integer;
|
|
begin
|
|
|
|
// mover usuários de um grupo para o outro
|
|
nome_grupmov := dtmSystem.tblGruposTX_NOME.AsString;
|
|
frmMovUsuarios := TfrmMovUsuarios.Create(self);
|
|
frmMovUsuarios.ShowModal;
|
|
if frmMovUsuarios.ModalResult = mrOk then
|
|
begin
|
|
for i := 0 to dbUsuarios.SelectedRows.Count - 1 do
|
|
begin
|
|
dtmSystem.tblUsuarios.GotoBookmark
|
|
(pointer(dbUsuarios.SelectedRows.Items[i]));
|
|
dtmSystem.tblUsuarios.Edit;
|
|
dtmSystem.tblUsuariosID_GRUPO.AsString := id_grupomov;
|
|
dtmSystem.tblUsuarios.Post;
|
|
end;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TcadUsuarios.btn_testconexClick(Sender: TObject);
|
|
begin
|
|
with ACBrMail do
|
|
begin
|
|
try
|
|
Clear;
|
|
IsHTML := true;
|
|
Subject := 'Teste de conexão';
|
|
From := dtmSystem.tblUsuariosTX_EMAIL.AsString;
|
|
FromName := dtmSystem.tblUsuariosTX_EMAILNOME.AsString;
|
|
Host := dtmSystem.tblUsuariosTX_SMTP.AsString;
|
|
Username := dtmSystem.tblUsuariosTX_USUARIO.AsString;
|
|
Password := dtmSystem.tblUsuariosTX_SENHA.AsString;
|
|
Port := dtmSystem.tblUsuariosTX_PORTA.AsString;
|
|
if dtmSystem.tblUsuariosTP_TLS.AsString = 'S' then
|
|
begin
|
|
SetTLS := true;
|
|
end
|
|
else
|
|
begin
|
|
SetTLS := false;
|
|
end;
|
|
if dtmSystem.tblUsuariosTP_SSL.AsString = 'S' then
|
|
begin
|
|
SetSSL := true;
|
|
end
|
|
else
|
|
begin
|
|
SetSSL := false;
|
|
end;
|
|
DefaultCharset := TMailCharset(0);
|
|
IDECharset := TMailCharset(0);
|
|
AddAddress('marcus@nexverse.com.br', 'Teste de conexão');
|
|
Body.Text := 'Teste de conexão';
|
|
Screen.Cursor := crHourGlass;
|
|
Send(false);
|
|
Application.ProcessMessages;
|
|
Screen.Cursor := crDefault;
|
|
Showmessage
|
|
('Email teste enviado com sucesso. Configuração de email correta!');
|
|
except
|
|
Screen.Cursor := crDefault;
|
|
Showmessage
|
|
('Falha ao enviar email de teste. Configuração de email incorreta!');
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.cb_senhaClick(Sender: TObject);
|
|
begin
|
|
if cb_senha.Checked then
|
|
begin
|
|
dbedt_senha.PasswordChar := #0;
|
|
dtmSystem.mostrar_senha := true;
|
|
end;
|
|
if not cb_senha.Checked then
|
|
begin
|
|
dbedt_senha.PasswordChar := '*';
|
|
dtmSystem.mostrar_senha := false;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.ChecaPermissoes;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
bitbtn_liberar.Enabled := VerificarPermissao('CBR.02.03.01.01');
|
|
bitbtn_bloquear.Enabled := VerificarPermissao('CBR.02.03.01.02');
|
|
|
|
navgrupos.Enabled := VerificarPermissao('CBR.02.03.02');
|
|
if not VerificarPermissao('CBR.02.03.02.01') then
|
|
navgrupos.VisibleButtons := navgrupos.VisibleButtons - [nbInsert];
|
|
if not VerificarPermissao('CBR.02.03.02.02') then
|
|
navgrupos.VisibleButtons := navgrupos.VisibleButtons - [nbEdit];
|
|
if not VerificarPermissao('CBR.02.03.02.03') then
|
|
navgrupos.VisibleButtons := navgrupos.VisibleButtons - [nbDelete];
|
|
navusuarios.Enabled := VerificarPermissao('CBR.02.03.03');
|
|
if not VerificarPermissao('CBR.02.03.03.01') then
|
|
navusuarios.VisibleButtons := navusuarios.VisibleButtons - [nbInsert];
|
|
if not VerificarPermissao('CBR.02.03.03.02') then
|
|
navusuarios.VisibleButtons := navusuarios.VisibleButtons - [nbEdit];
|
|
if not VerificarPermissao('CBR.02.03.03.02') then
|
|
navusuarios.VisibleButtons := navusuarios.VisibleButtons - [nbDelete];
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.dtsGrupoStateChange(Sender: TObject);
|
|
begin
|
|
pnl_grupo.Enabled := dtsGrupo.DataSet.State in [dsEdit, dsInsert];
|
|
dblulb_grupos.Enabled := not(dtsGrupo.DataSet.State in [dsEdit, dsInsert]);
|
|
dblucb_grupos.Enabled := not(dtsGrupo.DataSet.State in [dsEdit, dsInsert]);
|
|
navusuarios.Enabled := not(dtsGrupo.DataSet.State in [dsEdit, dsInsert]);
|
|
dblulb_usuarios.Enabled := not(dtsGrupo.DataSet.State in [dsEdit, dsInsert]);
|
|
if qryConsulta.Active then
|
|
begin
|
|
qryConsulta.Refresh;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.dtsUsuariosStateChange(Sender: TObject);
|
|
begin
|
|
pcUsuarios.Enabled := dtsUsuarios.DataSet.State in [dsEdit, dsInsert];
|
|
dblucb_grupos.Enabled := not(dtsUsuarios.DataSet.State in [dsEdit, dsInsert]);
|
|
dblulb_usuarios.Enabled := not(dtsUsuarios.DataSet.State
|
|
in [dsEdit, dsInsert]);
|
|
navgrupos.Enabled := not(dtsUsuarios.DataSet.State in [dsEdit, dsInsert]);
|
|
dblulb_grupos.Enabled := not(dtsUsuarios.DataSet.State in [dsEdit, dsInsert]);
|
|
if qryConsulta.Active then
|
|
begin
|
|
qryConsulta.Refresh;
|
|
end;
|
|
if (dtsUsuarios.DataSet.State in [dsBrowse]) then
|
|
begin
|
|
pcUsuarios.ActivePage := pgDados;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TcadUsuarios.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
begin
|
|
|
|
if dtsUsuarios.DataSet <> nil then
|
|
begin
|
|
dtsUsuarios.DataSet.Filtered := false;
|
|
if dtsUsuarios.DataSet.State in [dsInsert, dsEdit] then
|
|
dtsUsuarios.DataSet.Cancel;
|
|
end;
|
|
if dtsGrupo.DataSet <> nil then
|
|
begin
|
|
dtsGrupo.DataSet.Filtered := false;
|
|
if dtsGrupo.DataSet.State in [dsInsert, dsEdit] then
|
|
dtsGrupo.DataSet.Cancel;
|
|
end;
|
|
qryConsulta.Close;
|
|
inherited;
|
|
with dtmSystem do
|
|
begin
|
|
tblGrupos.Close;
|
|
// tblUsuarios.Close;
|
|
tblPermissoes.Close;
|
|
tblGruposPermissoes.Close;
|
|
tblPermDisponiveis.Close;
|
|
end;
|
|
cadUsuarios := nil;
|
|
Action := caFree;
|
|
end;
|
|
|
|
procedure TcadUsuarios.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
begin
|
|
if navgrupos.DataSource <> nil then
|
|
if navgrupos.DataSource.State in [dsInsert, dsEdit] then
|
|
begin
|
|
MessageDlg
|
|
('Existem alterações pendentes, clique em CONFIRMAR ou CANCELAR.',
|
|
mtConfirmation, [mbOK], 0);
|
|
CanClose := false;
|
|
end;
|
|
if navusuarios.DataSource <> nil then
|
|
if navusuarios.DataSource.State in [dsInsert, dsEdit] then
|
|
begin
|
|
MessageDlg
|
|
('Existem alterações pendentes, clique em CONFIRMAR ou CANCELAR.',
|
|
mtConfirmation, [mbOK], 0);
|
|
CanClose := false;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.FormCreate(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
with dtmSystem do
|
|
begin
|
|
if not tblPermissoes.Active then
|
|
begin
|
|
tblPermissoes.Open
|
|
end
|
|
else
|
|
begin
|
|
tblPermissoes.Refresh;
|
|
end;
|
|
if not tblGruposPermissoes.Active then
|
|
begin
|
|
tblGruposPermissoes.Open;
|
|
end
|
|
else
|
|
begin
|
|
tblGruposPermissoes.Refresh;
|
|
end;
|
|
if not tblUsuarios.Active then
|
|
begin
|
|
tblUsuarios.Open;
|
|
end
|
|
else
|
|
begin
|
|
tblUsuarios.Refresh;
|
|
end;
|
|
if not tblPermDisponiveis.Active then
|
|
begin
|
|
tblPermDisponiveis.Open;
|
|
end
|
|
else
|
|
begin
|
|
tblPermDisponiveis.Refresh;
|
|
end;
|
|
if not tblGrupos.Active then
|
|
begin
|
|
tblGrupos.Open;
|
|
end
|
|
else
|
|
begin
|
|
tblGrupos.Refresh;
|
|
end;
|
|
end;
|
|
|
|
pcCad.ActivePage := pgAcessos;
|
|
pcUsuarios.ActivePage := pgDados;
|
|
add_user := false;
|
|
old_id_g := -1;
|
|
old_id_u := -1;
|
|
|
|
SetupHackedNavigator(navgrupos, ImageList2, 's');
|
|
SetupHackedNavigator(navusuarios, ImageList2, 's');
|
|
|
|
qryConsulta.SQL.Text := 'select * from SYS_GRUPOS order by TX_NOME';
|
|
qryConsulta.Open;
|
|
dblucb_grupoacesso.ListField := 'TX_NOME';
|
|
dblucb_grupoacesso.KeyField := 'ID_GRUPO';
|
|
dtmSystem.MakePermissoes;
|
|
ChecaPermissoes;
|
|
|
|
end;
|
|
|
|
procedure TcadUsuarios.FormKeyDown(Sender: TObject; var Key: Word;
|
|
Shift: TShiftState);
|
|
begin
|
|
{ // esc não fecha a janela
|
|
if (Key = vk_escape) then
|
|
begin
|
|
Key := 0;
|
|
self.ActiveControl := nil;
|
|
end; }
|
|
inherited;
|
|
if Key = VK_ESCAPE then
|
|
begin
|
|
Key := 0;
|
|
Close;
|
|
end;
|
|
{ navgrupos.Enabled := VerificarPermissao('CBR.02.03.02');
|
|
if not VerificarPermissao('CBR.02.03.02.01') then
|
|
navgrupos.VisibleButtons := navgrupos.VisibleButtons - [nbInsert];
|
|
if not VerificarPermissao('CBR.02.03.02.02') then
|
|
navgrupos.VisibleButtons := navgrupos.VisibleButtons - [nbEdit];
|
|
if not VerificarPermissao('CBR.02.03.02.03') then
|
|
navgrupos.VisibleButtons := navgrupos.VisibleButtons - [nbDelete];
|
|
navusuarios.Enabled := VerificarPermissao('CBR.02.03.03');
|
|
if not VerificarPermissao('CBR.02.03.03.01') then
|
|
navusuarios.VisibleButtons := navusuarios.VisibleButtons - [nbInsert];
|
|
if not VerificarPermissao('CBR.02.03.03.02') then
|
|
navusuarios.VisibleButtons := navusuarios.VisibleButtons - [nbEdit];
|
|
if not VerificarPermissao('CBR.02.03.03.02') then
|
|
navusuarios.VisibleButtons := navusuarios.VisibleButtons - [nbDelete]; }
|
|
if (Key = 75) and (Shift = [ssCtrl]) then
|
|
begin
|
|
// ShowMessage('Ctrl+k is pressed!');
|
|
frmLiberaPermissao := TfrmLiberaPermissao.Create(self);
|
|
|
|
with frmLiberaPermissao do
|
|
begin
|
|
level := 3;
|
|
string_permissoes.Add('CBR.02.03.01.01');
|
|
string_permissoes.Add('CBR.02.03.01.02');
|
|
string_permissoes.Add('CBR.02.03.02');
|
|
string_permissoes.Add('CBR.02.03.02.01');
|
|
string_permissoes.Add('CBR.02.03.02.02');
|
|
string_permissoes.Add('CBR.02.03.02.03');
|
|
string_permissoes.Add('CBR.02.03.03');
|
|
string_permissoes.Add('CBR.02.03.03.01');
|
|
string_permissoes.Add('CBR.02.03.03.02');
|
|
string_permissoes.Add('CBR.02.03.03.03');
|
|
|
|
ShowModal;
|
|
|
|
if ModalResult = mrOk then
|
|
begin
|
|
case dtmSystem.cod_liberapermissao of
|
|
0:
|
|
bitbtn_liberar.Enabled := true;
|
|
1:
|
|
bitbtn_bloquear.Enabled := true;
|
|
2:
|
|
navgrupos.Enabled := true;
|
|
3:
|
|
begin
|
|
navgrupos.Enabled := true;
|
|
navgrupos.VisibleButtons := navgrupos.VisibleButtons + [nbInsert];
|
|
end;
|
|
4:
|
|
begin
|
|
navgrupos.Enabled := true;
|
|
navgrupos.VisibleButtons := navgrupos.VisibleButtons + [nbEdit];
|
|
end;
|
|
5:
|
|
begin
|
|
navgrupos.Enabled := true;
|
|
navgrupos.VisibleButtons := navgrupos.VisibleButtons + [nbDelete];
|
|
end;
|
|
6:
|
|
navusuarios.Enabled := true;
|
|
7:
|
|
begin
|
|
navusuarios.Enabled := true;
|
|
navusuarios.VisibleButtons := navusuarios.VisibleButtons + [nbInsert];
|
|
end;
|
|
8:
|
|
begin
|
|
navusuarios.Enabled := true;
|
|
navusuarios.VisibleButtons := navusuarios.VisibleButtons + [nbEdit];
|
|
end;
|
|
9:
|
|
begin
|
|
navusuarios.Enabled := true;
|
|
navusuarios.VisibleButtons := navusuarios.VisibleButtons + [nbDelete];
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.FormShow(Sender: TObject);
|
|
begin
|
|
dtmSystem.tblGrupos.First;
|
|
dtmSystem.tblUsuarios.First;
|
|
|
|
if dtmSystem.mostrar_senha then
|
|
begin
|
|
cb_senha.Checked := true;
|
|
dbedt_senha.PasswordChar := #0;
|
|
end
|
|
else
|
|
begin
|
|
cb_senha.Checked := false;
|
|
dbedt_senha.PasswordChar := '*';
|
|
end;
|
|
|
|
dblucb_grupos.KeyValue := dtsGrupo.DataSet.FieldByName('ID_GRUPO').AsInteger;
|
|
|
|
end;
|
|
|
|
procedure TcadUsuarios.InserirIDnaPerm;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
tblPermissoes.First;
|
|
while not tblPermissoes.Eof do
|
|
begin
|
|
if Pos('(', tblPermissoesCD_PERMISSAO.AsString) <> 1 then
|
|
begin
|
|
tblPermissoes.Edit;
|
|
tblPermissoesTX_DESCRICAO.AsString :=
|
|
'(' + tblPermissoesID_PERMISSAO.AsString + ') ' +
|
|
tblPermissoesTX_DESCRICAO.AsString;
|
|
tblPermissoes.Post;
|
|
end;
|
|
tblPermissoes.Next;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.mnu_mudarnomeClick(Sender: TObject);
|
|
var
|
|
nome: string;
|
|
begin
|
|
|
|
with dtmSystem do
|
|
begin
|
|
if InputQuery('Novo nome.', 'Insira um novo nome para o grupo.', nome) then
|
|
begin
|
|
if nome = tblGruposTX_NOME.AsString then
|
|
begin
|
|
MessageDlg('O grupo não pode receber o mesmo nome.', mtInformation,
|
|
[mbOK], 0);
|
|
end
|
|
else
|
|
begin
|
|
tblGrupos.Edit;
|
|
tblGruposTX_NOME.AsString := nome;
|
|
tblGrupos.Post;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.navgruposBeforeAction(Sender: TObject;
|
|
Button: TNavigateBtn);
|
|
begin
|
|
case Button of
|
|
nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbRefresh:
|
|
if navgrupos.DataSource.State in [dsInsert, dsEdit] then
|
|
begin
|
|
MessageDlg
|
|
('Existem alterações pendentes, clique em CONFIRMAR ou CANCELAR.',
|
|
mtConfirmation, [mbOK], 0);
|
|
Abort;
|
|
end;
|
|
|
|
nbPost:
|
|
begin
|
|
SelectNext(ActiveControl as tWinControl, true, true);
|
|
navgrupos.DataSource.DataSet.Post;
|
|
AtualizarPermissoesGrupos;
|
|
abort;
|
|
end;
|
|
|
|
nbDelete:
|
|
begin
|
|
if navgrupos.DataSource.State in [dsInsert, dsEdit] then
|
|
begin
|
|
MessageDlg
|
|
('Existem alterações pendentes, clique em CONFIRMAR ou CANCELAR.',
|
|
mtConfirmation, [mbOK], 0);
|
|
Abort;
|
|
end;
|
|
if MessageDlg('Deseja apagar este registro?', mtConfirmation,
|
|
[mbYes, mbNo], 0) = mrNo then
|
|
Abort;
|
|
try
|
|
dtsGrupo.DataSet.Delete;
|
|
except
|
|
Showmessage
|
|
('Este registro está sendo utilizado pelo sistema ou contém dependências e não pode ser apagado');
|
|
end;
|
|
Abort;
|
|
end;
|
|
|
|
nbCancel:
|
|
if MessageDlg('Deseja cancelar as modificações?', mtConfirmation,
|
|
[mbYes, mbNo], 0) = mrNo then
|
|
Abort;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.pcCadChange(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
if pcCad.TabIndex = 3 then
|
|
begin
|
|
dtsGrupo.DataSet.First;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.pcCadChanging(Sender: TObject; var AllowChange: Boolean);
|
|
var
|
|
ponto: TPoint;
|
|
begin
|
|
ponto := Mouse.CursorPos;
|
|
ponto := ScreenToClient(ponto);
|
|
if (dtsUsuarios.DataSet.State in [dsEdit, dsInsert]) or
|
|
(dtsGrupo.DataSet.State in [dsEdit, dsInsert]) then
|
|
begin
|
|
if pcCad.IndexOfTabAt(ponto.X, ponto.Y) = 0 then
|
|
begin
|
|
AllowChange := false;
|
|
end;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TcadUsuarios.rdbtv_permissoesClick(Sender: TObject);
|
|
begin
|
|
rdbtv_permissoes.Selected.SelectedIndex :=
|
|
rdbtv_permissoes.Selected.ImageIndex;
|
|
end;
|
|
|
|
procedure TcadUsuarios.rdbtv_permissoesGetImageIndex(Sender: TObject;
|
|
Node: TTreeNode);
|
|
var
|
|
perm_id, perm: string;
|
|
// coloca as imagens no list conforme tipo de permissão
|
|
last_recno: integer;
|
|
pai, filho: TTreeNode;
|
|
begin
|
|
if (Node.level >= 1) and Assigned(Node.Data) then
|
|
begin
|
|
// Node.AbsoluteIndex;
|
|
// Node.getPrevSibling;
|
|
with dtmSystem do
|
|
begin
|
|
last_recno := tblGrupos.RecNo;
|
|
if tblGrupos.Locate('TX_NOME', Node.Text, []) then
|
|
begin
|
|
tblGrupos.RecNo := last_recno;
|
|
end
|
|
else
|
|
begin
|
|
filho := Node;
|
|
pai := Node.Parent;
|
|
perm := '';
|
|
while pai <> nil do
|
|
begin
|
|
if pai.level <> 0 then
|
|
begin
|
|
if filho = Node then
|
|
begin
|
|
perm := '.' + Format('%.*d', [2, Node.Index + 1]) + perm;
|
|
end
|
|
else
|
|
begin
|
|
perm := '.' + Format('%.*d', [2, filho.Index + 1]) + perm;
|
|
end;
|
|
end;
|
|
filho := pai;
|
|
pai := filho.Parent;
|
|
end;
|
|
perm := 'CBR' + perm;
|
|
// rdbtv_permissoes.DataItemDefs[0].SubDataItemDefs[0].
|
|
// if tblPermissoes.Locate('TX_DESCRICAO', Node.Text, []) then
|
|
// begin
|
|
if tblPermissoes.Locate('CD_PERMISSAO', perm, []) then
|
|
begin
|
|
perm_id := tblPermissoesID_PERMISSAO.AsString;
|
|
end;
|
|
if tblGruposPermissoes.Locate('ID_PERMISSAO', perm_id, []) then
|
|
begin
|
|
if tblGruposPermissoesTP_ACESSO.AsString = 'S' then
|
|
begin
|
|
Node.ImageIndex := 0;
|
|
Node.SelectedIndex := 0;
|
|
end
|
|
else
|
|
begin
|
|
Node.ImageIndex := 1;
|
|
Node.SelectedIndex := 1;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.SetupHackedNavigator(const Navigator: TDBNavigator;
|
|
const Glyphs: TImageList; S: string);
|
|
const
|
|
Captions: array [TNavigateBtn] of string = ('Primeiro', 'Anterior', 'Próximo',
|
|
'Último', 'Adicionar', 'Excluir', 'Alterar', 'Confirmar', 'Cancelar',
|
|
'Atualizar', 'Aplicar Atualizações', 'Cancelar Atualizãções');
|
|
(* Captions : array[TNavigateBtn] of string =
|
|
('First', 'Prior', 'Next', 'Last', 'Insert',
|
|
'Delete', 'Edit', 'Post', 'Cancel', 'Refresh'); *)
|
|
Hints: array [TNavigateBtn] of string = ('Primeiro', 'Anterior', 'Próximo',
|
|
'Último', 'Adicionar', 'Apagar', 'Modificar', 'Confirmar', 'Cancelar',
|
|
'Atualizar', 'Aplicar Atualizações', 'Cancelar Atualizãções');
|
|
var
|
|
btn: TNavigateBtn;
|
|
begin
|
|
// função propriamente dita para "hackear" o navigator
|
|
for btn := Low(TNavigateBtn) to High(TNavigateBtn) do
|
|
with THackDBNavigator(Navigator).Buttons[btn] do
|
|
begin
|
|
// from the Captions const array
|
|
|
|
Hint := Hints[btn];
|
|
|
|
if S = 's' then
|
|
begin
|
|
Caption := Captions[btn];
|
|
end;
|
|
|
|
// the number of images in the Glyph property
|
|
NumGlyphs := 1;
|
|
// Remove the old glyph.
|
|
Glyph := nil;
|
|
// Assign the custom one
|
|
Glyphs.GetBitmap(integer(btn), Glyph);
|
|
// gylph above text
|
|
Layout := blGlyphTop;
|
|
|
|
Font.Style := Font.Style - [fsbold];
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.WMMoving(var Msg: TWMMoving);
|
|
var
|
|
workArea: TRect;
|
|
begin
|
|
workArea := Screen.WorkareaRect;
|
|
|
|
with Msg.DragRect^ do
|
|
begin
|
|
if left < workArea.left then
|
|
OffsetRect(Msg.DragRect^, workArea.left - left, 0);
|
|
|
|
if top < workArea.top then
|
|
OffsetRect(Msg.DragRect^, 0, workArea.top - top);
|
|
|
|
if Right > workArea.Right then
|
|
OffsetRect(Msg.DragRect^, workArea.Right - Right, 0);
|
|
|
|
if Bottom > workArea.Bottom then
|
|
OffsetRect(Msg.DragRect^, 0, workArea.Bottom - Bottom);
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoAtendimento;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
InserirPermissao('CBR.01.03.01', 'S', 'Dados Cadastrais');
|
|
|
|
InserirPermissao('CBR.01.03.01.01', 'S', 'Editar Devedor');
|
|
|
|
InserirPermissao('CBR.01.03.01.02', 'S', 'Endereços');
|
|
InserirPermissao('CBR.01.03.01.02.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.03.01.02.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.03.01.02.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.03.01.03', 'S', 'Telefones');
|
|
InserirPermissao('CBR.01.03.01.03.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.03.01.03.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.03.01.03.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.03.01.04', 'S', 'Títulos');
|
|
InserirPermissao('CBR.01.03.01.04.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.03.01.04.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.03.01.04.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.03.01.05', 'S', 'Histórico');
|
|
InserirPermissao('CBR.01.03.01.05.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.03.01.05.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.03.01.05.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.03.01.06', 'S', 'Email');
|
|
InserirPermissao('CBR.01.03.01.06.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.03.01.06.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.03.01.06.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.03.02', 'S', 'Cálculos');
|
|
|
|
InserirPermissao('CBR.01.03.02.01', 'S', 'Descontos');
|
|
InserirPermissao('CBR.01.03.02.01.01', 'S', 'Quitar');
|
|
InserirPermissao('CBR.01.03.02.01.02', 'S', 'Parcelar');
|
|
InserirPermissao('CBR.01.03.02.01.03', 'S', 'Índices');
|
|
|
|
InserirPermissao('CBR.01.03.02.02', 'S', 'Não Cobrar Multa');
|
|
|
|
InserirPermissao('CBR.01.03.02.03', 'S', 'Taxa Extra');
|
|
|
|
InserirPermissao('CBR.01.03.02.04', 'S', 'Exceção de Entrada');
|
|
|
|
InserirPermissao('CBR.01.03.02.05', 'S', 'Cobrar Índices');
|
|
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoCadastros;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
InserirPermissao('CBR.02.01', 'S', 'Devedores');
|
|
InserirPermissao('CBR.02.02', 'S', 'Credores');
|
|
InserirPermissao('CBR.02.03', 'S', 'Permissões, Grupos e Usuários');
|
|
InserirPermissao('CBR.02.04', 'S', 'Providências');
|
|
InserirPermissao('CBR.02.05', 'S', 'Empresa');
|
|
InserirPermissao('CBR.02.06', 'S', 'Contas');
|
|
InserirPermissao('CBR.02.07', 'S', 'Texto de Mensagens');
|
|
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoCobranca; // Permissões da janela cobrança
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
InserirPermissao('CBR', 'S', 'Cobrança - Sistema');
|
|
|
|
InserirPermissao('CBR.01', 'S', 'Ferramentas do Sistema');
|
|
InserirPermissao('CBR.02', 'S', 'Cadastros');
|
|
InserirPermissao('CBR.03', 'S', 'Relatórios');
|
|
InserirPermissao('CBR.04', 'S', 'Opções'); // ???
|
|
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoCobrancaTel;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
InserirPermissao('CBR.01.01.01', 'S', 'Dados Cadastrais');
|
|
|
|
InserirPermissao('CBR.01.01.01.01', 'S', 'Editar Devedor');
|
|
|
|
InserirPermissao('CBR.01.01.01.02', 'S', 'Endereços');
|
|
InserirPermissao('CBR.01.01.01.02.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.01.01.02.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.01.01.02.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.01.01.03', 'S', 'Telefones');
|
|
InserirPermissao('CBR.01.01.01.03.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.01.01.03.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.01.01.03.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.01.01.04', 'S', 'Títulos');
|
|
InserirPermissao('CBR.01.01.01.04.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.01.01.04.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.01.01.04.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.01.01.05', 'S', 'Histórico');
|
|
InserirPermissao('CBR.01.01.01.05.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.01.01.05.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.01.01.05.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.01.01.06', 'S', 'Email');
|
|
InserirPermissao('CBR.01.01.01.06.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.01.01.01.06.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.01.01.01.06.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.01.01.02', 'S', 'Cálculos');
|
|
|
|
InserirPermissao('CBR.01.01.02.01', 'S', 'Descontos');
|
|
InserirPermissao('CBR.01.01.02.01.01', 'S', 'Quitar');
|
|
InserirPermissao('CBR.01.01.02.01.02', 'S', 'Parcelar');
|
|
|
|
InserirPermissao('CBR.01.01.02.02', 'S', 'Não Cobrar Multa');
|
|
|
|
InserirPermissao('CBR.01.01.02.03', 'S', 'Taxa Extra');
|
|
|
|
InserirPermissao('CBR.01.01.02.04', 'S', 'Exceção de Entrada');
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoCredores;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
// InserirPermissao('CBR.02.02', 'S', 'Credores');
|
|
InserirPermissao('CBR.02.02.01', 'S', 'Dados Cadastrais');
|
|
InserirPermissao('CBR.02.02.01.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.02.02.01.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.02.02.01.03', 'S', 'Excluir');
|
|
InserirPermissao('CBR.02.02.01.04', 'S', 'Cálculos');
|
|
|
|
InserirPermissao('CBR.02.02.02', 'S', 'Políticas');
|
|
|
|
InserirPermissao('CBR.02.02.03', 'S', 'Faixas');
|
|
|
|
InserirPermissao('CBR.02.02.04', 'S', 'Indicadores Financeiros');
|
|
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoDevedores;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
// InserirPermissao('CBR.02.01', 'S', 'Devedores');
|
|
InserirPermissao('CBR.02.01.01', 'S', 'Dados Cadastrais');
|
|
|
|
InserirPermissao('CBR.02.01.01.01', 'S', 'Editar Devedor');
|
|
InserirPermissao('CBR.02.01.01.01.01', 'N', 'Excluir Devedor');
|
|
|
|
InserirPermissao('CBR.02.01.01.02', 'S', 'Endereços');
|
|
InserirPermissao('CBR.02.01.01.02.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.02.01.01.02.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.02.01.01.02.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.02.01.01.03', 'S', 'Telefones');
|
|
InserirPermissao('CBR.02.01.01.03.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.02.01.01.03.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.02.01.01.03.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.02.01.01.04', 'S', 'Títulos');
|
|
InserirPermissao('CBR.02.01.01.04.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.02.01.01.04.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.02.01.01.04.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.02.01.01.05', 'S', 'Histórico');
|
|
InserirPermissao('CBR.02.01.01.05.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.02.01.01.05.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.02.01.01.05.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.02.01.01.06', 'S', 'Emails');
|
|
InserirPermissao('CBR.02.01.01.06.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.02.01.01.06.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.02.01.01.06.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.02.01.02', 'S', 'Cálculos');
|
|
|
|
InserirPermissao('CBR.02.01.02.01', 'S', 'Descontos');
|
|
InserirPermissao('CBR.02.01.02.01.01', 'S', 'Quitar');
|
|
InserirPermissao('CBR.02.01.02.01.02', 'S', 'Parcelar');
|
|
|
|
InserirPermissao('CBR.02.01.02.02', 'S', 'Não Cobrar Multa');
|
|
|
|
InserirPermissao('CBR.02.01.02.03', 'S', 'Taxa Extra');
|
|
|
|
InserirPermissao('CBR.02.01.02.04', 'S', 'Exceção de Entrada');
|
|
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoFerramentas;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
InserirPermissao('CBR.01.01', 'S', 'Cobrança Telefônica');
|
|
InserirPermissao('CBR.01.02', 'S', 'Pesquisa de Devedores');
|
|
InserirPermissao('CBR.01.03', 'S', 'Atendimento');
|
|
InserirPermissao('CBR.01.04', 'S', 'Gerenciamento de Campanhas');
|
|
InserirPermissao('CBR.01.05', 'S', 'Central de Agendamento');
|
|
InserirPermissao('CBR.01.06', 'S', 'Envio de Mensagens');
|
|
InserirPermissao('CBR.01.07', 'S', 'Correção Digito 9');
|
|
InserirPermissao('CBR.01.08', 'S', 'Importação TCC');
|
|
InserirPermissao('CBR.01.09', 'S', 'Central de Planilhamento');
|
|
InserirPermissao('CBR.01.10', 'S', 'Visualização de Recibos');
|
|
InserirPermissao('CBR.01.11', 'S', 'Rankings');
|
|
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoOpcoes;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
// InserirPermissao('CBR.03', 'S', 'Relatórios');
|
|
InserirPermissao('CBR.04.01', 'S', 'Índices de Cobrança');
|
|
InserirPermissao('CBR.04.02', 'S', 'Modelos de Repasse');
|
|
InserirPermissao('CBR.04.03', 'S', 'Banco de Dados');
|
|
InserirPermissao('CBR.04.03.01', 'S', 'Backup');
|
|
InserirPermissao('CBR.04.03.02', 'S', 'Restaurar');
|
|
InserirPermissao('CBR.04.04', 'S', 'Configuração de Layout de Importação');
|
|
InserirPermissao('CBR.04.05', 'S',
|
|
'Configuração de Pop Up de Inicialização');
|
|
InserirPermissao('CBR.04.06', 'S', 'Envio de Banco online');
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoRelatorios;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
// InserirPermissao('CBR.03', 'S', 'Relatórios');
|
|
InserirPermissao('CBR.03.01', 'S', 'Entrada de Devedores');
|
|
InserirPermissao('CBR.03.02', 'S', 'Prestação de Contas');
|
|
InserirPermissao('CBR.03.03', 'S', 'Recibos Emitidos');
|
|
InserirPermissao('CBR.03.04', 'S', 'Prestação de Contas TCC');
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.AcessoUsuarios;
|
|
begin
|
|
with dtmSystem do
|
|
begin
|
|
// InserirPermissao('CBR.02.03', 'S', 'Usuários');
|
|
InserirPermissao('CBR.02.03.01', 'S', 'Permissões');
|
|
InserirPermissao('CBR.02.03.01.01', 'S', 'Conceder');
|
|
InserirPermissao('CBR.02.03.01.02', 'S', 'Bloquear');
|
|
|
|
InserirPermissao('CBR.02.03.02', 'S', 'Grupos');
|
|
InserirPermissao('CBR.02.03.02.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.02.03.02.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.02.03.02.03', 'S', 'Excluir');
|
|
|
|
InserirPermissao('CBR.02.03.03', 'S', 'Usuários');
|
|
InserirPermissao('CBR.02.03.03.01', 'S', 'Adicionar');
|
|
InserirPermissao('CBR.02.03.03.02', 'S', 'Editar');
|
|
InserirPermissao('CBR.02.03.03.03', 'S', 'Excluir');
|
|
end;
|
|
end;
|
|
|
|
procedure TcadUsuarios.AtualizarPermissoesGrupos; // nome auto explicativo...
|
|
begin
|
|
Screen.Cursor := crHourGlass;
|
|
with dtmSystem do
|
|
begin
|
|
tblPermDisponiveis.Open;
|
|
tblGruposPermissoes.Open;
|
|
tblGruposPermissoes.DisableControls;
|
|
tblGrupos.First;
|
|
while not tblGrupos.Eof do
|
|
begin
|
|
tblPermissoes.First;
|
|
while not tblPermissoes.Eof do
|
|
begin
|
|
if not tblGruposPermissoes.Locate('ID_PERMISSAO',
|
|
tblPermissoesID_PERMISSAO.Value, []) then
|
|
begin
|
|
tblGruposPermissoes.Append;
|
|
tblGruposPermissoesID_PERMISSAO.AsString :=
|
|
tblPermissoesID_PERMISSAO.AsString;
|
|
tblGruposPermissoesTP_ACESSO.AsString :=
|
|
tblPermissoesTP_ACESSO.AsString;
|
|
tblGruposPermissoes.Post;
|
|
end;
|
|
stbStatus.SimpleText := 'Atualizando Grupo ' + tblGruposTX_NOME.AsString
|
|
+ ': ' + FormatFloat('0.00%', tblPermissoes.RecNo /
|
|
tblPermissoes.RecordCount * 100);
|
|
tblPermissoes.Next;
|
|
end;
|
|
tblGrupos.Next;
|
|
end;
|
|
tblPermissoes.First;
|
|
tblGrupos.First;
|
|
// tblPermissoes.Close;
|
|
tblGruposPermissoes.Close;
|
|
tblGruposPermissoes.Open;
|
|
tblGrupos.EnableControls;
|
|
tblGruposPermissoes.EnableControls;
|
|
// tblPermDisponiveis.Close;
|
|
end;
|
|
stbStatus.SimpleText := '';
|
|
Screen.Cursor := crDefault;
|
|
end;
|
|
|
|
procedure TcadUsuarios.bitbtn_liberarClick(Sender: TObject);
|
|
var
|
|
p: TTreeNode;
|
|
nome_pai, id_perm, selected_node: string; // liberar a permissão
|
|
begin
|
|
|
|
dtmSystem.tblPermDisponiveis.Open;
|
|
selected_node := rdbtv_permissoes.Selected.Text;
|
|
p := rdbtv_permissoes.Selected;
|
|
while Assigned(p.Parent) do
|
|
begin
|
|
p := p.Parent;
|
|
end;
|
|
nome_pai := p.Text;
|
|
with dtmSystem do
|
|
begin
|
|
tblGrupos.Locate('TX_NOME', nome_pai, []);
|
|
tblPermissoes.Locate('TX_DESCRICAO', selected_node, []);
|
|
id_perm := tblPermissoesID_PERMISSAO.AsString;
|
|
tblGruposPermissoes.Locate('ID_PERMISSAO', id_perm, []);
|
|
tblGruposPermissoes.Edit;
|
|
tblGruposPermissoesTP_ACESSO.AsString := 'S';
|
|
tblGruposPermissoes.Post;
|
|
end;
|
|
|
|
rdbtv_permissoes.RefreshData(false);
|
|
rdbtv_permissoes.Selected := nil;
|
|
end;
|
|
|
|
procedure TcadUsuarios.bitbtn_bloquearClick(Sender: TObject);
|
|
var
|
|
p: TTreeNode; // bloquear a permissão
|
|
nome_pai, selected_node, id_perm: string;
|
|
begin
|
|
|
|
dtmSystem.tblPermDisponiveis.Open;
|
|
selected_node := rdbtv_permissoes.Selected.Text;
|
|
id_perm := dtmSystem.tblPermissoesID_PERMISSAO.AsString;
|
|
p := rdbtv_permissoes.Selected;
|
|
while Assigned(p.Parent) do
|
|
begin
|
|
p := p.Parent;
|
|
end;
|
|
nome_pai := p.Text;
|
|
with dtmSystem do
|
|
begin
|
|
tblGrupos.Locate('TX_NOME', nome_pai, []);
|
|
// tblPermissoes.Locate('TX_DESCRICAO', selected_node, []);
|
|
tblGruposPermissoes.Locate('ID_PERMISSAO', id_perm, []);
|
|
tblGruposPermissoes.Edit;
|
|
tblGruposPermissoesTP_ACESSO.AsString := 'N';
|
|
tblGruposPermissoes.Post;
|
|
end;
|
|
|
|
rdbtv_permissoes.RefreshData(false);
|
|
rdbtv_permissoes.Selected := nil;
|
|
end;
|
|
|
|
end.
|