Формирование системы безопасности. Визуализация пользователей и объектов. Перевод в команды SQL, их последующая трансляция и сохранение в системном каталоге
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
se;
if flag=true then
begin
ListBox1.Items.Add(Edit1.Text);
ListBox2.Items.Add(Edit2.Text);
end
else showmessage('Такой пользователь уже есть');
end else showmessage('Не введено имя пользователя или пароль');
Edit1.Text:='';
Edit2.Text:='';;TForm2.BitBtn3Click(Sender: TObject);
i:integer;
id:integer;
id:=-1;
for i:=0 to ListBox1.Items.Count-1 do
if listBox1.Selected[i] then id:=i;
if id<>-1 then ListBox1.Items.Delete(id) else
showmessage('Нет выделенных элементов'); ;
procedure TForm2.BitBtn1Click(Sender: TObject);
i:integer;
if ListBox1.Items.Count>0 then
begin
num_user:=1;
user_c:=ListBox1.Items.Count;
for i:=1 to user_c do
begin
user_n[i]:=ListBox1.Items[i-1];
user_p[i]:=ListBox2.Items[i-1];
end;
Hide;
Form3.show;
end else
showmessage('Создайте хотя бы одного пользователя!');
end;TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
Form1.Close;;.Unit3;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls, Buttons;
TForm3 = class(TForm)
SG: TStringGrid;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
BitBtn1: TBitBtn;
procedure FormShow(Sender: TObject);
procedure SGSelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Form3: TForm3;Unit1, Unit4;
{$R *.dfm}TForm3.FormShow(Sender: TObject);
i,j:integer;
Label2.Caption:='Пользователь - '+user_n[num_user];
Label3.Caption:='Пароль - '+user_p[num_user];
SG.Cells[0,1]:='select';
SG.Cells[0,2]:='insert';
SG.Cells[0,3]:='delete';
SG.Cells[0,4]:='update';
SG.Cells[0,5]:='all';
SG.ColCount:=table_c+1;
for i:=1 to table_c do
begin
SG.Cells[i,0]:=table_n[i];
for j:=1 to 5 do
SG.Cells[i,j]:='-';
end;;TForm3.SGSelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
i:integer;
if (Sg.Cells[ACol,ARow]='-') and (ARow'+') then begin Sg.Cells[ACol,ARow]:='+'; exit; end;
if (Sg.Cells[ACol,ARow]='+') then begin Sg.Cells[ACol,ARow]:='-'; exit; end;
if (Sg.Cells[ACol,ARow]='-') and (ARow=5) then
begin
Sg.Cells[ACol,ARow]:='+';
for i:=1 to 4 do
SG.Cells[ACol,i]:='-';
exit;
end;;TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
Form1.Close;;TForm3.BitBtn1Click(Sender: TObject);
i,j:integer;
f:boolean;
f:=true;
for i:=1 to table_c do
begin
for j:=1 to 5 do
begin
if (Sg.Cells[i,j]='+') and (f=false) then
begin
Form4.Memo1.Lines.Add('grand '+Sg.Cells[0,j]+' on '+Sg.Cells[i,0]+' to '+user_n[num_user]);
Form4.Memo1.Lines.Add('');
end;
if (Sg.Cells[i,j]='+') and (f=true) then
begin
Form4.Memo1.Lines.Add('grand '+Sg.Cells[0,j]+' on '+Sg.Cells[i,0]+' to '+user_n[num_user]+' identified by '+user_p[num_user]);
Form4.Memo1.Lines.Add('');
f:=false;
end;
end;
end;
inc(num_user);
if num_user>user_c then begin Hide; Form4.show; end
else begin Hide; Show; end;;.Unit4;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
TForm4 = class(TForm)
Memo1: TMemo;
BitBtn1: TBitBtn;
Label1: TLabel;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
Form4: TForm4;Unit1;
{$R *.dfm}TForm4.FormClose(Sender: TObject; var Action: TCloseAction);
Form1.close;;.