mirror of
https://github.com/CloudDelphi/safety4d.git
synced 2025-12-19 09:53:52 +01:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86bf2421c7 | ||
|
|
883c678724 | ||
|
|
8ba61f3312 | ||
|
|
74797d04cd | ||
|
|
24f0e4d8d4 | ||
|
|
a07d74b426 | ||
|
|
7791cbc5d3 | ||
|
|
9b332b0461 | ||
|
|
31e32a8560 | ||
|
|
3db01ca540 | ||
|
|
db9a46dd9f | ||
|
|
9ccc0ffcb9 | ||
|
|
97caaa734a | ||
|
|
04d38189fd | ||
|
|
0fb40233d7 | ||
|
|
7332bb83fb |
365
README.md
365
README.md
@ -14,9 +14,368 @@
|
||||
<img src="https://tokei.rs/b1/github/bittencourtthulio/safety4d?color=yellow&category=files">
|
||||
</p>
|
||||
|
||||
# Router4Delphi
|
||||
Framework para Controle de Regras de Acesso do Usuários inspirado no conceito RBAC.
|
||||
# Safety4D
|
||||
Framework para Controle de Regras de Acesso de Usuários inspirado no conceito RBAC.
|
||||
|
||||
|
||||
### About the name
|
||||
This is called safety and not security intentionally because its creator wanted it that way.
|
||||
|
||||
## Instalação
|
||||
Basta registrar no Library Path do seu Delphi o caminho da pasta SRC da Biblioteca ou utilizar o Boss (https://github.com/HashLoad/boss) para facilitar ainda mais, executando o comando
|
||||
|
||||
Basta registrar no Library Path do seu Delphi o caminho da pasta SRC da Biblioteca
|
||||
```
|
||||
boss install https://github.com/bittencourtthulio/safety4d
|
||||
```
|
||||
|
||||
## Primeiros Passos - Tutorial
|
||||
|
||||
Para utilizar o Safety4D você deve adicionar a uses
|
||||
|
||||
```
|
||||
Safety4D
|
||||
```
|
||||
|
||||
### Como funciona
|
||||
|
||||
O Safety4D foi baseado no conceito de RBAC ( role-based access control) https://pt.wikipedia.org/wiki/Controle_de_acesso_baseado_em_fun%C3%A7%C3%B5es
|
||||
|
||||
Ele se baseia em uma estrutura JSON de configuração para definição das permissões, inspirada na estrutura utilizada pelo Windows Azure.
|
||||
|
||||
https://docs.microsoft.com/pt-br/azure/role-based-access-control/overview
|
||||
|
||||
Abaixo o exemplo de um arquivo de configuração
|
||||
|
||||
```JSON
|
||||
{
|
||||
"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 Sistema",
|
||||
"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}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Explicando a Estrutura
|
||||
|
||||
Abaixo vou detalhar cada bloco do JSON acima explicando o objetivo e a aplicação de cada recurso.
|
||||
|
||||
|
||||
### Resources
|
||||
|
||||
Neste bloco você vai cadastrar a sua aplicação, os recursos dela e as ações que você deseja validar.
|
||||
|
||||
```JSON
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
No exemplo acima, estamos cadastrando a aplicação chamada <b>safety4d</b>, o recursos chamados <b>users</b> e as ações disponíveis neste recurso <b> read, write, delete, view </b>.
|
||||
Você pode cadastrar quantas ações desejar para um recurso.
|
||||
|
||||
### Group Permission
|
||||
|
||||
Neste bloco você cria os grupos de permissão que serão atribuidos aos usuários, definindo quais recursos e actions podem e não podem ser acessados pelos usuários do grupo.
|
||||
|
||||
No bloco <b>Actions</b> você define todos os recursos e actions que os participantes do grupo terão acesso, e no bloco <b>NotActions</b> você define todos os recursos e actions que estarão bloqueados para os participantes do grupo.
|
||||
|
||||
Utilizando o caracter <b>"*"</b> no bloco <b>Actions</b> você está liberando o acesso a todos os recursos exceto aqueles que estiverem especificados na sessão <b>NotActions</b>.
|
||||
|
||||
Utilizando o caracter <b>"*"</b> no bloco <b>NotActions</b> você está bloqueando o acesso a todos os recursos exceto aqueles que estiverem especificados na sessão <b>Actions</b>.
|
||||
|
||||
```JSON
|
||||
"groupPermission": {
|
||||
"{4D62E4C3-C73D-488A-8518-03A9545B5611}": {
|
||||
"key": "Gerente",
|
||||
"description": "Permissoes completa de gestao do Sistema",
|
||||
"Actions": [
|
||||
"users.write"
|
||||
],
|
||||
"NotActions": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
"{C188D1AB-EC28-4380-96E0-D1B13A29A8B3}": {
|
||||
"key": "Comercial",
|
||||
"description": "Permissoes de Recursos Comerciais",
|
||||
"Actions": [
|
||||
"*"
|
||||
],
|
||||
"NotActions": [
|
||||
"users.delete",
|
||||
"users.write"
|
||||
]
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
No exemplo acima cadastramos 2 grupos de permissões distindos, no primeiro grupo <b>Gerente</b> definimos em <b>Actions</b> que os participantes desse grupo só podem acessar o recurso <b>users</b> executando a ação <b>write</b> e o caracter <b>"*"</b> na sessão <b>NotActions</b> sinaliza que todas as demais funções estão bloqueadas.
|
||||
|
||||
No segundo grupo todas as <b>Actions</b> estão liberadas, exceto as que estão descritas no bloco <b>NotActions</b>.
|
||||
|
||||
|
||||
### User Keys
|
||||
|
||||
Neste bloco você cadastra as chaves referentes aos usuários do sistema, atribuindo a eles as keys dos Grupos de Permissões que ele participa.
|
||||
|
||||
```JSON
|
||||
"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}"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Utilizando no Delphi
|
||||
|
||||
Você pode utilizar os recursos do proprio componente para criar seu arquivo de configuração ou criar manualmente e carrega-lo no componentes.
|
||||
|
||||
### Carregando um JSON já pronto
|
||||
|
||||
```delphi
|
||||
var
|
||||
aJson : TJsonObject;
|
||||
begin
|
||||
aJson := TJSONObject.ParseJSONValue('SEU JSON') as TJsonObject;
|
||||
try
|
||||
TSafety4D.New.LoadConfig(aJson);
|
||||
finally
|
||||
aJson.Free;
|
||||
end;
|
||||
```
|
||||
|
||||
Uma vez estando com as configurações do arquivo carregadas no componente TSafety4D, você pode utilizar os recursos de validação.
|
||||
|
||||
|
||||
### Validando o acesso a um recursos
|
||||
|
||||
```delphi
|
||||
TSafety4D.New
|
||||
.Validation
|
||||
.userKey('CHAVE DO USERKEY')
|
||||
.application('APPLICATION DO RECURSO')
|
||||
.resource('NOME DO RECURSOS')
|
||||
.action('ACTION A SER EXECUTADA')
|
||||
.validate;
|
||||
```
|
||||
|
||||
Abaixo o exemplo utilizando os dados do arquivo de configuração que mostramos acima, verificando se um usuário especifico possuí a permissão para escrever no recurso de <b>users</b>.
|
||||
|
||||
```delphi
|
||||
TSafety4D.New
|
||||
.Validation
|
||||
.userKey('{34C940ED-50E7-4CE3-B701-03CF1E15F28B}')
|
||||
.application('safety4d')
|
||||
.resource('users')
|
||||
.action('write')
|
||||
.validate;
|
||||
```
|
||||
|
||||
O <b>Safety4D</b> trabalha com uma instancia Singleton, ou seja, a mesma instancia é compartilhada em toda a aplicação, com isso algumas configurações você pode deixar por default como por exemplo <b>userKey e application</b> que provavelmente não irão mudar em uma sessão de usuário durante o uso.
|
||||
|
||||
Sendo assim você pode por exemplo na instancia principal da sua aplicação já deixar esses valores setados.
|
||||
|
||||
```delphi
|
||||
TSafety4D.New
|
||||
.Validation
|
||||
.userKey('{34C940ED-50E7-4CE3-B701-03CF1E15F28B}')
|
||||
.application('safety4d');
|
||||
```
|
||||
|
||||
E durante o uso nas demais telas você não precisa mais passar essas informações para realizar a validação de um recurso.
|
||||
|
||||
```delphi
|
||||
TSafety4D.New
|
||||
.Validation
|
||||
.resource('users')
|
||||
.action('write')
|
||||
.validate;
|
||||
```
|
||||
### Exceptions
|
||||
|
||||
A função validade retorna um boolean sinalizando se o acesso é permitido ou não, porém você pode tratar a permissão fazendo com que o TSafety4D dispare uma excessão com a mensagem do que falhou na validação, não necessitando assim de estrutura condicional para validar o acesso.
|
||||
|
||||
```delphi
|
||||
TSafety4D.New
|
||||
.configurations
|
||||
.exceptions(True)
|
||||
.&end
|
||||
.Validation
|
||||
.userKey('{34C940ED-50E7-4CE3-B701-03CF1E15F28B}')
|
||||
.application('safety4d')
|
||||
.resource('users')
|
||||
.action('write')
|
||||
.validate;
|
||||
```
|
||||
|
||||
## Definindo as Configurações pelo Sistema
|
||||
|
||||
Você pode criar o arquivo de configuração manualmente e carrega-lo no componente ou utilizar o proprio componente para definir as configurações.
|
||||
|
||||
```delphi
|
||||
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
|
||||
.&end
|
||||
.&end
|
||||
.&end
|
||||
.groupPermission
|
||||
.groupRegister
|
||||
.add('Operador')
|
||||
.description('Funções de Operador do Sistema')
|
||||
.actions
|
||||
.add('users.view')
|
||||
.&end
|
||||
.notActions
|
||||
.add('*')
|
||||
.&end
|
||||
.&end
|
||||
.&end
|
||||
.userKey
|
||||
.registerUserKey
|
||||
.add('Fulano de Tal')
|
||||
.addPermission('{96B4C46F-0EBB-443B-B309-09C81844406E}')
|
||||
.&end
|
||||
.&end
|
||||
.&end;
|
||||
```
|
||||
|
||||
### Transformando as configuração do Componente em Json
|
||||
|
||||
Utilizando o código abaixo você carrega toda a configuração do componentes para um TJsonObject.
|
||||
|
||||
```delphi
|
||||
var
|
||||
aJsonSafety4D : TJsonObject;
|
||||
begin
|
||||
aJsonSafety4D := TJSONObject.Create;
|
||||
try
|
||||
TSafety4D.New.getConfig(aJsonSafety4D);
|
||||
Memo1.Lines.Add(aJsonSafety4D.Format);
|
||||
finally
|
||||
aJsonSafety4D.Free;
|
||||
end;
|
||||
```
|
||||
|
||||
### Salvando a configuração em um Arquivo no Disco
|
||||
|
||||
Você pode utilizar o recursos abaixo para salvar as configurações diretamente no disco.
|
||||
|
||||
```delphi
|
||||
TSafety4D.New.SaveToStorage();
|
||||
```
|
||||
|
||||
## Dica
|
||||
|
||||
Crie a estrutura e salve ela no seu banco de dados em um campo de texto e carregue toda vez que abrir a aplicação ou tiver alguma mudança nas configurações para o componente.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 101 KiB |
5
boss-lock.json
Normal file
5
boss-lock.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"hash": "d41d8cd98f00b204e9800998ecf8427e",
|
||||
"updated": "2021-04-07T22:02:42.8886995-03:00",
|
||||
"installedModules": {}
|
||||
}
|
||||
9
boss.json
Normal file
9
boss.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "safety4d",
|
||||
"description": "",
|
||||
"version": "1.0.0",
|
||||
"homepage": "",
|
||||
"mainsrc": "./",
|
||||
"projects": [],
|
||||
"dependencies": {}
|
||||
}
|
||||
15
samples/Safety4DSample.dpr
Normal file
15
samples/Safety4DSample.dpr
Normal file
@ -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.
|
||||
922
samples/Safety4DSample.dproj
Normal file
922
samples/Safety4DSample.dproj
Normal file
@ -0,0 +1,922 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{94E1E924-4B2D-49BF-9361-D6402259FADC}</ProjectGuid>
|
||||
<ProjectVersion>19.2</ProjectVersion>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>1</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
<MainSource>Safety4DSample.dpr</MainSource>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||
<Base_Win32>true</Base_Win32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
|
||||
<Base_Win64>true</Base_Win64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
|
||||
<Cfg_1_Win32>true</Cfg_1_Win32>
|
||||
<CfgParent>Cfg_1</CfgParent>
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
|
||||
<Cfg_2_Win32>true</Cfg_2_Win32>
|
||||
<CfgParent>Cfg_2</CfgParent>
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
|
||||
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
|
||||
<DCC_E>false</DCC_E>
|
||||
<DCC_N>false</DCC_N>
|
||||
<DCC_S>false</DCC_S>
|
||||
<DCC_F>false</DCC_F>
|
||||
<DCC_K>false</DCC_K>
|
||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
|
||||
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
|
||||
<SanitizedProjectName>Safety4DSample</SanitizedProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||
<DCC_UsePackage>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)</DCC_UsePackage>
|
||||
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||
<BT_BuildType>Debug</BT_BuildType>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||
<DCC_UsePackage>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)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||
<DCC_DebugDCUs>true</DCC_DebugDCUs>
|
||||
<DCC_Optimize>false</DCC_Optimize>
|
||||
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
|
||||
<DCC_UnitSearchPath>D:\Projetos\Componentes\RBAC4D\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
<DCC_DebugInformation>0</DCC_DebugInformation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<DelphiCompile Include="$(MainSource)">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="Unit1.pas">
|
||||
<Form>Form1</Form>
|
||||
<FormType>dfm</FormType>
|
||||
</DCCReference>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType>Application</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<Delphi.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">Safety4DSample.dpr</Source>
|
||||
</Source>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k270.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp270.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\21.0\Bpl\CEF4Delphi_FMX.bpl">CEF4Delphi</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
</Delphi.Personality>
|
||||
<Deployment Version="3">
|
||||
<DeployFile LocalName="Win32\Debug\Safety4DSample.exe" Configuration="Debug" Class="ProjectOutput">
|
||||
<Platform Name="Win32">
|
||||
<RemoteName>Safety4DSample.exe</RemoteName>
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidClassesDexFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>classes</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>classes</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidFileProvider">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\xml</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\xml</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidGDBServer">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeArmeabiFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeArmeabiv7aFile">
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeMipsFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\mips</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\mips</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidServiceOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidServiceOutput_Android32">
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashImageDef">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashStyles">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashStylesV21">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values-v21</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values-v21</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_Colors">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_DefaultAppIcon">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon144">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon192">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon36">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-ldpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-ldpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon48">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon72">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon96">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon24">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon36">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon48">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon72">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_NotificationIcon96">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage426">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-small</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-small</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage470">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-normal</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-normal</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage640">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-large</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-large</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage960">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xlarge</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\drawable-xlarge</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_Strings">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyFramework">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyModule">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.dll;.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="DependencyPackage">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="File">
|
||||
<Platform Name="Android">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iOS_AppStore1024">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_AppIcon152">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_AppIcon167">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2x">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_LaunchDark2x">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Notification40">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Setting58">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_SpotLight80">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_AppIcon120">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_AppIcon180">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch2x">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch3x">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_LaunchDark2x">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_LaunchDark3x">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Notification40">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Notification60">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Setting58">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Setting87">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Spotlight120">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Spotlight80">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectAndroidManifest">
|
||||
<Platform Name="Android">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice32">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSEntitlements">
|
||||
<Platform Name="iOSDevice32">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSInfoPList">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSLaunchScreen">
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen</RemoteDir>
|
||||
<Operation>64</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<RemoteDir>..\$(PROJECTNAME).launchscreen</RemoteDir>
|
||||
<Operation>64</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSResource">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXDebug">
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXEntitlements">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXInfoPList">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>Contents</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXResource">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="ProjectOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Linux64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX64">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOutput_Android32">
|
||||
<Platform Name="Android64">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectUWPManifest">
|
||||
<Platform Name="Win32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="UWP_DelphiLogo150">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="UWP_DelphiLogo44">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
<Platform value="Win64">False</Platform>
|
||||
</Platforms>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
|
||||
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
|
||||
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
|
||||
</Project>
|
||||
BIN
samples/Safety4DSample.res
Normal file
BIN
samples/Safety4DSample.res
Normal file
Binary file not shown.
@ -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
|
||||
|
||||
@ -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]
|
||||
|
||||
//<sGroup, TDictionary<sProviderName, TDictionary<sActions, string>>>;
|
||||
|
||||
|
||||
|
||||
|
||||
//Buscar grupo de permissões
|
||||
TRbac4D
|
||||
.New
|
||||
.getFunctionDefinitions; //TArray<TFunctionDefinition>
|
||||
|
||||
|
||||
//Busar Resources
|
||||
TRbac4D
|
||||
.New
|
||||
.getResourcesGroup('GroupName'); //TArray<TResourcesGroupName>
|
||||
|
||||
|
||||
//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.
|
||||
|
||||
63
samples/Win32/Debug/RbacSample.s4d
Normal file
63
samples/Win32/Debug/RbacSample.s4d
Normal file
@ -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<73>es completa de gest<73>o do Sistema",
|
||||
"Actions": [
|
||||
"users.write"
|
||||
],
|
||||
"NotActions": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
"{C188D1AB-EC28-4380-96E0-D1B13A29A8B3}": {
|
||||
"key": "Comercial",
|
||||
"description": "Permiss<73>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}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
61
src/Safety4D.Configuration.pas
Normal file
61
src/Safety4D.Configuration.pas
Normal file
@ -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.
|
||||
@ -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<TJsonObject>(group.Key);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -12,7 +12,6 @@ type
|
||||
[weak]
|
||||
FParent : iSafety4DResourcesGroupProvider;
|
||||
FActionList : TDictionary<string, iSafety4DResourcesGroupProviderActionsMsg>;
|
||||
FActionsMsg : iSafety4DResourcesGroupProviderActionsMsg;
|
||||
public
|
||||
constructor Create(aParent : iSafety4DResourcesGroupProvider);
|
||||
destructor Destroy; override;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -35,7 +35,7 @@ end;
|
||||
|
||||
function TSafety4DResourcesRegister.getResourceGroups: TDictionary<string, iSafety4DResourcesGroupProvider>;
|
||||
begin
|
||||
Result := FResourceGroupName.getResourcesGroupList;
|
||||
Result := resourcesGroupName.getResourcesGroupList;
|
||||
end;
|
||||
|
||||
constructor TSafety4DResourcesRegister.Create(aParent : iSafety4DResources);
|
||||
|
||||
@ -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<TJsonArray>('resources').Items[0] as TJsonObject);
|
||||
aJson.AddPair(Resource.Key, TJSONObject.Create);
|
||||
for var Provider in Resource.Value.getProviderNames do
|
||||
begin
|
||||
|
||||
@ -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<TJsonObject>(userRegister.Key);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<TJsonObject>('resources');
|
||||
aGroup := aJson.GetValue<TJsonObject>('groupPermission');
|
||||
aUser := aJson.GetValue<TJsonObject>('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<TJsonArray>('Actions');
|
||||
aJsonNotActions := aJsonGroup.GetValue<TJsonArray>('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<TJsonObject>('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<String>('description'))
|
||||
.errormsg(aJsonActions.Get(K).JsonValue.GetValue<String>('errormsg'))
|
||||
.add(aJsonActions.Pairs[K].JsonString.Value)
|
||||
.description(aJsonActions.Pairs[K].JsonValue.GetValue<String>('description'))
|
||||
.errormsg(aJsonActions.Pairs[K].JsonValue.GetValue<String>('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<TJsonArray>('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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user