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:
parent
88468461fd
commit
4e296537c4
2
env/dev/clj/youyesyet/dev_middleware.clj
vendored
2
env/dev/clj/youyesyet/dev_middleware.clj
vendored
|
@ -1,6 +1,6 @@
|
|||
(ns youyesyet.dev-middleware
|
||||
(: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]]
|
||||
[prone.middleware :refer [wrap-exceptions]]
|
||||
))
|
||||
|
|
BIN
resources/public/img/authorities/GitHub.png
Normal file
BIN
resources/public/img/authorities/GitHub.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
resources/public/img/authorities/GitHub.xcf
Normal file
BIN
resources/public/img/authorities/GitHub.xcf
Normal file
Binary file not shown.
BIN
resources/public/img/authorities/Twitter.jpg
Normal file
BIN
resources/public/img/authorities/Twitter.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
resources/public/img/authorities/Twitter.png
Normal file
BIN
resources/public/img/authorities/Twitter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
resources/public/img/authorities/Twitter.xcf
Normal file
BIN
resources/public/img/authorities/Twitter.xcf
Normal file
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
------------------------------------------------------------------------
|
||||
-- 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
|
||||
-- Language](https://github.com/simon-brooke/adl).
|
||||
|
@ -27,8 +27,18 @@ returning id
|
|||
|
||||
-- :name create-authority! :! :n
|
||||
-- :doc creates a new authority record
|
||||
INSERT INTO authorities (id)
|
||||
VALUES (:id)
|
||||
INSERT INTO authorities (request_token_uri,
|
||||
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
|
||||
|
||||
-- :name create-canvasser! :! :n
|
||||
|
@ -121,10 +131,12 @@ returning id
|
|||
-- :doc creates a new intention record
|
||||
INSERT INTO intentions (visit_id,
|
||||
elector_id,
|
||||
option_id)
|
||||
option_id,
|
||||
locality)
|
||||
VALUES (:visit_id,
|
||||
:elector_id,
|
||||
:option_id)
|
||||
:option_id,
|
||||
:locality)
|
||||
returning Id
|
||||
|
||||
-- :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
|
||||
SELECT * FROM lv_authorities
|
||||
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 (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
@ -868,6 +885,7 @@ WHERE false
|
|||
--~ (if (:visit_id params) "OR visit_id = :visit_id")
|
||||
--~ (if (:elector_id params) "OR elector_id = :elector_id")
|
||||
--~ (if (:option_id params) "OR option_id = :option_id")
|
||||
--~ (if (:locality params) "OR locality = :locality")
|
||||
--~ (if (:Id params) "OR Id = :Id")
|
||||
--~ (if (:offset params) "OFFSET :offset ")
|
||||
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
|
||||
|
@ -941,6 +959,17 @@ SET address = :address,
|
|||
locality = :locality
|
||||
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
|
||||
-- :doc updates an existing canvasser record
|
||||
UPDATE canvassers
|
||||
|
@ -1001,7 +1030,8 @@ WHERE followuprequests.id = :id
|
|||
UPDATE intentions
|
||||
SET visit_id = :visit_id,
|
||||
elector_id = :elector_id,
|
||||
option_id = :option_id
|
||||
option_id = :option_id,
|
||||
locality = :locality
|
||||
WHERE intentions.Id = :Id
|
||||
|
||||
-- :name update-issue! :! :n
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
--
|
||||
-- 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
|
||||
|
@ -99,7 +99,12 @@ GRANT DELETE ON addresses TO admin ;
|
|||
------------------------------------------------------------------------
|
||||
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,
|
||||
analysts,
|
||||
|
@ -167,8 +172,15 @@ GRANT DELETE ON districts TO admin ;
|
|||
------------------------------------------------------------------------
|
||||
-- primary table dwellings for entity dwellings
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
------------------------------------------------------------------------
|
||||
CREATE TABLE dwellings
|
||||
(
|
||||
|
@ -298,14 +310,15 @@ GRANT DELETE ON genders TO admin ;
|
|||
------------------------------------------------------------------------
|
||||
-- primary table intentions for entity intentions
|
||||
--
|
||||
-- Link table.
|
||||
-- Intentions of electors to vote for options elicited in visits.
|
||||
------------------------------------------------------------------------
|
||||
CREATE TABLE intentions
|
||||
(
|
||||
Id SERIAL NOT NULL PRIMARY KEY,
|
||||
visit_id INTEGER NOT NULL,
|
||||
elector_id INTEGER NOT NULL,
|
||||
option_id VARCHAR(32) NOT NULL
|
||||
elector_id INTEGER,
|
||||
option_id VARCHAR(32) NOT NULL,
|
||||
locality INTEGER NOT NULL
|
||||
);
|
||||
GRANT SELECT ON intentions TO admin,
|
||||
analysts,
|
||||
|
@ -455,7 +468,12 @@ GRANT SELECT ON lv_addresses TO admin,
|
|||
-- cetera
|
||||
------------------------------------------------------------------------
|
||||
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
|
||||
;
|
||||
GRANT SELECT ON lv_authorities TO admin,
|
||||
|
@ -641,6 +659,7 @@ SELECT addresses.address ||', '|| addresses.postcode ||', '|| visits.date AS vis
|
|||
intentions.elector_id,
|
||||
options.id AS option_id_expanded,
|
||||
intentions.option_id,
|
||||
intentions.locality,
|
||||
intentions.Id
|
||||
FROM visits, intentions, addresses, genders, electors, options
|
||||
WHERE intentions.visit_id = visits.id
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
@ -49,7 +49,12 @@ Dwelling
|
|||
</dt>
|
||||
<dd>
|
||||
<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>
|
||||
</dd>
|
||||
<dt>
|
||||
|
@ -99,7 +104,7 @@ Intention
|
|||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
Link table.
|
||||
Intentions of electors to vote for options elicited in visits.
|
||||
</p>
|
||||
</dd>
|
||||
<dt>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<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 %}
|
||||
</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'>
|
||||
<label for='save-button' class='action-safe'>
|
||||
To save this authorities record
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<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 %}
|
||||
</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'>
|
||||
<label for='save-button' class='action-safe'>
|
||||
To save this intentions record
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<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'>
|
||||
id
|
||||
</label>
|
||||
{% ifmemberof teamorganisers admin %}
|
||||
{% ifmemberof teamorganisers admin teamorganisers admin %}
|
||||
<input id='id' name='id' type='text' value='{{record.id}}' maxlength='' size='16'/>
|
||||
{% 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'>
|
||||
{{record.id}}
|
||||
</span>
|
||||
|
@ -46,10 +46,10 @@ You are not permitted to view id of teams
|
|||
<label for='name'>
|
||||
name
|
||||
</label>
|
||||
{% ifmemberof teamorganisers admin %}
|
||||
{% ifmemberof teamorganisers admin teamorganisers admin %}
|
||||
<input id='name' name='name' type='text' value='{{record.name}}' maxlength='64' size='60'/>
|
||||
{% 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'>
|
||||
{{record.name}}
|
||||
</span>
|
||||
|
@ -64,7 +64,7 @@ You are not permitted to view name of teams
|
|||
<label for='district_id'>
|
||||
district_id
|
||||
</label>
|
||||
{% ifmemberof teamorganisers admin %}
|
||||
{% ifmemberof teamorganisers admin teamorganisers admin %}
|
||||
<div class='select-box' farside='districts' found='true'>
|
||||
<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'>
|
||||
|
@ -72,7 +72,7 @@ district_id
|
|||
</select>
|
||||
</div>
|
||||
{% 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'>
|
||||
{{record.district_id}}
|
||||
</span>
|
||||
|
@ -87,10 +87,10 @@ You are not permitted to view district_id of teams
|
|||
<label for='latitude'>
|
||||
latitude
|
||||
</label>
|
||||
{% ifmemberof teamorganisers admin %}
|
||||
{% ifmemberof teamorganisers admin teamorganisers admin %}
|
||||
<input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/>
|
||||
{% 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'>
|
||||
{{record.latitude}}
|
||||
</span>
|
||||
|
@ -105,7 +105,7 @@ You are not permitted to view latitude of teams
|
|||
<label for='members'>
|
||||
members
|
||||
</label>
|
||||
{% ifmemberof teamorganisers admin %}
|
||||
{% ifmemberof teamorganisers admin teamorganisers admin %}
|
||||
<div class='select-box' farside='canvassers' found='true'>
|
||||
<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'>
|
||||
|
@ -113,7 +113,7 @@ members
|
|||
</select>
|
||||
</div>
|
||||
{% 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'>
|
||||
{{record.members}}
|
||||
</span>
|
||||
|
@ -128,7 +128,7 @@ You are not permitted to view members of teams
|
|||
<label for='organisers'>
|
||||
organisers
|
||||
</label>
|
||||
{% ifmemberof teamorganisers admin %}
|
||||
{% ifmemberof teamorganisers admin teamorganisers admin %}
|
||||
<div class='select-box' farside='canvassers' found='true'>
|
||||
<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'>
|
||||
|
@ -136,7 +136,7 @@ organisers
|
|||
</select>
|
||||
</div>
|
||||
{% 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'>
|
||||
{{record.organisers}}
|
||||
</span>
|
||||
|
@ -151,10 +151,10 @@ You are not permitted to view organisers of teams
|
|||
<label for='longitude'>
|
||||
longitude
|
||||
</label>
|
||||
{% ifmemberof teamorganisers admin %}
|
||||
{% ifmemberof teamorganisers admin teamorganisers admin %}
|
||||
<input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/>
|
||||
{% 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'>
|
||||
{{record.longitude}}
|
||||
</span>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
@ -33,12 +33,30 @@ Add a new Authority
|
|||
<th>
|
||||
id
|
||||
</th>
|
||||
<th>
|
||||
request-token-uri
|
||||
</th>
|
||||
<th>
|
||||
access-token-uri
|
||||
</th>
|
||||
<th>
|
||||
authorize-uri
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<input id='id' type='text' name='id' value='{{ params.id }}'/>
|
||||
</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'/>
|
||||
</th>
|
||||
</tr>
|
||||
|
@ -50,6 +68,15 @@ id
|
|||
{{ record.id }}
|
||||
</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 }}'>
|
||||
View
|
||||
</a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<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 }}'/>
|
||||
</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>
|
||||
<input type='submit' id='search' value='Search'/>
|
||||
|
@ -67,7 +67,7 @@ sub-address
|
|||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ record.sub-address }}
|
||||
{{ record.sub_address }}
|
||||
</td>
|
||||
<td>
|
||||
<a href='form-dwellings-Dwelling?id={{ record.id }}'>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
@ -39,6 +39,9 @@ elector_id
|
|||
<th>
|
||||
option_id
|
||||
</th>
|
||||
<th>
|
||||
locality
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
|
@ -51,6 +54,9 @@ option_id
|
|||
<input id='option_id_expanded' type='text' name='option_id_expanded' value='{{ params.option_id_expanded }}'/>
|
||||
</th>
|
||||
<th>
|
||||
<input id='locality' type='number' name='locality' value='{{ params.locality }}'/>
|
||||
</th>
|
||||
<th>
|
||||
<input type='submit' id='search' value='Search'/>
|
||||
</th>
|
||||
</tr>
|
||||
|
@ -74,6 +80,9 @@ option_id
|
|||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ record.locality }}
|
||||
</td>
|
||||
<td>
|
||||
<a href='form-intentions-Intention?Id={{ record.Id }}'>
|
||||
View
|
||||
</a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% 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).-->
|
||||
{% block head %}
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
<div id="nav">
|
||||
<img id="nav-icon" src="img/threelines.png" alt="Menu"/>
|
||||
<menu id="nav-menu" class="nav">
|
||||
<li class=""><a href="index.html">Home</a></li>
|
||||
<li class=""><a href="library.html">Library</a></li>
|
||||
<li class=""><a href="register.html">Register</a></li>
|
||||
<li class=""><a href="home">Home</a></li>
|
||||
<li class=""><a href="library">Library</a></li>
|
||||
<li class=""><a href="register">Register</a></li>
|
||||
<li class="">{% if user %}<a href="logout.html">Logout</a>
|
||||
{% else %}<a href="login.html">Login</a>{% endif %}</li>
|
||||
<li class=""><a href="about.html">About</a></li>
|
||||
{% else %}<a href="login">Login</a>{% endif %}</li>
|
||||
<li class=""><a href="about">About</a></li>
|
||||
{% if user %}
|
||||
<li id="user"><a href="profile">Logged in as {{user.username}}</a></li>
|
||||
{% endif %}
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
<div id="nav">
|
||||
<img id="nav-icon" src="img/threelines.png" alt="Menu"/>
|
||||
<menu id="nav-menu" class="nav">
|
||||
<li class=""><a href="index.html">Home</a></li>
|
||||
<li class=""><a href="library.html">Library</a></li>
|
||||
<li class=""><a href="register.html">Register</a></li>
|
||||
<li class="">{% if user %}<a href="logout.html">Logout</a>
|
||||
{% else %}<a href="login.html">Login</a>{% endif %}</li>
|
||||
<li class=""><a href="about.html">About</a></li>
|
||||
<li class=""><a href="home">Home</a></li>
|
||||
<li class=""><a href="library">Library</a></li>
|
||||
<li class=""><a href="register">Register</a></li>
|
||||
<li class="">{% if user %}<a href="logout">Logout</a>
|
||||
{% else %}<a href="login">Login</a>{% endif %}</li>
|
||||
<li class=""><a href="about">About</a></li>
|
||||
{% if user %}
|
||||
<li id="user"><a href="profile">Logged in as {{user.username}}</a></li>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
{% extends "base-unauthenticated.html" %}
|
||||
{% 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>
|
||||
We're not going to do login in the long term; we're going to use
|
||||
<a href="https://oauth.net/2/">oauth</a>.
|
||||
This is a temporary login form.
|
||||
</p>
|
||||
<form action="auth" method="post">
|
||||
{% csrf-field %}
|
||||
<p class="widget">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username"/>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
[compojure.core :refer [routes wrap-routes]]
|
||||
[compojure.route :as route]
|
||||
[mount.core :as mount]
|
||||
[noir.session :as session]
|
||||
[youyesyet.config :refer [env]]
|
||||
[youyesyet.layout :refer [error-page]]
|
||||
[youyesyet.middleware :as middleware]
|
||||
|
@ -73,7 +74,7 @@
|
|||
(-> #'auto-selmer-routes
|
||||
(wrap-routes middleware/wrap-csrf)
|
||||
(wrap-routes middleware/wrap-formats))
|
||||
#'oauth-routes
|
||||
'oauth-routes
|
||||
#'authenticated-routes
|
||||
(route/not-found
|
||||
(:body
|
||||
|
|
|
@ -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]]
|
||||
[youyesyet.db.core :as db]
|
||||
[oauth.client :as oauth]
|
||||
[mount.core :refer [defstate]]
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
(defstate consumer
|
||||
:start (oauth/make-consumer
|
||||
(env :oauth-consumer-key)
|
||||
(env :oauth-consumer-secret)
|
||||
(env :request-token-uri)
|
||||
(env :access-token-uri)
|
||||
(env :authorize-uri)
|
||||
:hmac-sha1))
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;
|
||||
;;;; youyesyet.routes.home: routes and pages for unauthenticated users.
|
||||
;;;;
|
||||
;;;; This program is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU General Public License
|
||||
;;;; as published by the Free Software Foundation; either version 2
|
||||
;;;; 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
|
||||
"Generates the oauth request callback URI"
|
||||
"Generates the oauth request callback URI."
|
||||
[{: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
|
||||
"Fetches a request token."
|
||||
"Fetches a request token from the authority implied by this `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)
|
||||
(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
|
||||
[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
|
||||
"Gets the URI the user should be redirected to when authenticating."
|
||||
[request-token]
|
||||
(str (oauth/user-approval-uri consumer request-token)))
|
||||
(str (oauth/user-approval-uri (session/get :authority) request-token)))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(ns
|
||||
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
|
||||
[adl-support.core :as support]
|
||||
[clojure.java.io :as io]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(ns
|
||||
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
|
||||
[adl-support.core :as support]
|
||||
[clojure.java.io :as io]
|
||||
|
@ -118,6 +118,7 @@
|
|||
search-strings-team
|
||||
search-strings-visit
|
||||
update-address!
|
||||
update-authority!
|
||||
update-canvasser!
|
||||
update-district!
|
||||
update-dwelling!
|
||||
|
@ -553,6 +554,10 @@
|
|||
"/json/auto/update-address"
|
||||
request
|
||||
(route/restricted (update-address! request)))
|
||||
(POST
|
||||
"/json/auto/update-authority"
|
||||
request
|
||||
(route/restricted (update-authority! request)))
|
||||
(POST
|
||||
"/json/auto/update-canvasser"
|
||||
request
|
||||
|
@ -1224,6 +1229,13 @@
|
|||
(do (db/update-address! params))
|
||||
(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
|
||||
update-canvasser!
|
||||
"Auto-generated method to update one record in the `canvassers` table. Expects the following key(s) to be present in `params`: `(nil)`."
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
[ring.util.http-response :refer [content-type ok]]
|
||||
[youyesyet.layout :as layout]
|
||||
[youyesyet.db.core :as db-core]
|
||||
[youyesyet.oauth :as oauth]
|
||||
[compojure.core :refer [defroutes GET POST]]
|
||||
[ring.util.http-response :as response]
|
||||
[clojure.java.io :as io]))
|
||||
|
@ -77,13 +78,15 @@
|
|||
(defn login-page
|
||||
"This is very temporary. We're going to do authentication by oauth."
|
||||
[request]
|
||||
(let [params (keywordize-keys (:form-params request))
|
||||
(let [params (keywordize-keys (:params request))
|
||||
session (:session request)
|
||||
username (:username params)
|
||||
user (if username (db-core/get-canvasser-by-username db-core/*db* {:username username}))
|
||||
password (:password params)
|
||||
redirect-to (or (:redirect-to params) "roles")]
|
||||
(cond
|
||||
(:authority params)
|
||||
(oauth/fetch-request-token request)
|
||||
;; 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
|
||||
;; until we have o-auth properly working.
|
||||
|
@ -92,7 +95,7 @@
|
|||
user
|
||||
(layout/render "login.html" {:title (str "User " username " is unknown") :redirect-to redirect-to})
|
||||
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
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
[clojure.tools.logging :as log]))
|
||||
|
||||
(defn oauth-init
|
||||
"Initiates the Twitter OAuth"
|
||||
"Initiates the OAuth with the authority implied by this `request`"
|
||||
[request]
|
||||
(-> (oauth/fetch-request-token request)
|
||||
:oauth_token
|
||||
|
@ -15,11 +15,11 @@
|
|||
found))
|
||||
|
||||
(defn oauth-callback
|
||||
"Handles the callback from Twitter."
|
||||
"Handles the callback from the authority."
|
||||
[request_token {:keys [session]}]
|
||||
; oauth request was denied by user
|
||||
(if (:denied request_token)
|
||||
(-> (found "/")
|
||||
(-> (found "/login")
|
||||
(assoc :flash {:denied true}))
|
||||
; 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)]
|
||||
|
|
|
@ -263,8 +263,25 @@
|
|||
<prompt prompt="id" locale="en-GB"/>
|
||||
</property>
|
||||
</key>
|
||||
<list name="Authorities" properties="all"/>
|
||||
<form name="Authority" properties="all"/>
|
||||
<property name="request-token-uri" type="string" size="256" required="true"/>
|
||||
<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="teamorganisers" permission="read"/>
|
||||
<permission group="issueexperts" permission="read"/>
|
||||
|
|
|
@ -145,7 +145,12 @@
|
|||
entity dwellings already has a key - not generating one
|
||||
-->
|
||||
<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>
|
||||
<property required="true" type="integer" name="id" column="id" immutable="true" distinct="system">
|
||||
<prompt prompt="id" locale="en-GB"/>
|
||||
|
@ -280,8 +285,18 @@
|
|||
<prompt prompt="id" locale="en-GB"/>
|
||||
</property>
|
||||
</key>
|
||||
<list properties="listed" name="Authorities"><field property="id"><prompt prompt="id" locale="en-GB"/></field></list>
|
||||
<form properties="listed" name="Authority"><field property="id"><prompt prompt="id" locale="en-GB"/></field></form>
|
||||
<property name="request-token-uri" type="string" size="256" required="true"/>
|
||||
<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="teamorganisers" permission="read"/>
|
||||
<permission group="issueexperts" permission="read"/>
|
||||
|
@ -318,7 +333,7 @@
|
|||
entity intentions has no key - generating one
|
||||
-->
|
||||
<entity table="intentions" name="intentions" magnitude="6">
|
||||
<documentation>Link table.</documentation>
|
||||
<documentation>Intentions of electors to vote for options elicited in visits.</documentation>
|
||||
<key>
|
||||
<property type="integer" distinct="system" required="true" name="Id">
|
||||
<generator action="native"/>
|
||||
|
@ -330,12 +345,18 @@
|
|||
<property required="true" type="entity" entity="visits" farkey="id" name="visit_id" column="visit_id">
|
||||
<prompt prompt="visit_id" locale="en-GB"/>
|
||||
</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"/>
|
||||
</property>
|
||||
<property required="true" type="entity" entity="options" farkey="id" name="option_id" column="option_id">
|
||||
<prompt prompt="option_id" locale="en-GB"/>
|
||||
</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 group="canvassers" permission="noedit"/>
|
||||
<permission group="teamorganisers" permission="none"/>
|
||||
|
@ -353,6 +374,12 @@
|
|||
<field property="option_id">
|
||||
<prompt prompt="option_id" locale="en-GB"/>
|
||||
</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>
|
||||
<form properties="listed" name="Intention">
|
||||
<field property="visit_id">
|
||||
|
@ -364,6 +391,12 @@
|
|||
<field property="option_id">
|
||||
<prompt prompt="option_id" locale="en-GB"/>
|
||||
</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>
|
||||
</entity>
|
||||
<!--
|
||||
|
@ -518,6 +551,13 @@
|
|||
</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>
|
||||
<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 districts already has a key - not generating one
|
||||
|
|
Loading…
Reference in a new issue