Skip to content

ABAC Model

John Kouraklis edited this page Feb 18, 2019 · 1 revision

Implementing ABAC (Attribute-Based Access Control) model, involves the introduction and set of additional attributes that suit your design.

In Casbin4D, you can implement ABAC using the following steps:

  1. Define a record to hold the necessary attributes
type
  TABACRecord = record
    Owner: string;
  end;
  1. Instantiate and populate the record
var
  ...
  rec: TABACRecord;
  ...
begin
  ...
  rec.Owner='John';
  ...
end;
  1. Enforce the assertion by passing the TypeInfo of TABACRecord and the instance rec
  ...
  outcome=casbin.enforce(['alice,data1,read'], TypeInfo(TABACRecord), rec);
  ...

Note: The names of the fields in the record should match the name of the attributes used in the model file