diff --git a/boss-lock.json b/boss-lock.json
new file mode 100644
index 0000000..c952514
--- /dev/null
+++ b/boss-lock.json
@@ -0,0 +1,5 @@
+{
+ "hash": "d41d8cd98f00b204e9800998ecf8427e",
+ "updated": "2021-04-07T22:02:42.8886995-03:00",
+ "installedModules": {}
+}
\ No newline at end of file
diff --git a/boss.json b/boss.json
new file mode 100644
index 0000000..8609a38
--- /dev/null
+++ b/boss.json
@@ -0,0 +1,9 @@
+{
+ "name": "safety4d",
+ "description": "",
+ "version": "1.0.0",
+ "homepage": "",
+ "mainsrc": "./",
+ "projects": [],
+ "dependencies": {}
+}
\ No newline at end of file
diff --git a/samples/Safety4DSample.dpr b/samples/Safety4DSample.dpr
new file mode 100644
index 0000000..78d95a7
--- /dev/null
+++ b/samples/Safety4DSample.dpr
@@ -0,0 +1,15 @@
+program Safety4DSample;
+
+uses
+ Vcl.Forms,
+ Unit1 in 'Unit1.pas' {Form1};
+
+{$R *.res}
+
+begin
+ Application.Initialize;
+ ReportMemoryLeaksOnShutdown := True;
+ Application.MainFormOnTaskbar := True;
+ Application.CreateForm(TForm1, Form1);
+ Application.Run;
+end.
diff --git a/samples/Safety4DSample.dproj b/samples/Safety4DSample.dproj
new file mode 100644
index 0000000..b8e8342
--- /dev/null
+++ b/samples/Safety4DSample.dproj
@@ -0,0 +1,922 @@
+
+
+ {94E1E924-4B2D-49BF-9361-D6402259FADC}
+ 19.2
+ VCL
+ True
+ Debug
+ Win32
+ 1
+ Application
+ Safety4DSample.dpr
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ .\$(Platform)\$(Config)
+ .\$(Platform)\$(Config)
+ false
+ false
+ false
+ false
+ false
+ System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+ Safety4DSample
+
+
+ DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;bindcompvclsmp;emsclientfiredac;tethering;svnui;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;CEF4Delphi;emsedge;fmx;FireDACIBDriver;fmxdae;vcledge;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;TBGWebCharts;IndySystem;FireDACDb2Driver;bindcompvclwinx;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ 1033
+ $(BDS)\bin\default_app.manifest
+
+
+ DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;bindcompvclsmp;emsclientfiredac;tethering;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;DBXOracleDriver;inetdb;CEF4Delphi;emsedge;fmx;FireDACIBDriver;fmxdae;vcledge;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;bindcompvclwinx;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage)
+
+
+ DEBUG;$(DCC_Define)
+ true
+ false
+ true
+ true
+ true
+
+
+ false
+ true
+ PerMonitorV2
+ D:\Projetos\Componentes\RBAC4D\src;$(DCC_UnitSearchPath)
+ true
+ 1033
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+ true
+ PerMonitorV2
+
+
+
+ MainSource
+
+
+
+ dfm
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+ Delphi.Personality.12
+ Application
+
+
+
+ Safety4DSample.dpr
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+ CEF4Delphi
+
+
+
+
+
+ Safety4DSample.exe
+ true
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ classes
+ 1
+
+
+ classes
+ 1
+
+
+
+
+ res\xml
+ 1
+
+
+ res\xml
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\values-v21
+ 1
+
+
+ res\values-v21
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ Contents\MacOS
+ 1
+ .framework
+
+
+ Contents\MacOS
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ Contents\MacOS
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ Contents\Resources\StartUp\
+ 0
+
+
+ Contents\Resources\StartUp\
+ 0
+
+
+ 0
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+ ..\
+ 1
+
+
+ ..\
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+ ..\
+ 1
+
+
+ ..\
+ 1
+
+
+
+
+ Contents
+ 1
+
+
+ Contents
+ 1
+
+
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ library\lib\arm64-v8a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ Contents\MacOS
+ 1
+
+
+ 0
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ False
+
+
+ 12
+
+
+
+
+
diff --git a/samples/Safety4DSample.res b/samples/Safety4DSample.res
new file mode 100644
index 0000000..32a6514
Binary files /dev/null and b/samples/Safety4DSample.res differ
diff --git a/samples/Unit1.dfm b/samples/Unit1.dfm
index e5fd1b5..e4e1502 100644
--- a/samples/Unit1.dfm
+++ b/samples/Unit1.dfm
@@ -2,7 +2,7 @@ object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
- ClientHeight = 574
+ ClientHeight = 846
ClientWidth = 843
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@@ -13,12 +13,12 @@ object Form1: TForm1
OldCreateOrder = False
DesignSize = (
843
- 574)
+ 846)
PixelsPerInch = 96
TextHeight = 13
object GetResources: TButton
- Left = 8
- Top = 49
+ Left = 401
+ Top = 353
Width = 161
Height = 35
Caption = 'GetResources'
@@ -26,20 +26,83 @@ object Form1: TForm1
OnClick = GetResourcesClick
end
object Memo1: TMemo
- Left = 320
+ Left = 8
Top = 8
- Width = 515
- Height = 558
- Anchors = [akLeft, akTop, akRight, akBottom]
+ Width = 387
+ Height = 833
+ Anchors = [akLeft, akTop, akBottom]
Lines.Strings = (
- 'Memo1')
+ '{'
+ ' "resources": {'
+ ' "safety4d": {'
+ ' "users": {'
+ ' "actions": {'
+ ' "read": {'
+ ' "description": "read-only",'
+ ' "errormsg": "not permit"'
+ ' },'
+ ' "write": {'
+ ' "description": "read-write",'
+ ' "errormsg": "not write data"'
+ ' },'
+ ' "delete": {'
+ ' "description": "delete-data",'
+ ' "errormsg": "not delete data"'
+ ' },'
+ ' "view": {'
+ ' "description": "view data",'
+ ' "errormsg": "not view data"'
+ ' }'
+ ' }'
+ ' }'
+ ' }'
+ ' },'
+ ' "groupPermission": {'
+ ' "{4D62E4C3-C73D-488A-8518-03A9545B5611}": {'
+ ' "key": "Gerente",'
+
+ ' "description": "Permissoes completa de gestao do Sis' +
+ 'tema",'
+ ' "Actions": ['
+ ' "users.write"'
+ ' ],'
+ ' "NotActions": ['
+ ' "*"'
+ ' ]'
+ ' },'
+ ' "{C188D1AB-EC28-4380-96E0-D1B13A29A8B3}": {'
+ ' "key": "Comercial",'
+ ' "description": "Permissoes de Recursos Comerciais",'
+ ' "Actions": ['
+ ' "*"'
+ ' ],'
+ ' "NotActions": ['
+ ' "users.delete",'
+ ' "users.write"'
+ ' ]'
+ ' }'
+ ' },'
+ ' "userKeys": {'
+ ' "{34C940ED-50E7-4CE3-B701-03CF1E15F28B}": {'
+ ' "description": "Fulano de Tal",'
+ ' "permissionGroups": ['
+ ' "{4D62E4C3-C73D-488A-8518-03A9545B5611}"'
+ ' ]'
+ ' },'
+ ' "{96B4C46F-0EBB-443B-B309-09C81844406E}": {'
+ ' "description": "Beltrano",'
+ ' "permissionGroups": ['
+ ' "{C188D1AB-EC28-4380-96E0-D1B13A29A8B3}"'
+ ' ]'
+ ' }'
+ ' }'
+ '}')
+ ScrollBars = ssVertical
TabOrder = 1
- ExplicitWidth = 451
- ExplicitHeight = 438
end
object Button1: TButton
- Left = 8
- Top = 90
+ Left = 401
+ Top = 394
Width = 161
Height = 35
Caption = 'CreateGroupPermission'
@@ -47,8 +110,8 @@ object Form1: TForm1
OnClick = Button1Click
end
object Button2: TButton
- Left = 8
- Top = 174
+ Left = 568
+ Top = 271
Width = 161
Height = 35
Caption = 'RegisterUserKeys'
@@ -56,8 +119,8 @@ object Form1: TForm1
OnClick = Button2Click
end
object Button3: TButton
- Left = 8
- Top = 231
+ Left = 568
+ Top = 312
Width = 161
Height = 35
Caption = 'GetSafety4DConfig'
@@ -65,8 +128,8 @@ object Form1: TForm1
OnClick = Button3Click
end
object Button4: TButton
- Left = 8
- Top = 8
+ Left = 401
+ Top = 312
Width = 161
Height = 35
Caption = 'RegisterResource'
@@ -74,8 +137,8 @@ object Form1: TForm1
OnClick = Button4Click
end
object Button5: TButton
- Left = 8
- Top = 295
+ Left = 568
+ Top = 353
Width = 161
Height = 35
Caption = 'SaveSafety4DConfig'
@@ -83,8 +146,8 @@ object Form1: TForm1
OnClick = Button5Click
end
object Button6: TButton
- Left = 8
- Top = 359
+ Left = 568
+ Top = 394
Width = 161
Height = 35
Caption = 'LoadSafety4DConfig'
@@ -92,29 +155,82 @@ object Form1: TForm1
OnClick = Button6Click
end
object Button7: TButton
- Left = 8
- Top = 131
+ Left = 401
+ Top = 435
Width = 161
Height = 35
Caption = 'GetGroupsPermissions'
TabOrder = 8
OnClick = Button7Click
end
- object Button8: TButton
- Left = 48
- Top = 464
- Width = 121
- Height = 25
- Caption = 'Button8'
+ object GroupBox1: TGroupBox
+ Left = 401
+ Top = 8
+ Width = 434
+ Height = 257
+ Caption = 'Validar Permiss'#227'o'
TabOrder = 9
- OnClick = Button8Click
+ object edtUserKey: TLabeledEdit
+ Left = 16
+ Top = 40
+ Width = 401
+ Height = 21
+ EditLabel.Width = 40
+ EditLabel.Height = 13
+ EditLabel.Caption = 'UserKey'
+ TabOrder = 0
+ Text = '{34C940ED-50E7-4CE3-B701-03CF1E15F28B}'
+ end
+ object edtApplication: TLabeledEdit
+ Left = 16
+ Top = 80
+ Width = 401
+ Height = 21
+ EditLabel.Width = 52
+ EditLabel.Height = 13
+ EditLabel.Caption = 'Application'
+ TabOrder = 1
+ Text = 'safety4d'
+ end
+ object edtResource: TLabeledEdit
+ Left = 16
+ Top = 120
+ Width = 401
+ Height = 21
+ EditLabel.Width = 45
+ EditLabel.Height = 13
+ EditLabel.Caption = 'Resource'
+ TabOrder = 2
+ Text = 'users'
+ end
+ object edtAction: TLabeledEdit
+ Left = 16
+ Top = 160
+ Width = 401
+ Height = 21
+ EditLabel.Width = 30
+ EditLabel.Height = 13
+ EditLabel.Caption = 'Action'
+ TabOrder = 3
+ Text = 'delete'
+ end
+ object Button8: TButton
+ Left = 216
+ Top = 200
+ Width = 202
+ Height = 33
+ Caption = 'Validar Permiss'#227'o'
+ TabOrder = 4
+ OnClick = Button8Click
+ end
end
- object Edit1: TEdit
- Left = 48
- Top = 437
- Width = 121
- Height = 21
+ object Button9: TButton
+ Left = 401
+ Top = 271
+ Width = 161
+ Height = 35
+ Caption = 'RegisterApplication'
TabOrder = 10
- Text = 'delete'
+ OnClick = Button4Click
end
end
diff --git a/samples/Unit1.pas b/samples/Unit1.pas
index 9fcaaa8..63e440c 100644
--- a/samples/Unit1.pas
+++ b/samples/Unit1.pas
@@ -12,7 +12,7 @@ uses
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
- Vcl.StdCtrls;
+ Vcl.StdCtrls, Vcl.ExtCtrls;
type
TForm1 = class(TForm)
@@ -25,8 +25,13 @@ type
Button5: TButton;
Button6: TButton;
Button7: TButton;
+ GroupBox1: TGroupBox;
+ edtUserKey: TLabeledEdit;
+ edtApplication: TLabeledEdit;
+ edtResource: TLabeledEdit;
+ edtAction: TLabeledEdit;
Button8: TButton;
- Edit1: TEdit;
+ Button9: TButton;
procedure GetResourcesClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
@@ -42,6 +47,8 @@ type
procedure _GetResources;
procedure _GetGroupsPermissions;
procedure _GetUserKeys;
+ procedure __ReloadConfig;
+ procedure __ReWriteMemoConfig;
public
{ Public declarations }
end;
@@ -71,7 +78,7 @@ begin
.getGroups(aJsonSafety4D);
Memo1.Lines.Clear;
- Memo1.Lines.Add(TJson.Format(aJsonSafety4D));
+ Memo1.Lines.Add(aJsonSafety4D.Format);
finally
aJsonSafety4D.Free;
end;
@@ -90,7 +97,7 @@ begin
.getResource(aJsonSafety4D);
Memo1.Lines.Clear;
- Memo1.Lines.Add(TJson.Format(aJsonSafety4D));
+ Memo1.Lines.Add(aJsonSafety4D.Format);
finally
aJsonSafety4D.Free;
end;
@@ -108,66 +115,44 @@ begin
.getUserKey(aJsonSafety4D);
Memo1.Lines.Clear;
- Memo1.Lines.Add(TJson.Format(aJsonSafety4D));
+ Memo1.Lines.Add(aJsonSafety4D.Format);
finally
aJsonSafety4D.Free;
end;
end;
+procedure TForm1.__ReloadConfig;
+var
+ aJson : TJsonObject;
+begin
+ vSafety4D := nil;
+ aJson := TJSONObject.ParseJSONValue(Memo1.Lines.Text) as TJsonObject;
+ try
+ TSafety4D
+ .New
+ .LoadConfig(aJson);
+ finally
+ aJson.Free;
+ end;
+end;
+
+procedure TForm1.__ReWriteMemoConfig;
+var
+ aJsonConfig : TJsonObject;
+begin
+ Memo1.Lines.Clear;
+ aJsonConfig := TJsonObject.Create;
+ try
+ TSafety4D.New.getConfig(aJsonConfig);
+ Memo1.Lines.Add(aJsonConfig.Format);
+ finally
+ aJsonConfig.Free;
+ end;
+end;
+
procedure TForm1.GetResourcesClick(Sender: TObject);
begin
_GetResources;
-
- {*
- TRbac4D
- .New
-
- //Como registrar os recursos
- //Default Resource [view, read, write, delete, action]
-
- //>>;
-
-
-
-
- //Buscar grupo de permissões
- TRbac4D
- .New
- .getFunctionDefinitions; //TArray
-
-
- //Busar Resources
- TRbac4D
- .New
- .getResourcesGroup('GroupName'); //TArray
-
-
- //Como validar o acesso a um recurso
- TRbac4D
- .New
- .validateAccess
- .roleName('operador')
- .group('housex')
- .provider('user')
- .resource('Actions.getSaldo')
- .Execute; //Boolean
-
-
- //Atribuir as Roles na instancia global
- TRbac4D
- .New
- .roleName('operador|marketing|gerente');
-
-
- TRbac4D
- .New
- .loadConfiguration(aJsonString);
-
- TRbac4D
- .New
- .saveConfiguration; //Retorna JsonString;
-
- *}
end;
procedure TForm1.Button1Click(Sender: TObject);
@@ -228,7 +213,7 @@ begin
TSafety4D.New.getConfig(aJsonSafety4D);
Memo1.Lines.Clear;
- Memo1.Lines.Add(TJson.Format(aJsonSafety4D));
+ Memo1.Lines.Add(aJsonSafety4D.Format);
finally
aJsonSafety4D.Free;
end;
@@ -237,7 +222,35 @@ end;
procedure TForm1.Button4Click(Sender: TObject);
begin
- RegisterResources;
+ TSafety4D
+ .New
+ .resources
+ .registerResources
+ .resourcesGroupName
+ .add('newapplication')
+ .providerName
+ .add('users')
+ .actions
+ .add('read')
+ .description('read-only')
+ .errormsg('not permit')
+ .&end
+ .add('write')
+ .description('read-write')
+ .errormsg('not write data')
+ .&end
+ .add('delete')
+ .description('delete-data')
+ .errormsg('not delete data')
+ .&end
+ .add('view')
+ .description('view data')
+ .errormsg('not view data')
+ .&end
+ .&end
+ .&end;
+
+ __ReWriteMemoConfig;
end;
procedure TForm1.Button5Click(Sender: TObject);
@@ -266,13 +279,17 @@ end;
procedure TForm1.Button8Click(Sender: TObject);
begin
+ __ReloadConfig;
try
TSafety4D.New
+ .configurations
+ .exceptions(True)
+ .&end
.Validation
- .userKey('{34C940ED-50E7-4CE3-B701-03CF1E15F28B}')
- .application('delphitohero')
- .resource('users')
- .action(edit1.Text)
+ .userKey(edtUserKey.Text)
+ .application(edtApplication.Text)
+ .resource(edtResource.Text)
+ .action(edtAction.Text)
.validate;
ShowMessage('Usuario Autorizado');
except on e : Exception do
@@ -282,36 +299,7 @@ end;
procedure TForm1.RegisterResources;
begin
- TSafety4D
- .New
- .resources
- .registerResources
- .resourcesGroupName
- .add('delphitohero')
- .providerName
- .add('users')
- .actions
- .add('read')
- .description('read-only')
- .errormsg('not permit')
- .&end
- .add('write')
- .description('read-write')
- .errormsg('not write data')
- .&end
- .add('delete')
- .description('delete-data')
- .errormsg('not delete data')
- .&end
- .add('view')
- .description('view data')
- .errormsg('not view data')
- .&end
- .&end
- .&end
- .&end
- .&end
- .&end;
+
end;
end.
diff --git a/samples/Win32/Debug/RbacSample.s4d b/samples/Win32/Debug/RbacSample.s4d
new file mode 100644
index 0000000..3a44e20
--- /dev/null
+++ b/samples/Win32/Debug/RbacSample.s4d
@@ -0,0 +1,63 @@
+{
+ "resources": {
+ "delphitohero": {
+ "users": {
+ "actions": {
+ "read": {
+ "description": "read-only",
+ "errormsg": "not permit"
+ },
+ "write": {
+ "description": "read-write",
+ "errormsg": "not write data"
+ },
+ "delete": {
+ "description": "delete-data",
+ "errormsg": "not delete data"
+ },
+ "view": {
+ "description": "view data",
+ "errormsg": "not view data"
+ }
+ }
+ }
+ }
+ },
+ "groupPermission": {
+ "{4D62E4C3-C73D-488A-8518-03A9545B5611}": {
+ "key": "Gerente",
+ "description": "Permiss�es completa de gest�o do Sistema",
+ "Actions": [
+ "users.write"
+ ],
+ "NotActions": [
+ "*"
+ ]
+ },
+ "{C188D1AB-EC28-4380-96E0-D1B13A29A8B3}": {
+ "key": "Comercial",
+ "description": "Permiss�es de Recursos Comerciais",
+ "Actions": [
+ "*"
+ ],
+ "NotActions": [
+ "users.delete",
+ "users.write"
+ ]
+ }
+ },
+ "userKeys": {
+ "{34C940ED-50E7-4CE3-B701-03CF1E15F28B}": {
+ "description": "Fulano de Tal",
+ "permissionGroups": [
+ "{4D62E4C3-C73D-488A-8518-03A9545B5611}"
+ ]
+ },
+ "{96B4C46F-0EBB-443B-B309-09C81844406E}": {
+ "description": "Beltrano",
+ "permissionGroups": [
+ "{C188D1AB-EC28-4380-96E0-D1B13A29A8B3}"
+ ]
+ }
+ }
+}
diff --git a/src/Safety4D.Configuration.pas b/src/Safety4D.Configuration.pas
new file mode 100644
index 0000000..d55eb67
--- /dev/null
+++ b/src/Safety4D.Configuration.pas
@@ -0,0 +1,61 @@
+unit Safety4D.Configuration;
+
+interface
+
+uses
+ Safety4D.Interfaces;
+
+type
+ TSafety4DConfiguration = class(TInterfacedObject, iSafety4DConfiguration)
+ private
+ [weak]
+ FParent : iSafety4D;
+ FException : Boolean;
+ public
+ constructor Create(aParent : iSafety4D);
+ destructor Destroy; override;
+ class function New(aParent : iSafety4D) : iSafety4DConfiguration;
+ function exceptions( aValue : Boolean ) : iSafety4DConfiguration; overload;
+ function exceptions : boolean; overload;
+ function &End : iSafety4D;
+ end;
+
+implementation
+
+{ TSafety4DConfiguration }
+
+function TSafety4DConfiguration.&end : iSafety4D;
+begin
+ Result := FParent;
+end;
+
+function TSafety4DConfiguration.exceptions: boolean;
+begin
+ Result := FException;
+end;
+
+function TSafety4DConfiguration.exceptions(
+ aValue: Boolean): iSafety4DConfiguration;
+begin
+ Result := Self;
+ FException := aValue;
+end;
+
+constructor TSafety4DConfiguration.Create(aParent : iSafety4D);
+begin
+ FParent := aParent;
+ FException := False;
+end;
+
+destructor TSafety4DConfiguration.Destroy;
+begin
+
+ inherited;
+end;
+
+class function TSafety4DConfiguration.New(aParent : iSafety4D): iSafety4DConfiguration;
+begin
+ Result := Self.Create(aParent);
+end;
+
+end.
diff --git a/src/Safety4D.Groups.pas b/src/Safety4D.Groups.pas
index 03d39fc..26ba3de 100644
--- a/src/Safety4D.Groups.pas
+++ b/src/Safety4D.Groups.pas
@@ -43,11 +43,10 @@ function TSafety4DGroups.getGroups(
var aJson: TJsonObject): iSafety4DGroup;
var
aJsonActions : TJsonArray;
- aJsonGroups : TJsonObject;
aJsonGroup : TJsonObject;
begin
Result := Self;
- for var group in FgroupRegister.getGroupsRegisters do
+ for var group in groupRegister.getGroupsRegisters do
begin
aJson.AddPair(group.Key, TJsonObject.Create);
aJsonGroup := aJson.GetValue(group.Key);
diff --git a/src/Safety4D.Interfaces.pas b/src/Safety4D.Interfaces.pas
index 03ee417..4420f67 100644
--- a/src/Safety4D.Interfaces.pas
+++ b/src/Safety4D.Interfaces.pas
@@ -16,6 +16,7 @@ type
iSafety4DGroup = interface;
iSafety4DUserKey = interface;
iSafety4DValidation = interface;
+ iSafety4DConfiguration = interface;
iSafety4D = interface
@@ -23,12 +24,20 @@ type
function Validation : iSafety4DValidation;
function resources : iSafety4DResources;
function groupPermission : iSafety4DGroup;
+ function configurations : iSafety4DConfiguration;
function userKey : iSafety4DUserKey;
function getConfig (var aJson : TJsonObject ) : iSafety4D;
function SaveToStorage ( aPath : String = '' ) : iSafety4D;
function LoadConfig ( aJson : TJsonObject ) : iSafety4D;
end;
+ iSafety4DConfiguration = interface
+ ['{E5561A2B-42D5-4A53-9EE6-57C1882C610D}']
+ function exceptions( aValue : Boolean ) : iSafety4DConfiguration; overload;
+ function exceptions : boolean; overload;
+ function &end : iSafety4D;
+ end;
+
iSafety4DValidation = interface
['{3EB75190-778C-4E0B-ABE7-A17A78103C5B}']
function userKey( aValue : String ) : iSafety4DValidation; overload;
diff --git a/src/Safety4D.Resources.Group.Provider.Actions.pas b/src/Safety4D.Resources.Group.Provider.Actions.pas
index e509505..d9cbf3e 100644
--- a/src/Safety4D.Resources.Group.Provider.Actions.pas
+++ b/src/Safety4D.Resources.Group.Provider.Actions.pas
@@ -12,7 +12,6 @@ type
[weak]
FParent : iSafety4DResourcesGroupProvider;
FActionList : TDictionary;
- FActionsMsg : iSafety4DResourcesGroupProviderActionsMsg;
public
constructor Create(aParent : iSafety4DResourcesGroupProvider);
destructor Destroy; override;
diff --git a/src/Safety4D.Resources.Group.Provider.pas b/src/Safety4D.Resources.Group.Provider.pas
index 06617fb..cf2783f 100644
--- a/src/Safety4D.Resources.Group.Provider.pas
+++ b/src/Safety4D.Resources.Group.Provider.pas
@@ -50,13 +50,6 @@ begin
Result := Self;
FProviderName := aValue;
FProviderNameList.Add(aValue, TSafety4DResourcesGroupProviderActions.New(Self));
-// FProviderNameList
-// .Items[aValue]
-// .add('*')
-// .add('read')
-// .add('write')
-// .add('delete')
-// .add('view');
end;
constructor TSafety4DResourcesGroupProvider.Create(aParent : iSafety4DResourcesGroup);
diff --git a/src/Safety4D.Resources.Register.pas b/src/Safety4D.Resources.Register.pas
index 343e5df..7372090 100644
--- a/src/Safety4D.Resources.Register.pas
+++ b/src/Safety4D.Resources.Register.pas
@@ -35,7 +35,7 @@ end;
function TSafety4DResourcesRegister.getResourceGroups: TDictionary;
begin
- Result := FResourceGroupName.getResourcesGroupList;
+ Result := resourcesGroupName.getResourcesGroupList;
end;
constructor TSafety4DResourcesRegister.Create(aParent : iSafety4DResources);
diff --git a/src/Safety4D.Resources.pas b/src/Safety4D.Resources.pas
index 5fd3f56..a2b1505 100644
--- a/src/Safety4D.Resources.pas
+++ b/src/Safety4D.Resources.pas
@@ -40,31 +40,43 @@ var
iResourceActions : iSafety4DResourcesGroupProviderActions;
iActionMessage : iSafety4DResourcesGroupProviderActionsMsg;
begin
- Result := False;
+ Result := True;
- if not FRegisterResources.getResourceGroups.TryGetValue(aApplication, iResource) then
- raise Exception.Create('Unregistered Application');
+ if not registerResources.getResourceGroups.TryGetValue(aApplication, iResource) then
+ begin
+ Result := False;
+ if FParent.configurations.exceptions then
+ raise Exception.Create('Unregistered Application');
+ exit;
+ end;
if not iResource.getProviderNames.TryGetValue(aResource, iResourceActions) then
- raise Exception.Create('Unregistered resource');
+ begin
+ Result := False;
+ if FParent.configurations.exceptions then
+ raise Exception.Create('Unregistered resource');
+ exit;
+ end;
if not iResourceActions.getActions.TryGetValue(aAction, iActionMessage) then
- raise Exception.Create('unregistered action');
+ begin
+ Result := False;
+ if FParent.configurations.exceptions then
+ raise Exception.Create('unregistered action');
+ exit;
+ end;
end;
function TSafety4DResources.getResource(
var aJson: TJsonObject): iSafety4DResources;
var
- aJsonResources : TJsonObject;
aJsonGroup : TJsonObject;
aJsonProvider : TJsonObject;
aJsonActions : TJsonObject;
begin
Result := Self;
- //aJson.AddPair('resources', TJSONArray.Create.Add(TJSONObject.Create));
- for var Resource in FRegisterResources.getResourceGroups do
+ for var Resource in registerResources.getResourceGroups do
begin
- //aJsonResources := (aJson.GetValue('resources').Items[0] as TJsonObject);
aJson.AddPair(Resource.Key, TJSONObject.Create);
for var Provider in Resource.Value.getProviderNames do
begin
diff --git a/src/Safety4D.UserKey.pas b/src/Safety4D.UserKey.pas
index c125d0f..1100f18 100644
--- a/src/Safety4D.UserKey.pas
+++ b/src/Safety4D.UserKey.pas
@@ -38,8 +38,13 @@ function TSafety4DUserKey.exists(aUserKey: String): Boolean;
var
iUser : iSafety4DUserKeyRegisterGroupPermission;
begin
+ Result := True;
if not FRegisterUserKey.GetUserKeyRegister.TryGetValue(aUserKey, iUser) then
- raise Exception.Create('User key not registered');
+ begin
+ Result := False;
+ if FParent.configurations.exceptions then
+ raise Exception.Create('User key not registered');
+ end;
end;
function TSafety4DUserKey.getUserKey(var aJson: TJsonObject): iSafety4DUserKey;
@@ -47,7 +52,7 @@ var
aJsonRegister : TJsonObject;
aJsonPermission : TJsonArray;
begin
- for var userRegister in FRegisterUserKey.GetUserKeyRegister do
+ for var userRegister in registerUserKey.GetUserKeyRegister do
begin
aJson.AddPair(userRegister.Key, TJsonObject.Create);
aJsonRegister := aJson.GetValue(userRegister.Key);
diff --git a/src/Safety4D.Validation.pas b/src/Safety4D.Validation.pas
index f690cdb..3395bac 100644
--- a/src/Safety4D.Validation.pas
+++ b/src/Safety4D.Validation.pas
@@ -104,7 +104,6 @@ end;
function TSafety4DValidation.validate: boolean;
var
- aTeste : String;
FAllAcess : Boolean;
FAllBlock : Boolean;
iGroupPermission : iSafety4DGroupListActions;
@@ -118,7 +117,6 @@ begin
for var UserPermission in FParent.userKey.getUserKeyPermissions(FuserKey) do
begin
- aTeste := UserPermission;
iGroupPermission := FParent.groupPermission.getGroupPermission(UserPermission);
for var aAction in iGroupPermission.actions.getActions do
@@ -136,7 +134,8 @@ begin
for var aNotAction in iGroupPermission.notActions.getNotActions do
begin
if UpperCase(aNotAction) = UpperCase(FResource+'.'+FAction) then
- raise Exception.Create('Access not allowed to these resources');
+ if FParent.configurations.exceptions then
+ raise Exception.Create('Access not allowed to these resources');
if aNotAction = '*' then
FAllBlock := True;
@@ -144,7 +143,8 @@ begin
if not Result and FAllAcess then Result := FAllAcess;
if not Result and FAllBlock then
- raise Exception.Create('Access not allowed to these resources');
+ if FParent.configurations.exceptions then
+ raise Exception.Create('Access not allowed to these resources');
end;
except on e : Exception do
raise Exception.Create(e.Message);
diff --git a/src/Safety4D.pas b/src/Safety4D.pas
index 02a6353..0fbb129 100644
--- a/src/Safety4D.pas
+++ b/src/Safety4D.pas
@@ -3,7 +3,9 @@ unit Safety4D;
interface
uses
- Safety4D.Interfaces, System.JSON;
+ Safety4D.Interfaces,
+ System.JSON,
+ System.Generics.Collections;
type
TSafety4D = class(TInterfacedObject, iSafety4D)
@@ -12,6 +14,7 @@ type
FGroupPermission : iSafety4DGroup;
FuserKey : iSafety4DUserKey;
FValidation : iSafety4DValidation;
+ FConfigurations : iSafety4DConfiguration;
procedure __loadResourcesJson(var aJson : TJsonObject);
procedure __loadGroupPermissionJson(var aJson : TJsonObject);
procedure __loadUserKeysJson(var aJson : TJsonObject);
@@ -22,6 +25,7 @@ type
function Validation : iSafety4DValidation;
function resources : iSafety4DResources;
function groupPermission : iSafety4DGroup;
+ function configurations : iSafety4DConfiguration;
function userKey : iSafety4DUserKey;
function getConfig (var aJson : TJsonObject ) : iSafety4D;
function SaveToStorage ( aPath : String = '' ) : iSafety4D;
@@ -40,10 +44,18 @@ uses
Safety4D.UserKey,
System.SysUtils,
System.Classes,
- Rest.Json, Safety4D.Validation;
+ Rest.Json, Safety4D.Validation, Safety4D.Configuration;
{ TSafety4D }
+function TSafety4D.configurations: iSafety4DConfiguration;
+begin
+ if not Assigned(FConfigurations) then
+ FConfigurations := TSafety4DConfiguration.New(Self);
+
+ Result := FConfigurations;
+end;
+
constructor TSafety4D.Create;
begin
@@ -67,9 +79,9 @@ begin
aResource := aJson.GetValue('resources');
aGroup := aJson.GetValue('groupPermission');
aUser := aJson.GetValue('userKeys');
- FResources.getResource(aResource);
- FGroupPermission.getGroups(aGroup);
- FuserKey.getUserKey(aUser);
+ resources.getResource(aResource);
+ groupPermission.getGroups(aGroup);
+ userKey.getUserKey(aUser);
end;
function TSafety4D.groupPermission: iSafety4DGroup;
@@ -125,7 +137,7 @@ begin
StrList := TStringList.Create;
try
Self.getConfig(aJsonResult);
- StrList.Add(TJson.Format(aJsonResult));
+ StrList.Add(aJsonResult.Format);
StrList.SaveToFile(aPath);
finally
StrList.DisposeOf;
@@ -162,8 +174,8 @@ var
begin
for I := 0 to Pred(aJson.Count) do
begin
- FGroupName := aJson.Get(I).JsonString.Value;
- aJsonGroup := aJson.Get(I).JsonValue as TJsonObject;
+ FGroupName := aJson.Pairs[I].JsonString.Value;
+ aJsonGroup := aJson.Pairs[I].JsonValue as TJsonObject;
aJsonActions := aJsonGroup.GetValue('Actions');
aJsonNotActions := aJsonGroup.GetValue('NotActions');
@@ -177,14 +189,14 @@ begin
for X := 0 to Pred(aJsonActions.Count) do
begin
- iAction.add(aJsonActions.Get(X).Value);
+ iAction.add(aJsonActions.Items[X].Value);
end;
iNotAction := iAction.&end.notActions;
for X := 0 to Pred(aJsonNotActions.Count) do
begin
- iNotAction.add(aJsonNotActions.Get(X).Value);
+ iNotAction.add(aJsonNotActions.Items[X].Value);
end;
end;
end;
@@ -203,12 +215,12 @@ var
begin
for I := 0 to Pred(aJson.Count) do
begin
- FGroupName := aJson.Get(I).JsonString.Value;
- aJsonGroup := aJson.Get(I).JsonValue as TJSONObject;
+ FGroupName := aJson.Pairs[I].JsonString.Value;
+ aJsonGroup := aJson.Pairs[I].JsonValue as TJSONObject;
for J := 0 to Pred(aJsonGroup.Count) do
begin
- FProviderName := aJsonGroup.Get(J).JsonString.Value;
- aJsonProvider := aJsonGroup.Get(I).JsonValue as TJSONObject;
+ FProviderName := aJsonGroup.Pairs[J].JsonString.Value;
+ aJsonProvider := aJsonGroup.Pairs[I].JsonValue as TJSONObject;
aJsonActions := aJsonProvider.GetValue('actions');
iProviderAction :=
@@ -223,9 +235,9 @@ begin
for K := 0 to Pred(aJsonActions.Count) do
begin
iProviderAction
- .add(aJsonActions.Get(K).JsonString.Value)
- .description(aJsonActions.Get(K).JsonValue.GetValue('description'))
- .errormsg(aJsonActions.Get(K).JsonValue.GetValue('errormsg'))
+ .add(aJsonActions.Pairs[K].JsonString.Value)
+ .description(aJsonActions.Pairs[K].JsonValue.GetValue('description'))
+ .errormsg(aJsonActions.Pairs[K].JsonValue.GetValue('errormsg'))
end;
end;
end;
@@ -242,8 +254,8 @@ var
begin
for I := 0 to Pred(aJson.Count) do
begin
- FGroupName := aJson.Get(I).JsonString.Value;
- aJsonGroup := aJson.Get(I).JsonValue as TJsonObject;
+ FGroupName := aJson.Pairs[I].JsonString.Value;
+ aJsonGroup := aJson.Pairs[I].JsonValue as TJsonObject;
aJsonPermission := aJsonGroup.GetValue('permissionGroups');
iPermissionGroup :=
@@ -254,7 +266,7 @@ begin
for X := 0 to Pred(aJsonPermission.Count) do
begin
- iPermissionGroup.addPermission(aJsonPermission.Get(X).Value);
+ iPermissionGroup.addPermission(aJsonPermission.Items[X].Value);
end;
end;
end;