concept
Enterprise AI architecture
Illustrative trusted-record authorization filter; not authentication or database enforcement.
Formal Syntax & Structure
artificial-intelligence syntaxartificial-intelligence
visible_records(principal, records)Working Example
Example Snippetartificial-intelligence
def visible_records(principal, records): # Principal and records are supplied by trusted application storage. if not principal["active"]: return [] return sorted(r["id"] for r in records if r["tenant"] == principal["tenant"] and r["group"] in principal["groups"] and not r["deleted"])
principal = dict(tenant="north", groups=["support"], active=True)records = [dict(id="a", tenant="north", group="support", deleted=False), dict(id="b", tenant="south", group="support", deleted=False), dict(id="c", tenant="north", group="finance", deleted=False), dict(id="d", tenant="north", group="support", deleted=True)]print(visible_records(principal, records))print(visible_records(dict(principal, active=False), records))