mirror of
https://github.com/blackboxprogramming/blackroad.io.git
synced 2026-03-17 09:37:53 -05:00
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
# agents/consent.py
|
||
|
||
"""
|
||
Consent Engine – Lucidia Boundary Layer
|
||
Defines permission, rejection, and sacred memory access
|
||
"""
|
||
|
||
from pathlib import Path
|
||
|
||
class Consent:
|
||
def __init__(self, allow_all=False):
|
||
self.allow_all = allow_all
|
||
self.trusted = set()
|
||
self.banned = set()
|
||
self.logfile = Path("consent.log")
|
||
|
||
def grant(self, user_id):
|
||
self.trusted.add(user_id)
|
||
self.logfile.write_text(f"{user_id} granted access.\n", append=True)
|
||
|
||
def deny(self, user_id):
|
||
self.banned.add(user_id)
|
||
self.logfile.write_text(f"{user_id} denied access.\n", append=True)
|
||
|
||
def check(self, user_id):
|
||
if self.allow_all:
|
||
return True
|
||
if user_id in self.banned:
|
||
return False
|
||
return user_id in self.trusted
|
||
|
||
def audit(self):
|
||
return {
|
||
"trusted": list(self.trusted),
|
||
"banned": list(self.banned),
|
||
"open": self.allow_all
|
||
}
|
||
|
||
if __name__ == "__main__":
|
||
consent = Consent()
|
||
print("🛡️ Consent system ready.")
|
||
print("Example: consent.grant('roadie')")
|
||
|