Skip to content

Commit 96717cd

Browse files
committed
feat: support assigning roles to a user or role
Refs #1155
1 parent 02cf4cb commit 96717cd

File tree

5 files changed

+283
-86
lines changed

5 files changed

+283
-86
lines changed

extra/locale/heidisql.po

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: HeidiSQL\n"
99
"POT-Creation-Date: 2012-11-05 21:40\n"
10-
"PO-Revision-Date: 2026-03-20 15:16+0100\n"
10+
"PO-Revision-Date: 2026-03-24 12:08+0100\n"
1111
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
1212
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
1313
"Language: en\n"
@@ -6815,3 +6815,21 @@ msgstr "Folder in path does not exist: %s"
68156815

68166816
msgid "File does not yet exist, will be created now: %s"
68176817
msgstr "File does not yet exist, will be created now: %s"
6818+
6819+
msgid "Create role"
6820+
msgstr "Create role"
6821+
6822+
msgid "Role name"
6823+
msgstr "Role name"
6824+
6825+
msgid "Roles"
6826+
msgstr "Roles"
6827+
6828+
msgid "Assigned"
6829+
msgstr "Assigned"
6830+
6831+
msgid "Yes, with admin option"
6832+
msgstr "Yes, with admin option"
6833+
6834+
msgid "No password hash column available"
6835+
msgstr "No password hash column available"

source/dbstructures.mysql.pas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,6 +3399,8 @@ function TMySqlProvider.GetSql(AId: TQueryId): string;
33993399
qCreateRole: Result := 'CREATE ROLE %s';
34003400
qDropRole: Result := 'DROP ROLE %s';
34013401
qReloadPrivileges: Result := 'FLUSH PRIVILEGES';
3402+
qGrantRole: Result := 'GRANT %s TO %s%s';
3403+
qRevokeRole: Result := 'REVOKE %s FROM %s';
34023404
else Result := inherited;
34033405
end;
34043406
end;

source/dbstructures.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ interface
4848
qForeignKeyDrop, qGetTableColumns, qGetCollations, qGetCollationsExtended, qGetCharsets,
4949
qGetReverseForeignKeys, qExplain, qSetTimezone,
5050
qShowFunctionStatus, qShowProcedureStatus, qShowTriggers, qShowEvents, qShowCreateTrigger,
51-
qHelpKeyword, qShowWarnings, qGetEnumTypes, qDropUser, qCreateRole, qDropRole, qReloadPrivileges);
51+
qHelpKeyword, qShowWarnings, qGetEnumTypes,
52+
qDropUser, qCreateRole, qDropRole, qReloadPrivileges, qGrantRole, qRevokeRole);
5253
TSqlProvider = class
5354
strict protected
5455
FNetType: TNetType;

source/usermanager.lfm

