mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Dynamically fetch names of privileges on the "Add user" tab of the usermanager, as discussed on the mailinglist.
TODO: Refactor complete GUI of this dialog, nuke tabs and do both adding and editing users in one GUI.
This commit is contained in:
@@ -16,6 +16,7 @@ object UserManagerForm: TUserManagerForm
|
||||
OldCreateOrder = False
|
||||
Position = poMainFormCenter
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
@@ -166,16 +167,7 @@ object UserManagerForm: TUserManagerForm
|
||||
'Select'
|
||||
'Insert'
|
||||
'Update'
|
||||
'Delete'
|
||||
'Index'
|
||||
'Alter'
|
||||
'Create'
|
||||
'Drop'
|
||||
'References'
|
||||
'Reload'
|
||||
'Shutdown'
|
||||
'Process'
|
||||
'File')
|
||||
'...')
|
||||
TabOrder = 5
|
||||
end
|
||||
object CheckBoxAllPrivileges: TCheckBox
|
||||
|
||||
@@ -61,6 +61,7 @@ type
|
||||
Panel4: TPanel;
|
||||
ButtonEditUser: TButton;
|
||||
Button1: TButton;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure DBUserTreeExpanding(Sender: TObject; Node: TTreeNode;
|
||||
var AllowExpansion: Boolean);
|
||||
procedure FormShow(Sender: TObject);
|
||||
@@ -1018,4 +1019,28 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
|
||||
{**
|
||||
Fetch names of privileges from mysql.users to use them in the checklistbox
|
||||
on the "Add user" page.
|
||||
}
|
||||
procedure TUserManagerForm.FormCreate(Sender: TObject);
|
||||
var
|
||||
Privs: TDataset;
|
||||
PrivName: String;
|
||||
begin
|
||||
Privs := getPrivColumns(PRIVTABLE_USERS);
|
||||
// Add to listbox and cut off "_priv" suffixes
|
||||
CheckListBoxPrivileges.Items.BeginUpdate;
|
||||
CheckListBoxPrivileges.Items.Clear;
|
||||
while not Privs.Eof do begin
|
||||
PrivName := Privs.FieldByName('Field').AsString;
|
||||
// Only add relevant columns
|
||||
if Pos('_priv', PrivName) > 0 then
|
||||
CheckListBoxPrivileges.Items.Add( Copy(PrivName, 1, Length(PrivName)-5) );
|
||||
Privs.Next;
|
||||
end;
|
||||
CheckListBoxPrivileges.Items.EndUpdate;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user