Coverage report for Casbin.Adapter.Memory.

Generated at 18/02/2019 12:10:19 by DelphiCodeCoverage - an open source tool for Delphi Code Coverage.

Statistics for Casbin.Adapter.Memory.pas

Number of lines covered16
Number of lines with code gen18
Line coverage88%


1
// Copyright 2018 by John Kouraklis and Contributors. All Rights Reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
unit Casbin.Adapter.Memory;
15
16
interface
17
18
uses
19
  Casbin.Core.Base.Types, Casbin.Adapter.Base, System.Classes;
20
21
type
22
  TMemoryAdapter = class(TBaseAdapter)
23
  private
24
    procedure resetSections;
25
   public
26
    constructor Create; overload;
27
    procedure load(const aFilter: TFilterArray); override;
28
    procedure save; override;
29
  end;
30
31
implementation
32
33
constructor TMemoryAdapter.Create;
34
begin
35
  inherited;
36
  resetSections;
37
end;
38
39
procedure TMemoryAdapter.load(const aFilter: TFilterArray);
40
begin
41
  inherited;
42
  resetSections;
43
end;
44
45
procedure TMemoryAdapter.save;
46
begin
47
  inherited;
48
end;
49
50
procedure TMemoryAdapter.resetSections;
51
begin
52
  if getAssertions.Count=0 then
53
  begin
54
    getAssertions.Add('[request_definition]');
55
    getAssertions.Add('[policy_definition]');
56
    getAssertions.Add('[role_definition]');
57
    getAssertions.Add('[policy_effect]');
58
    getAssertions.Add('[matchers]');
59
  end;
60
end;
61
62
end.