You can set the Editability of an object to conditionally. I would then check for a boolean attribute like “editable”, e.g. → $currentObject/editable = true.
By default this boolean is true, if you press the disable edit button you call a nanoflow and change that boolean to false. If you press the enable edit button you do the same but change the boolean to true