Spaces:
Sleeping
Sleeping
Create dora_remote_access_policy.py
Browse files
tools/dora_remote_access_policy.py
CHANGED
|
@@ -18,7 +18,7 @@ def export_text_to_pdf(text, metadata=None, output_path=None, language="en"):
|
|
| 18 |
|
| 19 |
pdf.set_font("Arial", 'B', 16)
|
| 20 |
pdf.set_text_color(0, 51, 102)
|
| 21 |
-
title = "Remote Access Policy - DORA (Optional)" if language == "en" else "Politique d'
|
| 22 |
pdf.cell(0, 15, title, ln=True, align='C')
|
| 23 |
pdf.ln(10)
|
| 24 |
|
|
@@ -60,12 +60,13 @@ def export_text_to_pdf(text, metadata=None, output_path=None, language="en"):
|
|
| 60 |
|
| 61 |
# === Questions ===
|
| 62 |
QUESTIONS = prepend_metadata_questions([
|
| 63 |
-
("
|
| 64 |
-
("
|
| 65 |
-
("
|
| 66 |
-
("
|
| 67 |
-
("
|
| 68 |
-
("
|
|
|
|
| 69 |
])
|
| 70 |
|
| 71 |
|
|
@@ -99,10 +100,10 @@ def run_tool():
|
|
| 99 |
content = "\n".join([f"- **{label}**: {answers.get(key, '')}" for key, label in QUESTIONS])
|
| 100 |
lang = detect(content if len(content.strip()) > 3 else "Placeholder content")
|
| 101 |
pdf_path = export_text_to_pdf(content, metadata=metadata, language=lang)
|
| 102 |
-
return "✅ Policy generated. Download your file below.", {"done": True}, pdf_path
|
| 103 |
|
| 104 |
with gr.Blocks(title="DORA Remote Access Policy") as demo:
|
| 105 |
-
chatbot = gr.Chatbot(label="
|
| 106 |
msg = gr.Textbox(label="Your answer")
|
| 107 |
state_var = gr.State(state)
|
| 108 |
file_output = gr.File(label="Download PDF")
|
|
|
|
| 18 |
|
| 19 |
pdf.set_font("Arial", 'B', 16)
|
| 20 |
pdf.set_text_color(0, 51, 102)
|
| 21 |
+
title = "Remote Access Policy - DORA (Optional)" if language == "en" else "Politique d'Accès à Distance - DORA"
|
| 22 |
pdf.cell(0, 15, title, ln=True, align='C')
|
| 23 |
pdf.ln(10)
|
| 24 |
|
|
|
|
| 60 |
|
| 61 |
# === Questions ===
|
| 62 |
QUESTIONS = prepend_metadata_questions([
|
| 63 |
+
("policy_scope", "What is the scope of the remote access policy?"),
|
| 64 |
+
("authentication_measures", "What authentication measures are required for remote access?"),
|
| 65 |
+
("device_requirements", "What are the requirements for devices used for remote access?"),
|
| 66 |
+
("data_protection_measures", "How is data protected during remote access?"),
|
| 67 |
+
("user_responsibilities", "What responsibilities do users have under this policy?"),
|
| 68 |
+
("access_monitoring", "How is remote access monitored and logged?"),
|
| 69 |
+
("incident_response", "What actions are taken in case of policy violations or security incidents?")
|
| 70 |
])
|
| 71 |
|
| 72 |
|
|
|
|
| 100 |
content = "\n".join([f"- **{label}**: {answers.get(key, '')}" for key, label in QUESTIONS])
|
| 101 |
lang = detect(content if len(content.strip()) > 3 else "Placeholder content")
|
| 102 |
pdf_path = export_text_to_pdf(content, metadata=metadata, language=lang)
|
| 103 |
+
return "✅ Remote Access Policy generated. Download your file below.", {"done": True}, pdf_path
|
| 104 |
|
| 105 |
with gr.Blocks(title="DORA Remote Access Policy") as demo:
|
| 106 |
+
chatbot = gr.Chatbot(label="🌐 Remote Access Policy Assistant", value=[{"role": "assistant", "content": QUESTIONS[0][1]}], type="messages")
|
| 107 |
msg = gr.Textbox(label="Your answer")
|
| 108 |
state_var = gr.State(state)
|
| 109 |
file_output = gr.File(label="Download PDF")
|