Much progress
This commit is contained in:
parent
4e296537c4
commit
635d1830d3
|
@ -1,7 +1,7 @@
|
|||
------------------------------------------------------------------------
|
||||
-- File queries.sql
|
||||
--
|
||||
-- autogenerated by adl.to-hugsql-queries at 2018-06-29T14:15:37.324Z
|
||||
-- autogenerated by adl.to-hugsql-queries at 2018-06-29T16:36:18.648Z
|
||||
--
|
||||
-- See [Application Description
|
||||
-- Language](https://github.com/simon-brooke/adl).
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
--
|
||||
-- auto-generated by [Application Description Language framework]
|
||||
--
|
||||
-- (https://github.com/simon-brooke/adl) at 20180629T141538.194Z
|
||||
-- (https://github.com/simon-brooke/adl) at 20180629T163619.639Z
|
||||
--
|
||||
--
|
||||
-- A web-app intended to be used by canvassers campaigning for a
|
||||
|
@ -860,8 +860,8 @@ ALTER TABLE visits ADD CONSTRAINT ri_visits_canvassers_canvasser_id
|
|||
------------------------------------------------------------------------
|
||||
CREATE TABLE ln_canvassers_roles
|
||||
(
|
||||
canvassers_id INTEGER,
|
||||
roles_id INTEGER
|
||||
canvasser_id INTEGER,
|
||||
role_id INTEGER
|
||||
);
|
||||
GRANT SELECT ON ln_canvassers_roles TO admin,
|
||||
analysts,
|
||||
|
@ -877,13 +877,13 @@ GRANT UPDATE ON ln_canvassers_roles TO admin,
|
|||
teamorganisers ;
|
||||
GRANT DELETE ON ln_canvassers_roles TO admin ;
|
||||
|
||||
ALTER TABLE ln_canvassers_roles ADD CONSTRAINT ri_ln_canvassers_roles_canvassers_canvassers_id
|
||||
FOREIGN KEY( canvassers_id )
|
||||
ALTER TABLE ln_canvassers_roles ADD CONSTRAINT ri_ln_canvassers_roles_canvassers_canvasser_id
|
||||
FOREIGN KEY( canvasser_id )
|
||||
REFERENCES canvassers(id)
|
||||
ON DELETE NO ACTION ;
|
||||
|
||||
ALTER TABLE ln_canvassers_roles ADD CONSTRAINT ri_ln_canvassers_roles_roles_roles_id
|
||||
FOREIGN KEY( roles_id )
|
||||
ALTER TABLE ln_canvassers_roles ADD CONSTRAINT ri_ln_canvassers_roles_roles_role_id
|
||||
FOREIGN KEY( role_id )
|
||||
REFERENCES roles(id)
|
||||
ON DELETE NO ACTION ;
|
||||
|
||||
|
@ -894,8 +894,8 @@ ALTER TABLE ln_canvassers_roles ADD CONSTRAINT ri_ln_canvassers_roles_roles_role
|
|||
------------------------------------------------------------------------
|
||||
CREATE TABLE ln_canvassers_teams
|
||||
(
|
||||
teams_id INTEGER,
|
||||
canvassers_id INTEGER
|
||||
team_id INTEGER,
|
||||
canvasser_id INTEGER
|
||||
);
|
||||
GRANT SELECT ON ln_canvassers_teams TO admin,
|
||||
analysts,
|
||||
|
@ -909,13 +909,13 @@ GRANT UPDATE ON ln_canvassers_teams TO admin,
|
|||
teamorganisers ;
|
||||
GRANT DELETE ON ln_canvassers_teams TO admin ;
|
||||
|
||||
ALTER TABLE ln_canvassers_teams ADD CONSTRAINT ri_ln_canvassers_teams_canvassers_canvassers_id
|
||||
FOREIGN KEY( canvassers_id )
|
||||
ALTER TABLE ln_canvassers_teams ADD CONSTRAINT ri_ln_canvassers_teams_canvassers_canvasser_id
|
||||
FOREIGN KEY( canvasser_id )
|
||||
REFERENCES canvassers(id)
|
||||
ON DELETE NO ACTION ;
|
||||
|
||||
ALTER TABLE ln_canvassers_teams ADD CONSTRAINT ri_ln_canvassers_teams_teams_teams_id
|
||||
FOREIGN KEY( teams_id )
|
||||
ALTER TABLE ln_canvassers_teams ADD CONSTRAINT ri_ln_canvassers_teams_teams_team_id
|
||||
FOREIGN KEY( team_id )
|
||||
REFERENCES teams(id)
|
||||
ON DELETE NO ACTION ;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
<!-- File application-index.html generated 2018-06-29T14:15:38.716Z by adl.to-selmer-templates.
|
||||
<!-- File application-index.html generated 2018-06-29T16:36:20.140Z 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-addresses-Address.html generated 2018-06-29T14:15:38.705Z by adl.to-selmer-templates.
|
||||
<!-- File form-addresses-Address.html generated 2018-06-29T16:36:20.128Z 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-29T14:15:38.724Z by adl.to-selmer-templates.
|
||||
<!-- File form-authorities-Authority.html generated 2018-06-29T16:36:20.148Z 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-canvassers-Canvasser.html generated 2018-06-29T14:15:38.727Z by adl.to-selmer-templates.
|
||||
<!-- File form-canvassers-Canvasser.html generated 2018-06-29T16:36:20.151Z 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-29T14:15:38.696Z by adl.to-selmer-templates.
|
||||
<!-- File form-districts-District.html generated 2018-06-29T16:36:20.120Z 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-29T14:15:38.738Z by adl.to-selmer-templates.
|
||||
<!-- File form-dwellings-Dwelling.html generated 2018-06-29T16:36:20.162Z 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-29T14:15:38.721Z by adl.to-selmer-templates.
|
||||
<!-- File form-electors-Elector.html generated 2018-06-29T16:36:20.144Z 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-29T14:15:38.740Z by adl.to-selmer-templates.
|
||||
<!-- File form-followupactions-Followupaction.html generated 2018-06-29T16:36:20.165Z 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-29T14:15:38.742Z by adl.to-selmer-templates.
|
||||
<!-- File form-followupmethods-Followupmethod.html generated 2018-06-29T16:36:20.167Z 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-29T14:15:38.700Z by adl.to-selmer-templates.
|
||||
<!-- File form-followuprequests-Followuprequest.html generated 2018-06-29T16:36:20.123Z 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-29T14:15:38.691Z by adl.to-selmer-templates.
|
||||
<!-- File form-genders-Gender.html generated 2018-06-29T16:36:20.114Z 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-29T14:15:38.734Z by adl.to-selmer-templates.
|
||||
<!-- File form-intentions-Intention.html generated 2018-06-29T16:36:20.158Z 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-issues-Issue.html generated 2018-06-29T14:15:38.709Z by adl.to-selmer-templates.
|
||||
<!-- File form-issues-Issue.html generated 2018-06-29T16:36:20.133Z 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-29T14:15:38.733Z by adl.to-selmer-templates.
|
||||
<!-- File form-options-Option.html generated 2018-06-29T16:36:20.157Z 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-29T14:15:38.710Z by adl.to-selmer-templates.
|
||||
<!-- File form-roles-Role.html generated 2018-06-29T16:36:20.134Z 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-29T14:15:38.717Z by adl.to-selmer-templates.
|
||||
<!-- File form-teams-Team.html generated 2018-06-29T16:36:20.141Z 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-visits-Visit.html generated 2018-06-29T14:15:38.714Z by adl.to-selmer-templates.
|
||||
<!-- File form-visits-Visit.html generated 2018-06-29T16:36:20.138Z 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-29T14:15:38.726Z by adl.to-selmer-templates.
|
||||
<!-- File list-addresses-Addresses.html generated 2018-06-29T16:36:20.150Z 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-29T14:15:38.699Z by adl.to-selmer-templates.
|
||||
<!-- File list-authorities-Authorities.html generated 2018-06-29T16:36:20.122Z 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-canvassers-Canvassers.html generated 2018-06-29T14:15:38.737Z by adl.to-selmer-templates.
|
||||
<!-- File list-canvassers-Canvassers.html generated 2018-06-29T16:36:20.161Z 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-29T14:15:38.731Z by adl.to-selmer-templates.
|
||||
<!-- File list-districts-Districts.html generated 2018-06-29T16:36:20.155Z 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-29T14:15:38.723Z by adl.to-selmer-templates.
|
||||
<!-- File list-dwellings-Dwellings.html generated 2018-06-29T16:36:20.147Z 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-electors-Electors.html generated 2018-06-29T14:15:38.708Z by adl.to-selmer-templates.
|
||||
<!-- File list-electors-Electors.html generated 2018-06-29T16:36:20.132Z 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-29T14:15:38.736Z by adl.to-selmer-templates.
|
||||
<!-- File list-followupactions-Followupactions.html generated 2018-06-29T16:36:20.160Z 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-29T14:15:38.713Z by adl.to-selmer-templates.
|
||||
<!-- File list-followupmethods-Followupmethods.html generated 2018-06-29T16:36:20.137Z 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-29T14:15:38.694Z by adl.to-selmer-templates.
|
||||
<!-- File list-followuprequests-Followuprequests.html generated 2018-06-29T16:36:20.117Z 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-29T14:15:38.687Z by adl.to-selmer-templates.
|
||||
<!-- File list-genders-Genders.html generated 2018-06-29T16:36:20.110Z 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-29T14:15:38.739Z by adl.to-selmer-templates.
|
||||
<!-- File list-intentions-Intentions.html generated 2018-06-29T16:36:20.164Z 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-issues-Issues.html generated 2018-06-29T14:15:38.732Z by adl.to-selmer-templates.
|
||||
<!-- File list-issues-Issues.html generated 2018-06-29T16:36:20.156Z 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-29T14:15:38.696Z by adl.to-selmer-templates.
|
||||
<!-- File list-options-Options.html generated 2018-06-29T16:36:20.119Z 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-29T14:15:38.712Z by adl.to-selmer-templates.
|
||||
<!-- File list-roles-Roles.html generated 2018-06-29T16:36:20.136Z 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-29T14:15:38.690Z by adl.to-selmer-templates.
|
||||
<!-- File list-teams-Teams.html generated 2018-06-29T16:36:20.113Z 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-29T14:15:38.689Z by adl.to-selmer-templates.
|
||||
<!-- File list-visits-Visits.html generated 2018-06-29T16:36:20.111Z 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'/>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
{% 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>
|
||||
<li id="user"><a href="profile">Logged in as {{user.fullname}}</a></li>
|
||||
{% endif %}
|
||||
</menu>
|
||||
</div>
|
||||
|
@ -34,6 +34,9 @@
|
|||
</header>
|
||||
{% endblock %}
|
||||
<div id="main-container" class="container">
|
||||
<div id="back-link-container">
|
||||
<a href="javascript:history.back()" id="back-link">Back</a>
|
||||
</div>
|
||||
<div id="big-links">
|
||||
{% block big-links %}
|
||||
{% endblock %}
|
||||
|
@ -42,9 +45,6 @@
|
|||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div id="back-link-container">
|
||||
<a href="javascript:history.back()" id="back-link">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
{% block foot %}
|
||||
<footer>
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
{{ user }}
|
||||
{% endblock %}
|
||||
{% block big-links %}
|
||||
<div class="big-link-container">
|
||||
<a href="app" class="big-link" id="big-link">Canvasser</a>
|
||||
</div>
|
||||
{% for role in roles %}
|
||||
<div class="big-link-container">
|
||||
<a href="{{role.name|lower}}" class="big-link" id="big-link">{{role.name}}</a>
|
||||
|
|
|
@ -49,12 +49,11 @@
|
|||
:hmac-sha1)))
|
||||
(db/list-authorities db/*db* {}))))
|
||||
|
||||
|
||||
(def authority!
|
||||
;; Closure to allow authorities to be created once when the function is first
|
||||
;; Closure to allow authorities map 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.
|
||||
;; known to the database. As side-effect, the authorities map is bound in the
|
||||
;; closure.
|
||||
(let [authorities (atom nil)]
|
||||
(fn [id]
|
||||
(if
|
||||
|
@ -69,8 +68,7 @@
|
|||
(if authority
|
||||
(do
|
||||
(log/debug (str "Selected authority " id))
|
||||
(session/put! :authority authority)))
|
||||
authority))))
|
||||
authority))))))
|
||||
|
||||
(defn oauth-callback-uri
|
||||
"Generates the oauth request callback URI."
|
||||
|
@ -79,23 +77,18 @@
|
|||
|
||||
(defn fetch-request-token
|
||||
"Fetches a request token from the authority implied by this `request`."
|
||||
[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 auth (oauth-callback-uri request)))
|
||||
(throw (Exception. (str "No such authority: " auth-id))))))
|
||||
([request auth]
|
||||
(let [callback-uri (oauth-callback-uri request)]
|
||||
(log/info "Fetching request token using callback-uri" callback-uri)
|
||||
(oauth/request-token auth (oauth-callback-uri request))))
|
||||
([request]
|
||||
(fetch-request-token request (:authority (:session request)))))
|
||||
|
||||
(defn fetch-access-token
|
||||
[request_token]
|
||||
(oauth/access-token (session/get :authority) request_token (:oauth_verifier request_token)))
|
||||
[request_token authority]
|
||||
(oauth/access-token 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 (session/get :authority) request-token)))
|
||||
[request-token authority]
|
||||
(str (oauth/user-approval-uri authority request-token)))
|
||||
|
|
|
@ -523,7 +523,7 @@
|
|||
(defroutes
|
||||
auto-selmer-routes
|
||||
(GET
|
||||
"/index"
|
||||
"/admin"
|
||||
request
|
||||
(route/restricted (apply (resolve-handler "index") (list request))))
|
||||
(GET
|
||||
|
|
|
@ -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 20180629T141537.425Z"
|
||||
"JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180629T163618.749Z"
|
||||
(:require
|
||||
[adl-support.core :as support]
|
||||
[clojure.java.io :as io]
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
(ns ^{:doc "Routes/pages available to unauthenticated users."
|
||||
:author "Simon Brooke"} youyesyet.routes.home
|
||||
(:require [clojure.walk :refer [keywordize-keys]]
|
||||
[clojure.java.io :refer [input-stream]]
|
||||
(:require [clojure.java.io :as io]
|
||||
[clojure.tools.logging :as log]
|
||||
[clojure.walk :refer [keywordize-keys]]
|
||||
[noir.response :as nresponse]
|
||||
[noir.util.route :as route]
|
||||
[ring.util.http-response :refer [content-type ok]]
|
||||
|
@ -10,7 +11,7 @@
|
|||
[youyesyet.oauth :as oauth]
|
||||
[compojure.core :refer [defroutes GET POST]]
|
||||
[ring.util.http-response :as response]
|
||||
[clojure.java.io :as io]))
|
||||
))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;
|
||||
|
@ -86,27 +87,41 @@
|
|||
redirect-to (or (:redirect-to params) "roles")]
|
||||
(cond
|
||||
(:authority params)
|
||||
(oauth/fetch-request-token request)
|
||||
(let [auth (oauth/authority! (:authority params))]
|
||||
(if auth
|
||||
(do
|
||||
(log/info "Attempting to authorise with authority " (:authority params))
|
||||
(oauth/fetch-request-token
|
||||
(assoc request :session (assoc session :authority auth))
|
||||
auth))
|
||||
(throw (Exception. (str "No such authority: " (:authority params))))))
|
||||
;; 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.
|
||||
(and user (= username password))
|
||||
(assoc (response/found redirect-to) :session (assoc session :user username))
|
||||
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
|
||||
(layout/render "login.html" {:title "Please log in" :redirect-to redirect-to :authorities (db-core/list-authorities db-core/*db*)}))))
|
||||
(layout/render
|
||||
"login.html"
|
||||
{:title "Please log in"
|
||||
:redirect-to redirect-to
|
||||
:authorities (db-core/list-authorities db-core/*db*)}))))
|
||||
|
||||
|
||||
(defroutes home-routes
|
||||
(GET "/" [] (home-page))
|
||||
(GET "/js/:file" [file]
|
||||
(-> (input-stream (str "resources/public/js/" file))
|
||||
ok
|
||||
(content-type "text/javascript;charset=UTF-8")))
|
||||
;; (GET "/js/:file" [file]
|
||||
;; (-> (io/input-stream (str "resources/public/js/" file))
|
||||
;; ok
|
||||
;; (content-type "text/javascript;charset=UTF-8")))
|
||||
(GET "/home" [] (home-page))
|
||||
(GET "/about" [] (about-page))
|
||||
(GET "/roles" request (route/restricted (roles-page request)))
|
||||
(GET "/canvassers" [] (route/restricted (app-page)))
|
||||
(GET "/app" [] (route/restricted (app-page)))
|
||||
(GET "/call-me" [] (call-me-page nil))
|
||||
(POST "/call-me" request (call-me-page request))
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
(ns ^{:doc "OAuth authentication routes - not finished, does not work yet."
|
||||
:author "Simon Brooke"} youyesyet.routes.oauth
|
||||
(:require [compojure.core :refer [defroutes GET]]
|
||||
(:require [clojure.tools.logging :as log]
|
||||
[compojure.core :refer [defroutes GET]]
|
||||
[ring.util.http-response :refer [ok found]]
|
||||
[clojure.java.io :as io]
|
||||
[youyesyet.oauth :as oauth]
|
||||
[clojure.tools.logging :as log]))
|
||||
[youyesyet.oauth :as oauth]))
|
||||
|
||||
(defn oauth-init
|
||||
"Initiates the OAuth with the authority implied by this `request`"
|
||||
[request]
|
||||
(-> (oauth/fetch-request-token request)
|
||||
:oauth_token
|
||||
oauth/auth-redirect-uri
|
||||
found))
|
||||
;; (-> (oauth/fetch-request-token request)
|
||||
;; :oauth_token
|
||||
;; oauth/auth-redirect-uri
|
||||
;; found))
|
||||
(found
|
||||
(oauth/auth-redirect-uri
|
||||
(:oauth_token (oauth/fetch-request-token request))
|
||||
(:authority (:session request)))))
|
||||
|
||||
(defn oauth-callback
|
||||
"Handles the callback from the authority."
|
||||
|
@ -22,7 +26,8 @@
|
|||
(-> (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)]
|
||||
(let [{:keys [user_id screen_name]}
|
||||
(oauth/fetch-access-token request_token (:authority session))]
|
||||
(log/info "successfully authenticated as" user_id screen_name)
|
||||
(-> (found "/")
|
||||
(assoc :session
|
||||
|
|
Loading…
Reference in a new issue