Home /Modules/antivirus/SLControl.sleela

SLControl.sleela

lib/antivirus/SLControl.sleela · 108 line(s) · sleela

<< lib/antivirus/SLControl.sleela
   Control over a material antivirus artifact: the governance that SECURES
   CHANGE. A material subject is, by convention, not freely moved out of the
   material set; when it is changed, the change is deliberate and secured, not
   casual. SLControl is how SLMaterialClaim admits a change: it records authorization,
   an optional lock, and an audit count of secured transitions. It governs
   change only -- it neither originates the subject (SLCreator) nor scans files
   (the engine). Fail-closed: without explicit authorization a change is
   refused. >>
#sleela 2.5
material;
class SLControl {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10543;
  String metaAuthor = "Max Rupplin vs. Dr. Mrs. Elisabeth Harkins";
  String metaDate = "2026-10-27";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "Sleelavirin";
  String metaCorporation = "MEARVK LLC";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-27";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 8;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }

  < ---- Change-control state ---- >
  << controllerName   : who holds control (the authorizing party).
     authorized        : explicit authorization to secure changes at all.
     locked            : when true, changes are frozen even if authorized.
     securedChanges    : audit count of changes this control has secured.
     lastSecuredSubject: the subject of the most recent secured change. >>
  String controllerName;
  boolean authorized;
  boolean locked;
  int securedChanges;
  String lastSecuredSubject;

  void configure(String name) {
    controllerName = name;
    authorized = false;
    locked = false;
    securedChanges = 0;
    lastSecuredSubject = "none";
  }

  < Grant or withdraw authorization to secure changes. Fail-closed default. >
  void authorize(boolean granted) {
    authorized = granted;
  }

  << Lock freezes a material subject against change even when authorized;
     unlock restores the authorized-but-deliberate regime. >>
  void lock() { locked = true; }
  void unlock() { locked = false; }

  boolean isAuthorized() {
    return authorized && !locked && controllerName != null;
  }

  << Secure a change to a material subject. A change is admitted only when
     control is authorized and not locked; then it is recorded (audited) and
     accepted as deliberate. Returns true when the change is secured, false when
     it is refused (unauthorized or locked). >>
  boolean secureChange(String subject, String reason) {
    if (!isAuthorized()) return false;
    securedChanges = securedChanges + 1;
    lastSecuredSubject = subject;
    return true;
  }

  String describe() {
    if (!isAuthorized()) {
      return "SLControl(" + controllerName + "): change not secured (unauthorized or locked)";
    }
    return "SLControl(" + controllerName + "): securing change; secured="
         + securedChanges;
  }
}