Lines changed: 90 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ object UserManagerForm: TUserManagerForm
1616
OnCloseQuery = FormCloseQuery
1717
OnCreate = FormCreate
1818
OnDestroy = FormDestroy
19-
OnResize = FormResize
2019
OnShow = FormShow
2120
object Splitter1: TSplitter
2221
Cursor = crSizeWE
2322
Left = 229
2423
Height = 328
2524
Top = 0
2625
Width = 8
27-
OnMoved = FormResize
2826
end
2927
object pnlLeft: TPanel
3028
Left = 5
@@ -174,67 +172,6 @@ object UserManagerForm: TUserManagerForm
174172
Constraints.MinWidth = 20
175173
ParentBackground = False
176174
TabOrder = 1
177-
object tlbObjects: TToolBar
178-
Left = 0
179-
Height = 28
180-
Top = 145
181-
Width = 385
182-
AutoSize = True
183-
ButtonHeight = 28
184-
ButtonWidth = 79
185-
Caption = 'tlbObjects'
186-
EdgeBorders = []
187-
Images = MainForm.ImageListMain
188-
List = True
189-
ParentShowHint = False
190-
ShowCaptions = True
191-
ShowHint = True
192-
TabOrder = 1
193-
Wrapable = False
194-
object lblAllowAccessTo: TLabel
195-
Left = 1
196-
Height = 28
197-
Top = 0
198-
Width = 121
199-
AutoSize = False
200-
Caption = 'Allow access to:'
201-
Layout = tlCenter
202-
Transparent = False
203-
end
204-
object btnAddObject: TToolButton
205-
Left = 122
206-
Hint = 'Add object ...'
207-
Top = 0
208-
Caption = 'Add object'
209-
ImageIndex = 45
210-
OnClick = btnAddObjectClick
211-
end
212-
end
213-
object treePrivs: TLazVirtualStringTree
214-
AnchorSideTop.Control = tlbObjects
215-
AnchorSideTop.Side = asrBottom
216-
Left = 0
217-
Height = 150
218-
Top = 173
219-
Width = 385
220-
Align = alClient
221-
Header.AutoSizeIndex = 0
222-
Header.Columns = <>
223-
Header.MainColumn = -1
224-
Images = MainForm.ImageListMain
225-
IncrementalSearch = isAll
226-
TabOrder = 2
227-
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoTristateTracking, toAutoDeleteMovedNodes, toAutoChangeScale]
228-
TreeOptions.MiscOptions = [toAcceptOLEDrop, toCheckSupport, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning, toEditOnClick]
229-
TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowRoot, toShowTreeLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]
230-
OnChecked = treePrivsChecked
231-
OnExpanded = treePrivsExpanded
232-
OnGetText = treePrivsGetText
233-
OnPaintText = treePrivsPaintText
234-
OnGetImageIndex = treePrivsGetImageIndex
235-
OnInitChildren = treePrivsInitChildren
236-
OnInitNode = treePrivsInitNode
237-
end
238175
object PageControlSettings: TPageControl
239176
Left = 0
240177
Height = 145
@@ -589,6 +526,96 @@ object UserManagerForm: TUserManagerForm
589526
end
590527
end
591528
end
529+
object PageControlAccess: TPageControl
530+
Left = 0
531+
Height = 178
532+
Top = 145
533+
Width = 385
534+
ActivePage = tabPrivileges
535+
Align = alClient
536+
TabIndex = 0
537+
TabOrder = 1
538+
object tabPrivileges: TTabSheet
539+
Caption = 'Privileges'
540+
ClientHeight = 150
541+
ClientWidth = 377
542+
object treePrivs: TLazVirtualStringTree
543+
Left = 0
544+
Height = 122
545+
Top = 28
546+
Width = 377
547+
Align = alClient
548+
DefaultText = 'Node'
549+
Header.AutoSizeIndex = 0
550+
Header.Columns = <>
551+
Header.MainColumn = -1
552+
Images = MainForm.ImageListMain
553+
IncrementalSearch = isAll
554+
TabOrder = 0
555+
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoTristateTracking, toAutoDeleteMovedNodes, toAutoChangeScale]
556+
TreeOptions.MiscOptions = [toAcceptOLEDrop, toCheckSupport, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning, toEditOnClick]
557+
TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowRoot, toShowTreeLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]
558+
OnChecked = treePrivsChecked
559+
OnExpanded = treePrivsExpanded
560+
OnGetText = treePrivsGetText
561+
OnPaintText = treePrivsPaintText
562+
OnGetImageIndex = treePrivsGetImageIndex
563+
OnInitChildren = treePrivsInitChildren
564+
OnInitNode = treePrivsInitNode
565+
end
566+
object tlbObjects: TToolBar
567+
Left = 0
568+
Height = 28
569+
Top = 0
570+
Width = 377
571+
AutoSize = True
572+
ButtonHeight = 28
573+
ButtonWidth = 79
574+
Caption = 'tlbObjects'
575+
EdgeBorders = []
576+
Images = MainForm.ImageListMain
577+
List = True
578+
ParentShowHint = False
579+
ShowCaptions = True
580+
ShowHint = True
581+
TabOrder = 1
582+
Wrapable = False
583+
object btnAddObject: TToolButton
584+
Left = 1
585+
Hint = 'Add object ...'
586+
Top = 0
587+
Caption = 'Add object'
588+
ImageIndex = 45
589+
OnClick = btnAddObjectClick
590+
end
591+
end
592+
end
593+
object tabRoles: TTabSheet
594+
Caption = 'Roles'
595+
ClientHeight = 150
596+
ClientWidth = 377
597+
object ValueListEditorRoles: TValueListEditor
598+
Left = 0
599+
Height = 150
600+
Top = 0
601+
Width = 377
602+
Align = alClient
603+
RowCount = 2
604+
TabOrder = 0
605+
OnSelectCell = ValueListEditorRolesSelectCell
606+
OnSetEditText = ValueListEditorRolesSetEditText
607+
TitleCaptions.Strings = (
608+
'Role name'
609+
'Assigned'
610+
)
611+
OnGetPickList = ValueListEditorRolesGetPickList
612+
ColWidths = (
613+
64
614+
309
615+
)
616+
end
617+
end
618+
end
592619
end
593620
object pnlBottom: TPanel
594621
AnchorSideLeft.Control = Owner

0 commit comments

Comments
 (0)