Progress on #2, #5; oauth isn't working but not far off

Using the Noir session doesn't seem to be the right thing to do. I should be using the Ring session, but I'm having a hard time getting my head round it. @yogthos is too bloody clever!
This commit is contained in:
Simon Brooke 2018-06-29 17:14:55 +01:00
parent 88468461fd
commit 4e296537c4
52 changed files with 465 additions and 114 deletions

View file

@ -1,6 +1,6 @@
(ns youyesyet.dev-middleware (ns youyesyet.dev-middleware
(:require (:require
;; [ring.middleware.reload :refer [wrap-reload]] ;; [ring.middleware.reload :refer [wrap-reload]] ;; this fails with a self referential dependency, which I haven't tracked down.
[selmer.middleware :refer [wrap-error-page]] [selmer.middleware :refer [wrap-error-page]]
[prone.middleware :refer [wrap-exceptions]] [prone.middleware :refer [wrap-exceptions]]
)) ))

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- File queries.sql -- File queries.sql
-- --
-- autogenerated by adl.to-hugsql-queries at 2018-06-29T10:10:58.177Z -- autogenerated by adl.to-hugsql-queries at 2018-06-29T14:15:37.324Z
-- --
-- See [Application Description -- See [Application Description
-- Language](https://github.com/simon-brooke/adl). -- Language](https://github.com/simon-brooke/adl).
@ -27,8 +27,18 @@ returning id
-- :name create-authority! :! :n -- :name create-authority! :! :n
-- :doc creates a new authority record -- :doc creates a new authority record
INSERT INTO authorities (id) INSERT INTO authorities (request_token_uri,
VALUES (:id) access_token_uri,
authorize_uri,
consumer_key,
consumer_secret,
id)
VALUES (:request_token_uri,
:access_token_uri,
:authorize_uri,
:consumer_key,
:consumer_secret,
:id)
returning id returning id
-- :name create-canvasser! :! :n -- :name create-canvasser! :! :n
@ -121,10 +131,12 @@ returning id
-- :doc creates a new intention record -- :doc creates a new intention record
INSERT INTO intentions (visit_id, INSERT INTO intentions (visit_id,
elector_id, elector_id,
option_id) option_id,
locality)
VALUES (:visit_id, VALUES (:visit_id,
:elector_id, :elector_id,
:option_id) :option_id,
:locality)
returning Id returning Id
-- :name create-issue! :! :n -- :name create-issue! :! :n
@ -747,6 +759,11 @@ ORDER BY lv_addresses.address,
-- :doc selects existing authority records having any string field matching the parameter of the same name by substring match -- :doc selects existing authority records having any string field matching the parameter of the same name by substring match
SELECT * FROM lv_authorities SELECT * FROM lv_authorities
WHERE false WHERE false
--~ (if (:request-token-uri params) "OR request_token_uri LIKE '%:request-token-uri%'")
--~ (if (:access-token-uri params) "OR access_token_uri LIKE '%:access-token-uri%'")
--~ (if (:authorize-uri params) "OR authorize_uri LIKE '%:authorize-uri%'")
--~ (if (:consumer-key params) "OR consumer_key LIKE '%:consumer-key%'")
--~ (if (:consumer-secret params) "OR consumer_secret LIKE '%:consumer-secret%'")
--~ (if (:id params) "OR id LIKE '%:id%'") --~ (if (:id params) "OR id LIKE '%:id%'")
--~ (if (:offset params) "OFFSET :offset ") --~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
@ -868,6 +885,7 @@ WHERE false
--~ (if (:visit_id params) "OR visit_id = :visit_id") --~ (if (:visit_id params) "OR visit_id = :visit_id")
--~ (if (:elector_id params) "OR elector_id = :elector_id") --~ (if (:elector_id params) "OR elector_id = :elector_id")
--~ (if (:option_id params) "OR option_id = :option_id") --~ (if (:option_id params) "OR option_id = :option_id")
--~ (if (:locality params) "OR locality = :locality")
--~ (if (:Id params) "OR Id = :Id") --~ (if (:Id params) "OR Id = :Id")
--~ (if (:offset params) "OFFSET :offset ") --~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
@ -941,6 +959,17 @@ SET address = :address,
locality = :locality locality = :locality
WHERE addresses.id = :id WHERE addresses.id = :id
-- :name update-authority! :! :n
-- :doc updates an existing authority record
UPDATE authorities
SET request_token_uri = :request-token-uri,
access_token_uri = :access-token-uri,
authorize_uri = :authorize-uri,
consumer_key = :consumer-key,
consumer_secret = :consumer-secret,
id = :id
WHERE authorities.id = :id
-- :name update-canvasser! :! :n -- :name update-canvasser! :! :n
-- :doc updates an existing canvasser record -- :doc updates an existing canvasser record
UPDATE canvassers UPDATE canvassers
@ -1001,7 +1030,8 @@ WHERE followuprequests.id = :id
UPDATE intentions UPDATE intentions
SET visit_id = :visit_id, SET visit_id = :visit_id,
elector_id = :elector_id, elector_id = :elector_id,
option_id = :option_id option_id = :option_id,
locality = :locality
WHERE intentions.Id = :Id WHERE intentions.Id = :Id
-- :name update-issue! :! :n -- :name update-issue! :! :n

View file

@ -5,7 +5,7 @@
-- --
-- auto-generated by [Application Description Language framework] -- auto-generated by [Application Description Language framework]
-- --
-- (https://github.com/simon-brooke/adl) at 20180629T101059.126Z -- (https://github.com/simon-brooke/adl) at 20180629T141538.194Z
-- --
-- --
-- A web-app intended to be used by canvassers campaigning for a -- A web-app intended to be used by canvassers campaigning for a
@ -99,7 +99,12 @@ GRANT DELETE ON addresses TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE authorities CREATE TABLE authorities
( (
id VARCHAR(32) NOT NULL PRIMARY KEY id VARCHAR(32) NOT NULL PRIMARY KEY,
request_token_uri VARCHAR(256) NOT NULL,
access_token_uri VARCHAR(256) NOT NULL,
authorize_uri VARCHAR(256) NOT NULL,
consumer_key VARCHAR(32) DEFAULT 'youyesyet' NOT NULL,
consumer_secret VARCHAR(256) NOT NULL
); );
GRANT SELECT ON authorities TO admin, GRANT SELECT ON authorities TO admin,
analysts, analysts,
@ -167,8 +172,15 @@ GRANT DELETE ON districts TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table dwellings for entity dwellings -- primary table dwellings for entity dwellings
-- --
-- All dwellings within addresses in the system; a dwelling is a house, -- All dwellings within addresses in the system; a dwelling is a
-- flat or appartment in which electors live. -- house, flat or appartment in which electors live. Every address
-- should have
-- at least one dwelling; essentially, an address maps onto a
-- street door and
-- dwellings map onto what's behind that door. So a tenement or a
-- block of flats
-- would be one address with many dwellings.
--
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE dwellings CREATE TABLE dwellings
( (
@ -298,14 +310,15 @@ GRANT DELETE ON genders TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table intentions for entity intentions -- primary table intentions for entity intentions
-- --
-- Link table. -- Intentions of electors to vote for options elicited in visits.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE intentions CREATE TABLE intentions
( (
Id SERIAL NOT NULL PRIMARY KEY, Id SERIAL NOT NULL PRIMARY KEY,
visit_id INTEGER NOT NULL, visit_id INTEGER NOT NULL,
elector_id INTEGER NOT NULL, elector_id INTEGER,
option_id VARCHAR(32) NOT NULL option_id VARCHAR(32) NOT NULL,
locality INTEGER NOT NULL
); );
GRANT SELECT ON intentions TO admin, GRANT SELECT ON intentions TO admin,
analysts, analysts,
@ -455,7 +468,12 @@ GRANT SELECT ON lv_addresses TO admin,
-- cetera -- cetera
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE VIEW lv_authorities AS CREATE VIEW lv_authorities AS
SELECT authorities.id SELECT authorities.request_token_uri,
authorities.access_token_uri,
authorities.authorize_uri,
authorities.consumer_key,
authorities.consumer_secret,
authorities.id
FROM authorities FROM authorities
; ;
GRANT SELECT ON lv_authorities TO admin, GRANT SELECT ON lv_authorities TO admin,
@ -641,6 +659,7 @@ SELECT addresses.address ||', '|| addresses.postcode ||', '|| visits.date AS vis
intentions.elector_id, intentions.elector_id,
options.id AS option_id_expanded, options.id AS option_id_expanded,
intentions.option_id, intentions.option_id,
intentions.locality,
intentions.Id intentions.Id
FROM visits, intentions, addresses, genders, electors, options FROM visits, intentions, addresses, genders, electors, options
WHERE intentions.visit_id = visits.id WHERE intentions.visit_id = visits.id

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File application-index.html generated 2018-06-29T10:10:59.615Z by adl.to-selmer-templates. <!-- File application-index.html generated 2018-06-29T14:15:38.716Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
@ -49,7 +49,12 @@ Dwelling
</dt> </dt>
<dd> <dd>
<p> <p>
All dwellings within addresses in the system; a dwelling is a house, flat or appartment in which electors live. All dwellings within addresses in the system; a dwelling is a
house, flat or appartment in which electors live. Every address should have
at least one dwelling; essentially, an address maps onto a street door and
dwellings map onto what's behind that door. So a tenement or a block of flats
would be one address with many dwellings.
</p> </p>
</dd> </dd>
<dt> <dt>
@ -99,7 +104,7 @@ Intention
</dt> </dt>
<dd> <dd>
<p> <p>
Link table. Intentions of electors to vote for options elicited in visits.
</p> </p>
</dd> </dd>
<dt> <dt>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-addresses-Address.html generated 2018-06-29T10:10:59.603Z by adl.to-selmer-templates. <!-- File form-addresses-Address.html generated 2018-06-29T14:15:38.705Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-authorities-Authority.html generated 2018-06-29T10:10:59.623Z by adl.to-selmer-templates. <!-- File form-authorities-Authority.html generated 2018-06-29T14:15:38.724Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
@ -42,6 +42,96 @@ You are not permitted to view id of authorities
{% endifmemberof %} {% endifmemberof %}
{% endifmemberof %} {% endifmemberof %}
</p> </p>
<p class='widget'>
<label for='request-token-uri'>
request-token-uri
</label>
{% ifmemberof admin %}
<input id='request-token-uri' name='request-token-uri' type='text' value='{{record.request-token-uri}}' maxlength='256' size='60'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='request-token-uri' name='request-token-uri' class='pseudo-widget disabled'>
{{record.request-token-uri}}
</span>
{% else %}
<span id='request-token-uri' name='request-token-uri' class='pseudo-widget not-authorised'>
You are not permitted to view request-token-uri of authorities
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='access-token-uri'>
access-token-uri
</label>
{% ifmemberof admin %}
<input id='access-token-uri' name='access-token-uri' type='text' value='{{record.access-token-uri}}' maxlength='256' size='60'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='access-token-uri' name='access-token-uri' class='pseudo-widget disabled'>
{{record.access-token-uri}}
</span>
{% else %}
<span id='access-token-uri' name='access-token-uri' class='pseudo-widget not-authorised'>
You are not permitted to view access-token-uri of authorities
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='authorize-uri'>
authorize-uri
</label>
{% ifmemberof admin %}
<input id='authorize-uri' name='authorize-uri' type='text' value='{{record.authorize-uri}}' maxlength='256' size='60'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='authorize-uri' name='authorize-uri' class='pseudo-widget disabled'>
{{record.authorize-uri}}
</span>
{% else %}
<span id='authorize-uri' name='authorize-uri' class='pseudo-widget not-authorised'>
You are not permitted to view authorize-uri of authorities
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='consumer-key'>
consumer-key
</label>
{% ifmemberof admin %}
<input id='consumer-key' name='consumer-key' type='text' value='{{record.consumer-key}}' maxlength='32' size='32'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='consumer-key' name='consumer-key' class='pseudo-widget disabled'>
{{record.consumer-key}}
</span>
{% else %}
<span id='consumer-key' name='consumer-key' class='pseudo-widget not-authorised'>
You are not permitted to view consumer-key of authorities
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='consumer-secret'>
consumer-secret
</label>
{% ifmemberof admin %}
<input id='consumer-secret' name='consumer-secret' type='text' value='{{record.consumer-secret}}' maxlength='256' size='60'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='consumer-secret' name='consumer-secret' class='pseudo-widget disabled'>
{{record.consumer-secret}}
</span>
{% else %}
<span id='consumer-secret' name='consumer-secret' class='pseudo-widget not-authorised'>
You are not permitted to view consumer-secret of authorities
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget action-safe'> <p class='widget action-safe'>
<label for='save-button' class='action-safe'> <label for='save-button' class='action-safe'>
To save this authorities record To save this authorities record

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-canvassers-Canvasser.html generated 2018-06-29T10:10:59.624Z by adl.to-selmer-templates. <!-- File form-canvassers-Canvasser.html generated 2018-06-29T14:15:38.727Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-districts-District.html generated 2018-06-29T10:10:59.594Z by adl.to-selmer-templates. <!-- File form-districts-District.html generated 2018-06-29T14:15:38.696Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-dwellings-Dwelling.html generated 2018-06-29T10:10:59.636Z by adl.to-selmer-templates. <!-- File form-dwellings-Dwelling.html generated 2018-06-29T14:15:38.738Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-electors-Elector.html generated 2018-06-29T10:10:59.619Z by adl.to-selmer-templates. <!-- File form-electors-Elector.html generated 2018-06-29T14:15:38.721Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-followupactions-Followupaction.html generated 2018-06-29T10:10:59.639Z by adl.to-selmer-templates. <!-- File form-followupactions-Followupaction.html generated 2018-06-29T14:15:38.740Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-followupmethods-Followupmethod.html generated 2018-06-29T10:10:59.641Z by adl.to-selmer-templates. <!-- File form-followupmethods-Followupmethod.html generated 2018-06-29T14:15:38.742Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-followuprequests-Followuprequest.html generated 2018-06-29T10:10:59.598Z by adl.to-selmer-templates. <!-- File form-followuprequests-Followuprequest.html generated 2018-06-29T14:15:38.700Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-genders-Gender.html generated 2018-06-29T10:10:59.589Z by adl.to-selmer-templates. <!-- File form-genders-Gender.html generated 2018-06-29T14:15:38.691Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-intentions-Intention.html generated 2018-06-29T10:10:59.632Z by adl.to-selmer-templates. <!-- File form-intentions-Intention.html generated 2018-06-29T14:15:38.734Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
@ -92,6 +92,24 @@ You are not permitted to view option_id of intentions
{% endifmemberof %} {% endifmemberof %}
{% endifmemberof %} {% endifmemberof %}
</p> </p>
<p class='widget'>
<label for='locality'>
locality
</label>
{% ifmemberof admin %}
<input id='locality' name='locality' type='number' value='{{record.locality}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers analysts admin %}
<span id='locality' name='locality' class='pseudo-widget disabled'>
{{record.locality}}
</span>
{% else %}
<span id='locality' name='locality' class='pseudo-widget not-authorised'>
You are not permitted to view locality of intentions
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget action-safe'> <p class='widget action-safe'>
<label for='save-button' class='action-safe'> <label for='save-button' class='action-safe'>
To save this intentions record To save this intentions record

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-issues-Issue.html generated 2018-06-29T10:10:59.607Z by adl.to-selmer-templates. <!-- File form-issues-Issue.html generated 2018-06-29T14:15:38.709Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-options-Option.html generated 2018-06-29T10:10:59.631Z by adl.to-selmer-templates. <!-- File form-options-Option.html generated 2018-06-29T14:15:38.733Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-roles-Role.html generated 2018-06-29T10:10:59.609Z by adl.to-selmer-templates. <!-- File form-roles-Role.html generated 2018-06-29T14:15:38.710Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-teams-Team.html generated 2018-06-29T10:10:59.616Z by adl.to-selmer-templates. <!-- File form-teams-Team.html generated 2018-06-29T14:15:38.717Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
@ -28,10 +28,10 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
<label for='id'> <label for='id'>
id id
</label> </label>
{% ifmemberof teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='id' name='id' type='text' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='text' value='{{record.id}}' maxlength='' size='16'/>
{% else %} {% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='id' name='id' class='pseudo-widget disabled'> <span id='id' name='id' class='pseudo-widget disabled'>
{{record.id}} {{record.id}}
</span> </span>
@ -46,10 +46,10 @@ You are not permitted to view id of teams
<label for='name'> <label for='name'>
name name
</label> </label>
{% ifmemberof teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='name' name='name' type='text' value='{{record.name}}' maxlength='64' size='60'/> <input id='name' name='name' type='text' value='{{record.name}}' maxlength='64' size='60'/>
{% else %} {% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='name' name='name' class='pseudo-widget disabled'> <span id='name' name='name' class='pseudo-widget disabled'>
{{record.name}} {{record.name}}
</span> </span>
@ -64,7 +64,7 @@ You are not permitted to view name of teams
<label for='district_id'> <label for='district_id'>
district_id district_id
</label> </label>
{% ifmemberof teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<div class='select-box' farside='districts' found='true'> <div class='select-box' farside='districts' found='true'>
<input name='district_id-search-box' onchange='/* javascript to repopulate the select widget */'/> <input name='district_id-search-box' onchange='/* javascript to repopulate the select widget */'/>
<select id='district_id' name='district_id' comment='JavaScript stuff to fix up aynchronous loading'> <select id='district_id' name='district_id' comment='JavaScript stuff to fix up aynchronous loading'>
@ -72,7 +72,7 @@ district_id
</select> </select>
</div> </div>
{% else %} {% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='district_id' name='district_id' class='pseudo-widget disabled'> <span id='district_id' name='district_id' class='pseudo-widget disabled'>
{{record.district_id}} {{record.district_id}}
</span> </span>
@ -87,10 +87,10 @@ You are not permitted to view district_id of teams
<label for='latitude'> <label for='latitude'>
latitude latitude
</label> </label>
{% ifmemberof teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/> <input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/>
{% else %} {% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='latitude' name='latitude' class='pseudo-widget disabled'> <span id='latitude' name='latitude' class='pseudo-widget disabled'>
{{record.latitude}} {{record.latitude}}
</span> </span>
@ -105,7 +105,7 @@ You are not permitted to view latitude of teams
<label for='members'> <label for='members'>
members members
</label> </label>
{% ifmemberof teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<div class='select-box' farside='canvassers' found='true'> <div class='select-box' farside='canvassers' found='true'>
<input name='members-search-box' onchange='/* javascript to repopulate the select widget */'/> <input name='members-search-box' onchange='/* javascript to repopulate the select widget */'/>
<select id='members' name='members' multiple='multiple' comment='JavaScript stuff to fix up aynchronous loading'> <select id='members' name='members' multiple='multiple' comment='JavaScript stuff to fix up aynchronous loading'>
@ -113,7 +113,7 @@ members
</select> </select>
</div> </div>
{% else %} {% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='members' name='members' class='pseudo-widget disabled'> <span id='members' name='members' class='pseudo-widget disabled'>
{{record.members}} {{record.members}}
</span> </span>
@ -128,7 +128,7 @@ You are not permitted to view members of teams
<label for='organisers'> <label for='organisers'>
organisers organisers
</label> </label>
{% ifmemberof teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<div class='select-box' farside='canvassers' found='true'> <div class='select-box' farside='canvassers' found='true'>
<input name='organisers-search-box' onchange='/* javascript to repopulate the select widget */'/> <input name='organisers-search-box' onchange='/* javascript to repopulate the select widget */'/>
<select id='organisers' name='organisers' multiple='multiple' comment='JavaScript stuff to fix up aynchronous loading'> <select id='organisers' name='organisers' multiple='multiple' comment='JavaScript stuff to fix up aynchronous loading'>
@ -136,7 +136,7 @@ organisers
</select> </select>
</div> </div>
{% else %} {% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='organisers' name='organisers' class='pseudo-widget disabled'> <span id='organisers' name='organisers' class='pseudo-widget disabled'>
{{record.organisers}} {{record.organisers}}
</span> </span>
@ -151,10 +151,10 @@ You are not permitted to view organisers of teams
<label for='longitude'> <label for='longitude'>
longitude longitude
</label> </label>
{% ifmemberof teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/> <input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/>
{% else %} {% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='longitude' name='longitude' class='pseudo-widget disabled'> <span id='longitude' name='longitude' class='pseudo-widget disabled'>
{{record.longitude}} {{record.longitude}}
</span> </span>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-visits-Visit.html generated 2018-06-29T10:10:59.613Z by adl.to-selmer-templates. <!-- File form-visits-Visit.html generated 2018-06-29T14:15:38.714Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-addresses-Addresses.html generated 2018-06-29T10:10:59.623Z by adl.to-selmer-templates. <!-- File list-addresses-Addresses.html generated 2018-06-29T14:15:38.726Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-authorities-Authorities.html generated 2018-06-29T10:10:59.597Z by adl.to-selmer-templates. <!-- File list-authorities-Authorities.html generated 2018-06-29T14:15:38.699Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
@ -33,12 +33,30 @@ Add a new Authority
<th> <th>
id id
</th> </th>
<th>
request-token-uri
</th>
<th>
access-token-uri
</th>
<th>
authorize-uri
</th>
</tr> </tr>
<tr> <tr>
<th> <th>
<input id='id' type='text' name='id' value='{{ params.id }}'/> <input id='id' type='text' name='id' value='{{ params.id }}'/>
</th> </th>
<th> <th>
<input id='request_token_uri' type='text' name='request_token_uri' value='{{ params.request_token_uri }}'/>
</th>
<th>
<input id='access_token_uri' type='text' name='access_token_uri' value='{{ params.access_token_uri }}'/>
</th>
<th>
<input id='authorize_uri' type='text' name='authorize_uri' value='{{ params.authorize_uri }}'/>
</th>
<th>
<input type='submit' id='search' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
@ -50,6 +68,15 @@ id
{{ record.id }} {{ record.id }}
</td> </td>
<td> <td>
{{ record.request_token_uri }}
</td>
<td>
{{ record.access_token_uri }}
</td>
<td>
{{ record.authorize_uri }}
</td>
<td>
<a href='form-authorities-Authority?id={{ record.id }}'> <a href='form-authorities-Authority?id={{ record.id }}'>
View View
</a> </a>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-canvassers-Canvassers.html generated 2018-06-29T10:10:59.635Z by adl.to-selmer-templates. <!-- File list-canvassers-Canvassers.html generated 2018-06-29T14:15:38.737Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-districts-Districts.html generated 2018-06-29T10:10:59.629Z by adl.to-selmer-templates. <!-- File list-districts-Districts.html generated 2018-06-29T14:15:38.731Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-dwellings-Dwellings.html generated 2018-06-29T10:10:59.622Z by adl.to-selmer-templates. <!-- File list-dwellings-Dwellings.html generated 2018-06-29T14:15:38.723Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
@ -48,7 +48,7 @@ sub-address
<input id='address_id_expanded' type='text' name='address_id_expanded' value='{{ params.address_id_expanded }}'/> <input id='address_id_expanded' type='text' name='address_id_expanded' value='{{ params.address_id_expanded }}'/>
</th> </th>
<th> <th>
<input id='sub-address' type='text' name='sub-address' value='{{ params.sub-address }}'/> <input id='sub_address' type='text' name='sub_address' value='{{ params.sub_address }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search' value='Search'/> <input type='submit' id='search' value='Search'/>
@ -67,7 +67,7 @@ sub-address
</a> </a>
</td> </td>
<td> <td>
{{ record.sub-address }} {{ record.sub_address }}
</td> </td>
<td> <td>
<a href='form-dwellings-Dwelling?id={{ record.id }}'> <a href='form-dwellings-Dwelling?id={{ record.id }}'>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-electors-Electors.html generated 2018-06-29T10:10:59.606Z by adl.to-selmer-templates. <!-- File list-electors-Electors.html generated 2018-06-29T14:15:38.708Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-followupactions-Followupactions.html generated 2018-06-29T10:10:59.634Z by adl.to-selmer-templates. <!-- File list-followupactions-Followupactions.html generated 2018-06-29T14:15:38.736Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-followupmethods-Followupmethods.html generated 2018-06-29T10:10:59.612Z by adl.to-selmer-templates. <!-- File list-followupmethods-Followupmethods.html generated 2018-06-29T14:15:38.713Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-followuprequests-Followuprequests.html generated 2018-06-29T10:10:59.592Z by adl.to-selmer-templates. <!-- File list-followuprequests-Followuprequests.html generated 2018-06-29T14:15:38.694Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-genders-Genders.html generated 2018-06-29T10:10:59.584Z by adl.to-selmer-templates. <!-- File list-genders-Genders.html generated 2018-06-29T14:15:38.687Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-intentions-Intentions.html generated 2018-06-29T10:10:59.638Z by adl.to-selmer-templates. <!-- File list-intentions-Intentions.html generated 2018-06-29T14:15:38.739Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
@ -39,6 +39,9 @@ elector_id
<th> <th>
option_id option_id
</th> </th>
<th>
locality
</th>
</tr> </tr>
<tr> <tr>
<th> <th>
@ -51,6 +54,9 @@ option_id
<input id='option_id_expanded' type='text' name='option_id_expanded' value='{{ params.option_id_expanded }}'/> <input id='option_id_expanded' type='text' name='option_id_expanded' value='{{ params.option_id_expanded }}'/>
</th> </th>
<th> <th>
<input id='locality' type='number' name='locality' value='{{ params.locality }}'/>
</th>
<th>
<input type='submit' id='search' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
@ -74,6 +80,9 @@ option_id
</a> </a>
</td> </td>
<td> <td>
{{ record.locality }}
</td>
<td>
<a href='form-intentions-Intention?Id={{ record.Id }}'> <a href='form-intentions-Intention?Id={{ record.Id }}'>
View View
</a> </a>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-issues-Issues.html generated 2018-06-29T10:10:59.630Z by adl.to-selmer-templates. <!-- File list-issues-Issues.html generated 2018-06-29T14:15:38.732Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-options-Options.html generated 2018-06-29T10:10:59.593Z by adl.to-selmer-templates. <!-- File list-options-Options.html generated 2018-06-29T14:15:38.696Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-roles-Roles.html generated 2018-06-29T10:10:59.611Z by adl.to-selmer-templates. <!-- File list-roles-Roles.html generated 2018-06-29T14:15:38.712Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-teams-Teams.html generated 2018-06-29T10:10:59.588Z by adl.to-selmer-templates. <!-- File list-teams-Teams.html generated 2018-06-29T14:15:38.690Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-visits-Visits.html generated 2018-06-29T10:10:59.586Z by adl.to-selmer-templates. <!-- File list-visits-Visits.html generated 2018-06-29T14:15:38.689Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block head %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>

View file

@ -16,12 +16,12 @@
<div id="nav"> <div id="nav">
<img id="nav-icon" src="img/threelines.png" alt="Menu"/> <img id="nav-icon" src="img/threelines.png" alt="Menu"/>
<menu id="nav-menu" class="nav"> <menu id="nav-menu" class="nav">
<li class=""><a href="index.html">Home</a></li> <li class=""><a href="home">Home</a></li>
<li class=""><a href="library.html">Library</a></li> <li class=""><a href="library">Library</a></li>
<li class=""><a href="register.html">Register</a></li> <li class=""><a href="register">Register</a></li>
<li class="">{% if user %}<a href="logout.html">Logout</a> <li class="">{% if user %}<a href="logout.html">Logout</a>
{% else %}<a href="login.html">Login</a>{% endif %}</li> {% else %}<a href="login">Login</a>{% endif %}</li>
<li class=""><a href="about.html">About</a></li> <li class=""><a href="about">About</a></li>
{% if user %} {% if user %}
<li id="user"><a href="profile">Logged in as {{user.username}}</a></li> <li id="user"><a href="profile">Logged in as {{user.username}}</a></li>
{% endif %} {% endif %}

View file

@ -16,12 +16,12 @@
<div id="nav"> <div id="nav">
<img id="nav-icon" src="img/threelines.png" alt="Menu"/> <img id="nav-icon" src="img/threelines.png" alt="Menu"/>
<menu id="nav-menu" class="nav"> <menu id="nav-menu" class="nav">
<li class=""><a href="index.html">Home</a></li> <li class=""><a href="home">Home</a></li>
<li class=""><a href="library.html">Library</a></li> <li class=""><a href="library">Library</a></li>
<li class=""><a href="register.html">Register</a></li> <li class=""><a href="register">Register</a></li>
<li class="">{% if user %}<a href="logout.html">Logout</a> <li class="">{% if user %}<a href="logout">Logout</a>
{% else %}<a href="login.html">Login</a>{% endif %}</li> {% else %}<a href="login">Login</a>{% endif %}</li>
<li class=""><a href="about.html">About</a></li> <li class=""><a href="about">About</a></li>
{% if user %} {% if user %}
<li id="user"><a href="profile">Logged in as {{user.username}}</a></li> <li id="user"><a href="profile">Logged in as {{user.username}}</a></li>
{% endif %} {% endif %}

View file

@ -1,12 +1,26 @@
{% extends "base-unauthenticated.html" %} {% extends "base-unauthenticated.html" %}
{% block content %} {% block content %}
<div id="back-link-container">
<a href="javascript:history.back()" id="back-link">Back</a>
</div>
{% for authority in authorities %}
<div class="big-link-container">
<a href="auth?authority={{authority.id}}" class="big-link" id="{{authority.id}}-link">
<img src="img/authorities/{{authority.id}}.png" width="32" height="32" alt="{{authority.id}}"/>
{{authority.id}}
</a>
</div>
{% endfor %}
<form action="auth" method="post">
{% csrf-field %}
<h2>
Or use a test username and password
</h2>
<p> <p>
We're not going to do login in the long term; we're going to use We're not going to do login in the long term; we're going to use
<a href="https://oauth.net/2/">oauth</a>. <a href="https://oauth.net/2/">oauth</a>.
This is a temporary login form. This is a temporary login form.
</p> </p>
<form action="auth" method="post">
{% csrf-field %}
<p class="widget"> <p class="widget">
<label for="username">Username</label> <label for="username">Username</label>
<input type="text" id="username" name="username"/> <input type="text" id="username" name="username"/>

View file

@ -5,6 +5,7 @@
[compojure.core :refer [routes wrap-routes]] [compojure.core :refer [routes wrap-routes]]
[compojure.route :as route] [compojure.route :as route]
[mount.core :as mount] [mount.core :as mount]
[noir.session :as session]
[youyesyet.config :refer [env]] [youyesyet.config :refer [env]]
[youyesyet.layout :refer [error-page]] [youyesyet.layout :refer [error-page]]
[youyesyet.middleware :as middleware] [youyesyet.middleware :as middleware]
@ -73,7 +74,7 @@
(-> #'auto-selmer-routes (-> #'auto-selmer-routes
(wrap-routes middleware/wrap-csrf) (wrap-routes middleware/wrap-csrf)
(wrap-routes middleware/wrap-formats)) (wrap-routes middleware/wrap-formats))
#'oauth-routes 'oauth-routes
#'authenticated-routes #'authenticated-routes
(route/not-found (route/not-found
(:body (:body

View file

@ -1,35 +1,101 @@
(ns youyesyet.oauth (ns ^{:doc "Handle oauth with multiple authenticating authorities."
:author "Simon Brooke"} youyesyet.oauth
(:require [youyesyet.config :refer [env]] (:require [youyesyet.config :refer [env]]
[youyesyet.db.core :as db]
[oauth.client :as oauth] [oauth.client :as oauth]
[mount.core :refer [defstate]] [mount.core :refer [defstate]]
[clojure.tools.logging :as log])) [clojure.tools.logging :as log]))
(defstate consumer ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:start (oauth/make-consumer ;;;;
(env :oauth-consumer-key) ;;;; youyesyet.routes.home: routes and pages for unauthenticated users.
(env :oauth-consumer-secret) ;;;;
(env :request-token-uri) ;;;; This program is free software; you can redistribute it and/or
(env :access-token-uri) ;;;; modify it under the terms of the GNU General Public License
(env :authorize-uri) ;;;; as published by the Free Software Foundation; either version 2
:hmac-sha1)) ;;;; of the License, or (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;;; USA.
;;;;
;;;; Copyright (C) 2016 Simon Brooke for Radical Independence Campaign
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn get-authorities
"Fetch the authorities from the database and return a map of them."
[_]
(reduce
merge
{}
(map
(fn [authority]
(hash-map
(:id authority)
(oauth/make-consumer
(:consumer_key authority)
(:consumer_secret authority)
(:request_token_uri authority)
(:access_token_uri authority)
(:authorize_uri authority)
:hmac-sha1)))
(db/list-authorities db/*db* {}))))
(def authority!
;; Closure to allow authorities to be created once when the function is first
;; called. The argument `id` should be a string, the id of some authority
;; known to the database. As side-effect, the key `:authority` is bound in the
;; session to the selected authority.
(let [authorities (atom nil)]
(fn [id]
(if
(nil? @authorities)
(do
(log/debug "Initialising authorities map")
(swap!
authorities
get-authorities)))
(let
[authority (@authorities id)]
(if authority
(do
(log/debug (str "Selected authority " id))
(session/put! :authority authority)))
authority))))
(defn oauth-callback-uri (defn oauth-callback-uri
"Generates the oauth request callback URI" "Generates the oauth request callback URI."
[{:keys [headers]}] [{:keys [headers]}]
(str (headers "x-forwarded-proto") "://" (headers "host") "/oauth/twitter-callback")) (str (headers "x-forwarded-proto") "://" (headers "host") "/oauth/oauth-callback"))
(defn fetch-request-token (defn fetch-request-token
"Fetches a request token." "Fetches a request token from the authority implied by this `request`."
[request] [request]
(let [callback-uri (oauth-callback-uri request)] (let [callback-uri (oauth-callback-uri request)
auth-id (:authority (:params request))
auth (authority! auth-id)]
(log/info "Attempting to authorise with authority " auth-id)
(if
auth
(do
(log/info "Fetching request token using callback-uri" callback-uri) (log/info "Fetching request token using callback-uri" callback-uri)
(oauth/request-token consumer (oauth-callback-uri request)))) (oauth/request-token auth (oauth-callback-uri request)))
(throw (Exception. (str "No such authority: " auth-id))))))
(defn fetch-access-token (defn fetch-access-token
[request_token] [request_token]
(oauth/access-token consumer request_token (:oauth_verifier request_token))) (oauth/access-token (session/get :authority) request_token (:oauth_verifier request_token)))
(defn auth-redirect-uri (defn auth-redirect-uri
"Gets the URI the user should be redirected to when authenticating." "Gets the URI the user should be redirected to when authenticating."
[request-token] [request-token]
(str (oauth/user-approval-uri consumer request-token))) (str (oauth/user-approval-uri (session/get :authority) request-token)))

View file

@ -1,6 +1,6 @@
(ns (ns
youyesyet.routes.auto youyesyet.routes.auto
"User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180629T101059.328Z" "User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180629T141538.443Z"
(:require (:require
[adl-support.core :as support] [adl-support.core :as support]
[clojure.java.io :as io] [clojure.java.io :as io]

View file

@ -1,6 +1,6 @@
(ns (ns
youyesyet.routes.auto-json youyesyet.routes.auto-json
"JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180629T101058.294Z" "JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180629T141537.425Z"
(:require (:require
[adl-support.core :as support] [adl-support.core :as support]
[clojure.java.io :as io] [clojure.java.io :as io]
@ -118,6 +118,7 @@
search-strings-team search-strings-team
search-strings-visit search-strings-visit
update-address! update-address!
update-authority!
update-canvasser! update-canvasser!
update-district! update-district!
update-dwelling! update-dwelling!
@ -553,6 +554,10 @@
"/json/auto/update-address" "/json/auto/update-address"
request request
(route/restricted (update-address! request))) (route/restricted (update-address! request)))
(POST
"/json/auto/update-authority"
request
(route/restricted (update-authority! request)))
(POST (POST
"/json/auto/update-canvasser" "/json/auto/update-canvasser"
request request
@ -1224,6 +1229,13 @@
(do (db/update-address! params)) (do (db/update-address! params))
(response/found "/")) (response/found "/"))
(defn
update-authority!
"Auto-generated method to update one record in the `authorities` table. Expects the following key(s) to be present in `params`: `(nil)`."
[{:keys [params]}]
(do (db/update-authority! params))
(response/found "/"))
(defn (defn
update-canvasser! update-canvasser!
"Auto-generated method to update one record in the `canvassers` table. Expects the following key(s) to be present in `params`: `(nil)`." "Auto-generated method to update one record in the `canvassers` table. Expects the following key(s) to be present in `params`: `(nil)`."

View file

@ -7,6 +7,7 @@
[ring.util.http-response :refer [content-type ok]] [ring.util.http-response :refer [content-type ok]]
[youyesyet.layout :as layout] [youyesyet.layout :as layout]
[youyesyet.db.core :as db-core] [youyesyet.db.core :as db-core]
[youyesyet.oauth :as oauth]
[compojure.core :refer [defroutes GET POST]] [compojure.core :refer [defroutes GET POST]]
[ring.util.http-response :as response] [ring.util.http-response :as response]
[clojure.java.io :as io])) [clojure.java.io :as io]))
@ -77,13 +78,15 @@
(defn login-page (defn login-page
"This is very temporary. We're going to do authentication by oauth." "This is very temporary. We're going to do authentication by oauth."
[request] [request]
(let [params (keywordize-keys (:form-params request)) (let [params (keywordize-keys (:params request))
session (:session request) session (:session request)
username (:username params) username (:username params)
user (if username (db-core/get-canvasser-by-username db-core/*db* {:username username})) user (if username (db-core/get-canvasser-by-username db-core/*db* {:username username}))
password (:password params) password (:password params)
redirect-to (or (:redirect-to params) "roles")] redirect-to (or (:redirect-to params) "roles")]
(cond (cond
(:authority params)
(oauth/fetch-request-token request)
;; this is obviously, ABSURDLY, insecure. I don't want to put just-about-good-enough, ;; this is obviously, ABSURDLY, insecure. I don't want to put just-about-good-enough,
;; it-will-do-for-now security in place; instead, I want this to be test code only ;; it-will-do-for-now security in place; instead, I want this to be test code only
;; until we have o-auth properly working. ;; until we have o-auth properly working.
@ -92,7 +95,7 @@
user user
(layout/render "login.html" {:title (str "User " username " is unknown") :redirect-to redirect-to}) (layout/render "login.html" {:title (str "User " username " is unknown") :redirect-to redirect-to})
true true
(layout/render "login.html" {:title "Please log in" :redirect-to redirect-to})))) (layout/render "login.html" {:title "Please log in" :redirect-to redirect-to :authorities (db-core/list-authorities db-core/*db*)}))))
(defroutes home-routes (defroutes home-routes

View file

@ -7,7 +7,7 @@
[clojure.tools.logging :as log])) [clojure.tools.logging :as log]))
(defn oauth-init (defn oauth-init
"Initiates the Twitter OAuth" "Initiates the OAuth with the authority implied by this `request`"
[request] [request]
(-> (oauth/fetch-request-token request) (-> (oauth/fetch-request-token request)
:oauth_token :oauth_token
@ -15,11 +15,11 @@
found)) found))
(defn oauth-callback (defn oauth-callback
"Handles the callback from Twitter." "Handles the callback from the authority."
[request_token {:keys [session]}] [request_token {:keys [session]}]
; oauth request was denied by user ; oauth request was denied by user
(if (:denied request_token) (if (:denied request_token)
(-> (found "/") (-> (found "/login")
(assoc :flash {:denied true})) (assoc :flash {:denied true}))
; fetch the request token and do anything else you wanna do if not denied. ; fetch the request token and do anything else you wanna do if not denied.
(let [{:keys [user_id screen_name]} (oauth/fetch-access-token request_token)] (let [{:keys [user_id screen_name]} (oauth/fetch-access-token request_token)]

View file

@ -263,8 +263,25 @@
<prompt prompt="id" locale="en-GB"/> <prompt prompt="id" locale="en-GB"/>
</property> </property>
</key> </key>
<list name="Authorities" properties="all"/> <property name="request-token-uri" type="string" size="256" required="true"/>
<form name="Authority" properties="all"/> <property name="access-token-uri" type="string" size="256" required="true"/>
<property name="authorize-uri" type="string" size="256" required="true"/>
<property name="consumer-key" type="string" size="32" required="true" default="youyesyet"/>
<property name="consumer-secret" type="string" size="256" required="true"/>
<list name="Authorities" properties="listed">
<field property="id"><prompt prompt="id" locale="en-GB"/></field>#
<field property="request-token-uri"/>
<field property="access-token-uri"/>
<field property="authorize-uri"/>
</list>
<form name="Authority" properties="all">
<permission group="canvassers" permission="none"/>
<permission group="teamorganisers" permission="none"/>
<permission group="issueexperts" permission="none"/>
<permission group="analysts" permission="none"/>
<permission group="issueeditors" permission="none"/>
<permission group="admin" permission="all"/>
</form>
<permission group="canvassers" permission="read"/> <permission group="canvassers" permission="read"/>
<permission group="teamorganisers" permission="read"/> <permission group="teamorganisers" permission="read"/>
<permission group="issueexperts" permission="read"/> <permission group="issueexperts" permission="read"/>

View file

@ -145,7 +145,12 @@
entity dwellings already has a key - not generating one entity dwellings already has a key - not generating one
--> -->
<entity table="dwellings" name="dwellings" magnitude="6"> <entity table="dwellings" name="dwellings" magnitude="6">
<documentation>All dwellings within addresses in the system; a dwelling is a house, flat or appartment in which electors live.</documentation> <documentation>All dwellings within addresses in the system; a dwelling is a
house, flat or appartment in which electors live. Every address should have
at least one dwelling; essentially, an address maps onto a street door and
dwellings map onto what's behind that door. So a tenement or a block of flats
would be one address with many dwellings.
</documentation>
<key> <key>
<property required="true" type="integer" name="id" column="id" immutable="true" distinct="system"> <property required="true" type="integer" name="id" column="id" immutable="true" distinct="system">
<prompt prompt="id" locale="en-GB"/> <prompt prompt="id" locale="en-GB"/>
@ -280,8 +285,18 @@
<prompt prompt="id" locale="en-GB"/> <prompt prompt="id" locale="en-GB"/>
</property> </property>
</key> </key>
<list properties="listed" name="Authorities"><field property="id"><prompt prompt="id" locale="en-GB"/></field></list> <property name="request-token-uri" type="string" size="256" required="true"/>
<form properties="listed" name="Authority"><field property="id"><prompt prompt="id" locale="en-GB"/></field></form> <property name="access-token-uri" type="string" size="256" required="true"/>
<property name="authorize-uri" type="string" size="256" required="true"/>
<property name="consumer-key" type="string" size="32" required="true" default="youyesyet"/>
<property name="consumer-secret" type="string" size="256" required="true"/>
<list name="Authorities" properties="listed">
<field property="id"><prompt prompt="id" locale="en-GB"/></field>#
<field property="request-token-uri"/>
<field property="access-token-uri"/>
<field property="authorize-uri"/>
</list>
<form properties="listed" name="Authority"><field property="id"><prompt prompt="id" locale="en-GB"/></field><field property="request-token-uri"/><field property="access-token-uri"/><field property="authorize-uri"/><field property="consumer-key"/><field property="consumer-secret"/><permission group="canvassers" permission="none"/><permission group="teamorganisers" permission="none"/><permission group="issueexperts" permission="none"/><permission group="analysts" permission="none"/><permission group="issueeditors" permission="none"/><permission group="admin" permission="all"/></form>
<permission group="canvassers" permission="read"/> <permission group="canvassers" permission="read"/>
<permission group="teamorganisers" permission="read"/> <permission group="teamorganisers" permission="read"/>
<permission group="issueexperts" permission="read"/> <permission group="issueexperts" permission="read"/>
@ -318,7 +333,7 @@
entity intentions has no key - generating one entity intentions has no key - generating one
--> -->
<entity table="intentions" name="intentions" magnitude="6"> <entity table="intentions" name="intentions" magnitude="6">
<documentation>Link table.</documentation> <documentation>Intentions of electors to vote for options elicited in visits.</documentation>
<key> <key>
<property type="integer" distinct="system" required="true" name="Id"> <property type="integer" distinct="system" required="true" name="Id">
<generator action="native"/> <generator action="native"/>
@ -330,12 +345,18 @@
<property required="true" type="entity" entity="visits" farkey="id" name="visit_id" column="visit_id"> <property required="true" type="entity" entity="visits" farkey="id" name="visit_id" column="visit_id">
<prompt prompt="visit_id" locale="en-GB"/> <prompt prompt="visit_id" locale="en-GB"/>
</property> </property>
<property required="true" type="entity" entity="electors" farkey="id" name="elector_id" column="elector_id"> <property type="entity" entity="electors" farkey="id" name="elector_id" column="elector_id">
<prompt prompt="elector_id" locale="en-GB"/> <prompt prompt="elector_id" locale="en-GB"/>
</property> </property>
<property required="true" type="entity" entity="options" farkey="id" name="option_id" column="option_id"> <property required="true" type="entity" entity="options" farkey="id" name="option_id" column="option_id">
<prompt prompt="option_id" locale="en-GB"/> <prompt prompt="option_id" locale="en-GB"/>
</property> </property>
<property name="locality" type="integer" required="true">
<documentation>
The locality at which the intention was recorded; used where an elector does not consent to
have polling intention stored against them. This is a locality as described in
</documentation>
</property>
<permission permission="none" group="public"/> <permission permission="none" group="public"/>
<permission group="canvassers" permission="noedit"/> <permission group="canvassers" permission="noedit"/>
<permission group="teamorganisers" permission="none"/> <permission group="teamorganisers" permission="none"/>
@ -353,6 +374,12 @@
<field property="option_id"> <field property="option_id">
<prompt prompt="option_id" locale="en-GB"/> <prompt prompt="option_id" locale="en-GB"/>
</field> </field>
<field property="locality">
<documentation>
The locality at which the intention was recorded; used where an elector does not consent to
have polling intention stored against them. This is a locality as described in
</documentation>
</field>
</list> </list>
<form properties="listed" name="Intention"> <form properties="listed" name="Intention">
<field property="visit_id"> <field property="visit_id">
@ -364,6 +391,12 @@
<field property="option_id"> <field property="option_id">
<prompt prompt="option_id" locale="en-GB"/> <prompt prompt="option_id" locale="en-GB"/>
</field> </field>
<field property="locality">
<documentation>
The locality at which the intention was recorded; used where an elector does not consent to
have polling intention stored against them. This is a locality as described in
</documentation>
</field>
</form> </form>
</entity> </entity>
<!-- <!--
@ -518,6 +551,13 @@
</permission> </permission>
<list properties="listed" name="Teams"><field property="id"><prompt prompt="id" locale="en-GB"/></field><field property="name"><prompt prompt="name" locale="en-GB"/></field><field property="district_id"><prompt prompt="district_id" locale="en-GB"/></field><field property="latitude"><prompt prompt="latitude" locale="en-GB"/></field><field property="longitude"><prompt prompt="longitude" locale="en-GB"/></field></list> <list properties="listed" name="Teams"><field property="id"><prompt prompt="id" locale="en-GB"/></field><field property="name"><prompt prompt="name" locale="en-GB"/></field><field property="district_id"><prompt prompt="district_id" locale="en-GB"/></field><field property="latitude"><prompt prompt="latitude" locale="en-GB"/></field><field property="longitude"><prompt prompt="longitude" locale="en-GB"/></field></list>
<form properties="listed" name="Team"><field property="id"><prompt prompt="id" locale="en-GB"/></field><field property="name"><prompt prompt="name" locale="en-GB"/></field><field property="district_id"><prompt prompt="district_id" locale="en-GB"/></field><field property="latitude"><prompt prompt="latitude" locale="en-GB"/></field><field property="members"><prompt prompt="Members" locale="en-GB"/></field><field property="organisers"><prompt prompt="Organisers" locale="en-GB"/></field><field property="longitude"><prompt prompt="longitude" locale="en-GB"/></field></form> <form properties="listed" name="Team"><field property="id"><prompt prompt="id" locale="en-GB"/></field><field property="name"><prompt prompt="name" locale="en-GB"/></field><field property="district_id"><prompt prompt="district_id" locale="en-GB"/></field><field property="latitude"><prompt prompt="latitude" locale="en-GB"/></field><field property="members"><prompt prompt="Members" locale="en-GB"/></field><field property="organisers"><prompt prompt="Organisers" locale="en-GB"/></field><field property="longitude"><prompt prompt="longitude" locale="en-GB"/></field></form>
<permission permission="none" group="public"/>
<permission permission="read" group="canvassers"/>
<permission permission="edit" group="teamorganisers"/>
<permission permission="read" group="issueexperts"/>
<permission permission="read" group="analysts"/>
<permission permission="read" group="issueeditors"/>
<permission permission="all" group="admin"/>
</entity> </entity>
<!-- <!--
entity districts already has a key - not generating one entity districts already has a key - not generating one