IDBAC Instrument
IdbacInstrument
is an instrument that implements an ID-based access control (IDBAC) on input documents. IDBAC allows to specify a set of instruments that will be run only on those documents that are associated to different IDs than the one of the user.
Configuration
Argument | Type | Description |
---|---|---|
instruments |
list[Instrument] |
The instruments to apply to the IDBAC |
Usage Example
examples/id_based_pii.py
from eunomia.instruments import IdbacInstrument, PiiInstrument
from eunomia.orchestra import Orchestra
eunomia = Orchestra(
instruments=[
IdbacInstrument(
instruments=[
PiiInstrument(entities=["PERSON", "EMAIL_ADDRESS"], edit_mode="replace")
]
),
]
)
text_original = "Hello, my name is John Doe and my email is john.doe@example.com."
text_edited_same = eunomia.run(text_original, user_id="user1", doc_id="user1")
text_edited_different = eunomia.run(text_original, user_id="user2", doc_id="user1")
print("Same user:", text_edited_same)
print("Different user:", text_edited_different)