From 1351816935c8a2cd58399f31fd0ee2cbd879b662 Mon Sep 17 00:00:00 2001 From: Ferry Boender Date: Mon, 30 Mar 2015 21:33:32 +0200 Subject: [PATCH] Authentication example. --- examples/auth/README.md | 5 +++++ examples/auth/auth.json | 26 ++++++++++++++++++++++++++ examples/auth/job_do_nothing.sh | 3 +++ 3 files changed, 34 insertions(+) create mode 100644 examples/auth/README.md create mode 100644 examples/auth/auth.json create mode 100755 examples/auth/job_do_nothing.sh diff --git a/examples/auth/README.md b/examples/auth/README.md new file mode 100644 index 0000000..05df1b8 --- /dev/null +++ b/examples/auth/README.md @@ -0,0 +1,5 @@ +ScriptForm auth example +======================= + +This example shows how to authenticate users. Everyone must authenticate. Only +user 'test2' is allowed to see and execute the 'only_some_users' form. diff --git a/examples/auth/auth.json b/examples/auth/auth.json new file mode 100644 index 0000000..b5c00fa --- /dev/null +++ b/examples/auth/auth.json @@ -0,0 +1,26 @@ +{ + "title": "Authorization protected", + "users": { + "test": "secret", + "test2": "password" + }, + "forms": { + "do_nothing": { + "title": "Test form", + "description": "You should only see this if you've entered the correct password", + "submit_title": "Do nothing", + "script": "job_do_nothing.sh", + "fields": [ + ] + }, + "only_some_users": { + "title": "Only some users", + "description": "You should only see this if you're user 'test2'", + "submit_title": "Do nothing", + "script": "job_do_nothing.sh", + "allowed_users": ["test2"], + "fields": [ + ] + } + } +} diff --git a/examples/auth/job_do_nothing.sh b/examples/auth/job_do_nothing.sh new file mode 100755 index 0000000..97e7294 --- /dev/null +++ b/examples/auth/job_do_nothing.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "I did nothing very successfully"