diff --git a/documentation/authorisation.html b/documentation/authorisation.html index 0c83e18..7a7c786 100644 --- a/documentation/authorisation.html +++ b/documentation/authorisation.html @@ -1,6 +1,6 @@ -Security and authorisation

Security and authorisation

+Security and authorisation

Security and authorisation

Essentially we have six levels of authorisation, at essentially increasing levels of sensitivity.

  1. diff --git a/documentation/competitors.html b/documentation/competitors.html index 040c485..22a48d3 100644 --- a/documentation/competitors.html +++ b/documentation/competitors.html @@ -1,6 +1,6 @@ -Competitor Analysis

    Competitor Analysis

    +Competitor Analysis

    Competitor Analysis

    Obviously You Yes Yet? is my baby; I’ve put a lot of thought into it. At the time I started working on it I wasn’t aware of any open source competitors; I did to a web search, and I emailed the Bernie Sanders campaign to see whether their widely admired tools were open source. I didn’t find anything.

    However, I’ve just been pointed to Vote Leave’s Vics tool, and there may well be others.

    There is no room here for ego. What matters is that the Yes campaign gets the best available tool for the job. So it’s important to do competitor analysis, and not to invest too much work into You Yes Yet? unless there’s a realistic possibility of producing a tool which is better than any of the available alternatives. But it’s also the case that by studying competitors we may find ways to improve the design of You Yes Yet?.

    diff --git a/documentation/database.html b/documentation/database.html index 8b07f9f..e347687 100644 --- a/documentation/database.html +++ b/documentation/database.html @@ -1,6 +1,6 @@ -Database Specification

    Database Specification

    +Database Specification

    Database Specification

    Note that this is a work in progress. Read it in concert with the Entity-Relationship Diagram.

    Tables are listed in alphabetical order.

    Address

    diff --git a/documentation/index.html b/documentation/index.html index 662dc9d..30e448f 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -1,3 +1,3 @@ -Youyesyet 0.2.1-SNAPSHOT

    Youyesyet 0.2.1-SNAPSHOT

    Released under the GNU General Public License,version 2.0 or (at your option) any later version

    Canvassing tool for referenda.

    Installation

    To install, add the following dependency to your project or build file:

    [youyesyet "0.2.1-SNAPSHOT"]

    Topics

    Namespaces

    youyesyet.authorisation

    Field-level authorisation. Messy.

    Public variables and functions:

      youyesyet.config

      Read configuration.

      Public variables and functions:

      youyesyet.db.core

      Database access functions, mostly from Luminus template.

      Public variables and functions:

      youyesyet.handler

      Handlers for starting and stopping the webapp.

      Public variables and functions:

      youyesyet.layout

      Render web pages using Selmer templating markup.

      youyesyet.locality

      FIXME: write docs

      Public variables and functions:

      youyesyet.middleware

      Plumbing, mainly boilerplate from Luminus.

      youyesyet.oauth

      Handle oauth with multiple authenticating authorities.

      youyesyet.outqueue

      Queue of messages waiting to be sent to the server.

      youyesyet.routes.auto

      User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180920T131125.604Z

      Public variables and functions:

      youyesyet.routes.auto-json

      JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180920T131123.673Z

      Public variables and functions:

      youyesyet.routes.home

      Routes/pages available to unauthenticated users.

      Public variables and functions:

      youyesyet.routes.logged-in

      Routes/pages available to authenticated users.

      Public variables and functions:

      youyesyet.routes.manual

      Manual overrides for auto-generated routes

      Public variables and functions:

        youyesyet.routes.oauth

        OAuth authentication routes - not finished, does not work yet.

        Public variables and functions:

        youyesyet.routes.roles

        Routes/pages available to authenticated users in specific roles.

        youyesyet.routes.services

        REST API.

        Public variables and functions:

        youyesyet.utils

        FIXME: write docs

        Public variables and functions:

        youyesyet.validation

        FIXME: write docs

        Public variables and functions:

          \ No newline at end of file +Youyesyet 0.2.1

          Youyesyet 0.2.1

          Released under the GNU General Public License,version 2.0 or (at your option) any later version

          Canvassing tool for referenda.

          Installation

          To install, add the following dependency to your project or build file:

          [youyesyet "0.2.1"]

          Topics

          Namespaces

          youyesyet.config

          Read configuration.

          Public variables and functions:

          youyesyet.db.core

          Database access functions, mostly from Luminus template.

          Public variables and functions:

          youyesyet.handler

          Handlers for starting and stopping the webapp.

          Public variables and functions:

          youyesyet.layout

          Render web pages using Selmer templating markup.

          youyesyet.locality

          FIXME: write docs

          Public variables and functions:

          youyesyet.middleware

          Plumbing, mainly boilerplate from Luminus.

          youyesyet.oauth

          Handle oauth with multiple authenticating authorities.

          youyesyet.outqueue

          Queue of messages waiting to be sent to the server.

          youyesyet.routes.auto

          User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180921T143946.559Z

          Public variables and functions:

          youyesyet.routes.auto-json

          JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180921T143945.111Z

          Public variables and functions:

          youyesyet.routes.home

          Routes/pages available to unauthenticated users.

          Public variables and functions:

          youyesyet.routes.logged-in

          Routes/pages available to authenticated users.

          Public variables and functions:

          youyesyet.routes.manual

          Manual overrides for auto-generated routes

          Public variables and functions:

            youyesyet.routes.oauth

            OAuth authentication routes - not finished, does not work yet.

            Public variables and functions:

            youyesyet.routes.roles

            Routes/pages available to authenticated users in specific roles.

            youyesyet.routes.services

            REST API.

            Public variables and functions:

            youyesyet.utils

            FIXME: write docs

            Public variables and functions:

            youyesyet.validation

            FIXME: write docs

            Public variables and functions:

              \ No newline at end of file diff --git a/documentation/scaling.html b/documentation/scaling.html index 4621445..b9dc764 100644 --- a/documentation/scaling.html +++ b/documentation/scaling.html @@ -1,6 +1,6 @@ -YouYesYet: Scaling

              YouYesYet: Scaling

              +YouYesYet: Scaling

              YouYesYet: Scaling

              Suppose the YouYesYet project works and we have thousands or tens of thousands of volunteers across Scotland all out chapping doors at the same time: how do we ensure the system stays up under load?

              Sizing the problem

              There’s no point in building the app if it will break down under load. We need to be persuaded that it is possible to support the maximum predictable load the system might experience.

              diff --git a/documentation/userspec.html b/documentation/userspec.html index e2f9a92..332597a 100644 --- a/documentation/userspec.html +++ b/documentation/userspec.html @@ -1,6 +1,6 @@ -YouYesYet: User-oriented specification

              YouYesYet: User-oriented specification

              +YouYesYet: User-oriented specification

              YouYesYet: User-oriented specification

              Overview

              YouYesYet is a proposed web-app intended to simplify the collection of canvas data from voters, specifically for the upcoming Scottish Independence referendum; it is intended that it should later be adaptable for other canvassing campaigns, but that is a much lower priority.

              General Principles

              @@ -51,15 +51,19 @@

            Map View

            The map view shows a map of the streets immediately around their current location, overlaid, on dwellings where canvas has already been done, with icons indicating the voting preference expressed, and with the dwellings where canvassing is still required marked with an icon indicating this:

            -

            Map View

            +

            Map View

            Selecting a building on the map leads to

              -
            1. On buildings with multiple flats, a schematic view of the flats in the building (I haven’t yet really got a good idea how to do this; it may be just a list). Selecting a flat from this view leads to the Electors View;
            2. +
            3. On buildings with multiple flats, the Building View;
            4. On buildings with only one dwelling, the Electors View.
            +

            Building View

            +

            A list of dwellings in a building.

            +

            Building View

            +

            Selecting a flat from this view leads to the Electors View.

            Electors View

            The Electors View shows a schematic of the registered electors in a dwelling:

            -

            Electors View

            +

            Electors View

            One figure is shown for each elector, labelled with their name. In the dummy pages I’ve shown gendered stick figures, because I believe that in many casesthis will help the canvasser identify the person who has answered the door; but this may be seen as excluding electors with non-binary gender, and, in any case, I believe we don’t actually get gender data (other than salutation) in the electoral roll data. So this may have to be reconsidered.

            Below the figure are:

              @@ -80,8 +84,12 @@ | Other | +------------------------------------------------+ +

              Issues View

              This list will not be hard-coded but will be dynamic; thus, if we find an issue we didn’t predict is regularly coming up on the doorstep an Administrator can add it to the list.

              -

              Selecting the back button from the Issues View returns to the Electors View. Selecting any option from the Issues view leads to a single page giving top level points the canvasser can make to the elector on the doorstep, and a link to a Followup Request form. There is also a ‘back’ button allowing the user to return to the Issues View

              +

              Selecting the back button from the Issues View returns to the Electors View. Selecting any option from the Issues view leads to the Issue View.

              +

              Issue View

              +

              A single page giving top level points the canvasser can make to the elector on the doorstep, regarding the selected issue; and a link to a Followup Request form. There is also a ‘back’ button allowing the user to return to the Issues View.

              +

              Issue View

              Followup Request form

              The Followup Request form is a simple form which allows the canvasser to record a followup request. The elector and the issue are already known from the route taken to reach the form, so don’t have to be filled in by the user. In case of followup by post (we mail them out a leaflet on the issue) the address is also known. If the elector chooses followup by telephone or by email, the canvasser will be prompted for the telephone number or email address respectively.

              +------------------------------------------------+
              @@ -96,6 +104,7 @@
               |                                                |
               +------------------------------------------------+
               
              +

              Followup Request Form

              How Street Canvassers will use the system

              Street Canvassers will typically use the system by

                diff --git a/documentation/youyesyet.authorisation.html b/documentation/youyesyet.authorisation.html index 4b154a7..65b4825 100644 --- a/documentation/youyesyet.authorisation.html +++ b/documentation/youyesyet.authorisation.html @@ -1,4 +1,4 @@ -youyesyet.authorisation documentation

                youyesyet.authorisation

                Field-level authorisation. Messy.
                +youyesyet.authorisation documentation

                youyesyet.authorisation

                Field-level authorisation. Messy.
                 
                \ No newline at end of file diff --git a/documentation/youyesyet.config.html b/documentation/youyesyet.config.html index ecf03f0..d626104 100644 --- a/documentation/youyesyet.config.html +++ b/documentation/youyesyet.config.html @@ -1,4 +1,4 @@ -youyesyet.config documentation

                youyesyet.config

                Read configuration.
                +youyesyet.config documentation

                youyesyet.config

                Read configuration.
                 

                env

                FIXME: write docs
                \ No newline at end of file diff --git a/documentation/youyesyet.db.core.html b/documentation/youyesyet.db.core.html index 50de3d4..fbbe7b3 100644 --- a/documentation/youyesyet.db.core.html +++ b/documentation/youyesyet.db.core.html @@ -1,6 +1,6 @@ -youyesyet.db.core documentation

                youyesyet.db.core

                Database access functions, mostly from Luminus template.
                +youyesyet.db.core documentation

                youyesyet.db.core

                Database access functions, mostly from Luminus template.
                 

                *db*

                dynamic

                FIXME: write docs

                create-address!

                creates a new address record
                 

                create-address!-sqlvec

                creates a new address record (sqlvec)
                 

                create-authority!

                creates a new authority record
                @@ -134,6 +134,7 @@
                 

                list-dwellings-by-address

                lists all existing dwelling records related to a given address
                 

                list-dwellings-by-address-sqlvec

                lists all existing dwelling records related to a given address (sqlvec)
                 

                list-dwellings-sqlvec

                lists all existing dwelling records (sqlvec)
                +

                list-elector-intentions

                short form of `list-intentions-by-elector`, returning far less data, for use in `youyesyet.routes.rest/get-local-data`, q.v.
                 

                list-electors

                lists all existing elector records
                 

                list-electors-by-dwelling

                lists all existing dwelling records related to a given elector
                 

                list-electors-by-dwelling-sqlvec

                lists all existing dwelling records related to a given elector (sqlvec)
                diff --git a/documentation/youyesyet.handler.html b/documentation/youyesyet.handler.html
                index ba0b8df..b38a338 100644
                --- a/documentation/youyesyet.handler.html
                +++ b/documentation/youyesyet.handler.html
                @@ -1,6 +1,6 @@
                 
                -youyesyet.handler documentation

                youyesyet.handler

                Handlers for starting and stopping the webapp.
                +youyesyet.handler documentation

                youyesyet.handler

                Handlers for starting and stopping the webapp.
                 

                app

                FIXME: write docs

                app-routes

                FIXME: write docs

                destroy

                (destroy)
                destroy will be called when your application
                 shuts down, put any clean up code here

                init

                (init)
                init will be called once when
                 app is deployed as a servlet on
                diff --git a/documentation/youyesyet.layout.html b/documentation/youyesyet.layout.html
                index 46cdc96..0be9065 100644
                --- a/documentation/youyesyet.layout.html
                +++ b/documentation/youyesyet.layout.html
                @@ -1,6 +1,6 @@
                 
                -youyesyet.layout documentation

                youyesyet.layout

                Render web pages using Selmer templating markup.
                +youyesyet.layout documentation

                youyesyet.layout

                Render web pages using Selmer templating markup.
                 

                *app-context*

                dynamic

                FIXME: write docs

                *user*

                dynamic

                FIXME: write docs

                error-page

                (error-page error-details)
                error-details should be a map containing the following keys:
                 :status - error status
                 :title - error title (optional)
                diff --git a/documentation/youyesyet.locality.html b/documentation/youyesyet.locality.html
                index 4791272..dd328e7 100644
                --- a/documentation/youyesyet.locality.html
                +++ b/documentation/youyesyet.locality.html
                @@ -1,6 +1,6 @@
                 
                -youyesyet.locality documentation

                youyesyet.locality

                FIXME: write docs

                locality

                (locality latitude longitude)
                Compute the locality index for this `latitude`/`longitude` pair.
                +youyesyet.locality documentation

                youyesyet.locality

                FIXME: write docs

                locality

                (locality latitude longitude)
                Compute the locality index for this `latitude`/`longitude` pair.
                 

                neighbouring-localities

                (neighbouring-localities locality)
                Return this locality with the localities immediately
                 north east, north, north west, east, west, south west,
                 south and south east of it.
                \ No newline at end of file diff --git a/documentation/youyesyet.middleware.html b/documentation/youyesyet.middleware.html index b34fe75..de9ddb3 100644 --- a/documentation/youyesyet.middleware.html +++ b/documentation/youyesyet.middleware.html @@ -1,5 +1,5 @@ -youyesyet.middleware documentation

                youyesyet.middleware

                Plumbing, mainly boilerplate from Luminus.
                +youyesyet.middleware documentation

                youyesyet.middleware

                Plumbing, mainly boilerplate from Luminus.
                 

                wrap-base

                (wrap-base handler)
                FIXME: write docs

                wrap-context

                (wrap-context handler)
                FIXME: write docs

                wrap-csrf

                (wrap-csrf handler)
                FIXME: write docs

                wrap-formats

                (wrap-formats handler)
                FIXME: write docs

                wrap-internal-error

                (wrap-internal-error handler)
                FIXME: write docs

                wrap-user

                (wrap-user handler)
                Dynamically bind *user* to the user in the session, if any, so that it
                 is available in layout/render, q.v.
                \ No newline at end of file diff --git a/documentation/youyesyet.oauth.html b/documentation/youyesyet.oauth.html index 586c8bc..ab9e15f 100644 --- a/documentation/youyesyet.oauth.html +++ b/documentation/youyesyet.oauth.html @@ -1,6 +1,6 @@ -youyesyet.oauth documentation

                youyesyet.oauth

                Handle oauth with multiple authenticating authorities.
                +youyesyet.oauth documentation

                youyesyet.oauth

                Handle oauth with multiple authenticating authorities.
                 

                auth-redirect-uri

                (auth-redirect-uri request-token authority)
                Gets the URI the user should be redirected to when authenticating.
                 

                authority!

                FIXME: write docs

                fetch-access-token

                (fetch-access-token request_token authority)
                FIXME: write docs

                fetch-request-token

                (fetch-request-token request auth)(fetch-request-token request)
                Fetches a request token from the authority implied by this `request`.
                 

                get-authorities

                (get-authorities _)
                Fetch the authorities from the database and return a map of them.
                diff --git a/documentation/youyesyet.outqueue.html b/documentation/youyesyet.outqueue.html
                index d5f18fb..e3da898 100644
                --- a/documentation/youyesyet.outqueue.html
                +++ b/documentation/youyesyet.outqueue.html
                @@ -1,6 +1,6 @@
                 
                -youyesyet.outqueue documentation

                youyesyet.outqueue

                Queue of messages waiting to be sent to the server.
                +youyesyet.outqueue documentation

                youyesyet.outqueue

                Queue of messages waiting to be sent to the server.
                 

                add!

                (add! q item)
                Add this item to the queue.
                 

                count

                (count q)
                Return the count of items currently in the queue.
                 

                lock!

                (lock! q)
                FIXME: write docs

                locked?

                (locked? q)
                FIXME: write docs

                maybe-process-next

                (maybe-process-next q process)
                Apply this process, assumed to be a function of one argument, to the next
                diff --git a/documentation/youyesyet.routes.auto-json.html b/documentation/youyesyet.routes.auto-json.html
                index 96f050a..a0f6943 100644
                --- a/documentation/youyesyet.routes.auto-json.html
                +++ b/documentation/youyesyet.routes.auto-json.html
                @@ -1,6 +1,6 @@
                 
                -youyesyet.routes.auto-json documentation

                youyesyet.routes.auto-json

                JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180920T131123.673Z
                +youyesyet.routes.auto-json documentation

                youyesyet.routes.auto-json

                JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180921T143945.111Z
                 

                auto-rest-routes

                FIXME: write docs

                create-address!

                (create-address! request)
                Auto-generated method to insert one record to the `addresses` table. Expects the following key(s) to be present in `params`: `(:address :postcode :district_id :latitude :longitude)`. Returns a map containing the keys `#{"id"}` identifying the record created.
                 

                create-authority!

                (create-authority! request)
                Auto-generated method to insert one record to the `authorities` table. Expects the following key(s) to be present in `params`: `(:request-token-uri :access-token-uri :authorize-uri :consumer-key :consumer-secret :id)`. Returns a map containing the keys `#{"id"}` identifying the record created.
                 

                create-canvasser!

                (create-canvasser! request)
                Auto-generated method to insert one record to the `canvassers` table. Expects the following key(s) to be present in `params`: `(:username :fullname :avatar :bio :elector_id :address_id :phone :email :authority_id :authorised)`. Returns a map containing the keys `#{"id"}` identifying the record created.
                diff --git a/documentation/youyesyet.routes.auto.html b/documentation/youyesyet.routes.auto.html
                index 647307f..5ab54ce 100644
                --- a/documentation/youyesyet.routes.auto.html
                +++ b/documentation/youyesyet.routes.auto.html
                @@ -1,5 +1,5 @@
                 
                -youyesyet.routes.auto documentation

                youyesyet.routes.auto

                User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180920T131125.604Z
                +youyesyet.routes.auto documentation

                youyesyet.routes.auto

                User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180921T143946.559Z
                 

                auto-selmer-routes

                FIXME: write docs

                get-form-addresses-Address

                (get-form-addresses-Address request)
                FIXME: write docs

                get-form-authorities-Authority

                (get-form-authorities-Authority request)
                FIXME: write docs

                get-form-canvassers-Canvasser

                (get-form-canvassers-Canvasser request)
                FIXME: write docs

                get-form-districts-District

                (get-form-districts-District request)
                FIXME: write docs

                get-form-dwellings-Dwelling

                (get-form-dwellings-Dwelling request)
                FIXME: write docs

                get-form-electors-Elector

                (get-form-electors-Elector request)
                FIXME: write docs

                get-form-events-Events

                (get-form-events-Events request)
                FIXME: write docs

                get-form-followupactions-Followupaction

                (get-form-followupactions-Followupaction request)
                FIXME: write docs

                get-form-followupmethods-Followupmethod

                (get-form-followupmethods-Followupmethod request)
                FIXME: write docs

                get-form-followuprequests-Followuprequest

                (get-form-followuprequests-Followuprequest request)
                FIXME: write docs

                get-form-genders-Gender

                (get-form-genders-Gender request)
                FIXME: write docs

                get-form-intentions-Intention

                (get-form-intentions-Intention request)
                FIXME: write docs

                get-form-issues-Issue

                (get-form-issues-Issue request)
                FIXME: write docs

                get-form-options-Option

                (get-form-options-Option request)
                FIXME: write docs

                get-form-roles-Role

                (get-form-roles-Role request)
                FIXME: write docs

                get-form-teams-Team

                (get-form-teams-Team request)
                FIXME: write docs

                get-form-visits-Visit

                (get-form-visits-Visit request)
                FIXME: write docs

                get-list-addresses-Addresses

                (get-list-addresses-Addresses request)
                FIXME: write docs

                get-list-authorities-Authorities

                (get-list-authorities-Authorities request)
                FIXME: write docs

                get-list-canvassers-Canvassers

                (get-list-canvassers-Canvassers request)
                FIXME: write docs

                get-list-districts-Districts

                (get-list-districts-Districts request)
                FIXME: write docs

                get-list-dwellings-Dwellings

                (get-list-dwellings-Dwellings request)
                FIXME: write docs

                get-list-electors-Electors

                (get-list-electors-Electors request)
                FIXME: write docs

                get-list-events-Events

                (get-list-events-Events request)
                FIXME: write docs

                get-list-followupactions-Followupactions

                (get-list-followupactions-Followupactions request)
                FIXME: write docs

                get-list-followupmethods-Followupmethods

                (get-list-followupmethods-Followupmethods request)
                FIXME: write docs

                get-list-followuprequests-Followuprequests

                (get-list-followuprequests-Followuprequests request)
                FIXME: write docs

                get-list-genders-Genders

                (get-list-genders-Genders request)
                FIXME: write docs

                get-list-intentions-Intentions

                (get-list-intentions-Intentions request)
                FIXME: write docs

                get-list-issues-Issues

                (get-list-issues-Issues request)
                FIXME: write docs

                get-list-options-Options

                (get-list-options-Options request)
                FIXME: write docs

                get-list-roles-Roles

                (get-list-roles-Roles request)
                FIXME: write docs

                get-list-teams-Teams

                (get-list-teams-Teams request)
                FIXME: write docs

                get-list-visits-Visits

                (get-list-visits-Visits request)
                FIXME: write docs

                index

                (index r)
                FIXME: write docs

                post-form-addresses-Address

                (post-form-addresses-Address request)
                FIXME: write docs

                post-form-authorities-Authority

                (post-form-authorities-Authority request)
                FIXME: write docs

                post-form-canvassers-Canvasser

                (post-form-canvassers-Canvasser request)
                FIXME: write docs

                post-form-districts-District

                (post-form-districts-District request)
                FIXME: write docs

                post-form-dwellings-Dwelling

                (post-form-dwellings-Dwelling request)
                FIXME: write docs

                post-form-electors-Elector

                (post-form-electors-Elector request)
                FIXME: write docs

                post-form-events-Events

                (post-form-events-Events request)
                FIXME: write docs

                post-form-followupactions-Followupaction

                (post-form-followupactions-Followupaction request)
                FIXME: write docs

                post-form-followupmethods-Followupmethod

                (post-form-followupmethods-Followupmethod request)
                FIXME: write docs

                post-form-followuprequests-Followuprequest

                (post-form-followuprequests-Followuprequest request)
                FIXME: write docs

                post-form-genders-Gender

                (post-form-genders-Gender request)
                FIXME: write docs

                post-form-intentions-Intention

                (post-form-intentions-Intention request)
                FIXME: write docs

                post-form-issues-Issue

                (post-form-issues-Issue request)
                FIXME: write docs

                post-form-options-Option

                (post-form-options-Option request)
                FIXME: write docs

                post-form-roles-Role

                (post-form-roles-Role request)
                FIXME: write docs

                post-form-teams-Team

                (post-form-teams-Team request)
                FIXME: write docs

                post-form-visits-Visit

                (post-form-visits-Visit request)
                FIXME: write docs

                post-list-addresses-Addresses

                (post-list-addresses-Addresses request)
                FIXME: write docs

                post-list-authorities-Authorities

                (post-list-authorities-Authorities request)
                FIXME: write docs

                post-list-canvassers-Canvassers

                (post-list-canvassers-Canvassers request)
                FIXME: write docs

                post-list-districts-Districts

                (post-list-districts-Districts request)
                FIXME: write docs

                post-list-dwellings-Dwellings

                (post-list-dwellings-Dwellings request)
                FIXME: write docs

                post-list-electors-Electors

                (post-list-electors-Electors request)
                FIXME: write docs

                post-list-events-Events

                (post-list-events-Events request)
                FIXME: write docs

                post-list-followupactions-Followupactions

                (post-list-followupactions-Followupactions request)
                FIXME: write docs

                post-list-followupmethods-Followupmethods

                (post-list-followupmethods-Followupmethods request)
                FIXME: write docs

                post-list-followuprequests-Followuprequests

                (post-list-followuprequests-Followuprequests request)
                FIXME: write docs

                post-list-genders-Genders

                (post-list-genders-Genders request)
                FIXME: write docs

                post-list-intentions-Intentions

                (post-list-intentions-Intentions request)
                FIXME: write docs

                post-list-issues-Issues

                (post-list-issues-Issues request)
                FIXME: write docs

                post-list-options-Options

                (post-list-options-Options request)
                FIXME: write docs

                post-list-roles-Roles

                (post-list-roles-Roles request)
                FIXME: write docs

                post-list-teams-Teams

                (post-list-teams-Teams request)
                FIXME: write docs

                post-list-visits-Visits

                (post-list-visits-Visits request)
                FIXME: write docs

                raw-resolve-handler

                (raw-resolve-handler n)
                Prefer the manually-written version of the handler with name `n`, if it exists, to the automatically generated one
                 

                resolve-handler

                FIXME: write docs
                \ No newline at end of file diff --git a/documentation/youyesyet.routes.home.html b/documentation/youyesyet.routes.home.html index 24cd05f..2e54c1f 100644 --- a/documentation/youyesyet.routes.home.html +++ b/documentation/youyesyet.routes.home.html @@ -1,5 +1,5 @@ -youyesyet.routes.home documentation

                youyesyet.routes.home

                Routes/pages available to unauthenticated users.
                +youyesyet.routes.home documentation

                youyesyet.routes.home

                Routes/pages available to unauthenticated users.
                 

                about-page

                (about-page)
                FIXME: write docs

                call-me-page

                (call-me-page request)
                FIXME: write docs

                home-page

                (home-page)
                FIXME: write docs

                home-routes

                FIXME: write docs

                login-page

                (login-page request)
                This is very temporary. We're going to do authentication by oauth.
                 

                motd

                (motd)
                FIXME: write docs
                \ No newline at end of file diff --git a/documentation/youyesyet.routes.issue-experts.html b/documentation/youyesyet.routes.issue-experts.html index 2cceafd..20f7479 100644 --- a/documentation/youyesyet.routes.issue-experts.html +++ b/documentation/youyesyet.routes.issue-experts.html @@ -1,6 +1,6 @@ -youyesyet.routes.issue-experts documentation

                youyesyet.routes.issue-experts

                Routes/pages available to issue experts.
                +youyesyet.routes.issue-experts documentation

                youyesyet.routes.issue-experts

                Routes/pages available to issue experts.
                 

                get-and-lock-followuprequest!

                (get-and-lock-followuprequest! id user)
                Return the `followuprequest` record indicated by this `id`, provided that
                 it is unlocked. As a side effect, lock it to this `user`.

                get-followup-request-page

                (get-followup-request-page request)
                FIXME: write docs

                issue-expert-routes

                FIXME: write docs

                list-page

                (list-page request)
                FIXME: write docs

                post-followup-action

                (post-followup-action request)
                From this `request`, create a `followupaction` record, and, if an
                 `option_id` is present in the params, an `intention` record; show
                diff --git a/documentation/youyesyet.routes.manual.html b/documentation/youyesyet.routes.manual.html
                index 9417a27..7d1a732 100644
                --- a/documentation/youyesyet.routes.manual.html
                +++ b/documentation/youyesyet.routes.manual.html
                @@ -1,4 +1,4 @@
                 
                -youyesyet.routes.manual documentation

                youyesyet.routes.manual

                Manual overrides for auto-generated routes
                +youyesyet.routes.manual documentation

                youyesyet.routes.manual

                Manual overrides for auto-generated routes
                 
                \ No newline at end of file diff --git a/documentation/youyesyet.routes.oauth.html b/documentation/youyesyet.routes.oauth.html index db60c55..2711a8f 100644 --- a/documentation/youyesyet.routes.oauth.html +++ b/documentation/youyesyet.routes.oauth.html @@ -1,6 +1,6 @@ -youyesyet.routes.oauth documentation

                youyesyet.routes.oauth

                OAuth authentication routes - not finished, does not work yet.
                +youyesyet.routes.oauth documentation

                youyesyet.routes.oauth

                OAuth authentication routes - not finished, does not work yet.
                 

                oauth-callback

                (oauth-callback request_token {:keys [session]})
                Handles the callback from the authority.
                 

                oauth-init

                (oauth-init request)
                Initiates the OAuth with the authority implied by this `request`
                 

                oauth-routes

                FIXME: write docs
                \ No newline at end of file diff --git a/documentation/youyesyet.routes.rest.html b/documentation/youyesyet.routes.rest.html index 88bfd58..46f599e 100644 --- a/documentation/youyesyet.routes.rest.html +++ b/documentation/youyesyet.routes.rest.html @@ -1,6 +1,6 @@ -youyesyet.routes.rest documentation

                youyesyet.routes.rest

                Manually maintained routes which handle data transfer to/from the canvasser app.
                +youyesyet.routes.rest documentation

                youyesyet.routes.rest

                Manually maintained routes which handle data transfer to/from the canvasser app.
                 

                create-intention-and-visit!

                (create-intention-and-visit! request)
                Doing visit creation logic server side; request params are expected to
                 include an `option_id`, an `elector_id` and an `address_id`, or an `option` and
                 a `location`. If no `address_id` is provided, we simply create an
                diff --git a/documentation/youyesyet.routes.roles.html b/documentation/youyesyet.routes.roles.html
                index ab04f64..5cd69b6 100644
                --- a/documentation/youyesyet.routes.roles.html
                +++ b/documentation/youyesyet.routes.roles.html
                @@ -1,6 +1,6 @@
                 
                -youyesyet.routes.roles documentation

                youyesyet.routes.roles

                Routes/pages available to authenticated users in specific roles.
                +youyesyet.routes.roles documentation

                youyesyet.routes.roles

                Routes/pages available to authenticated users in specific roles.
                 

                admins-page

                (admins-page request)
                FIXME: write docs

                analysts-page

                (analysts-page request)
                My expectation is that analysts will do a lot of their work through QGIS or
                 some other geographical information system; so there isn't a need to put
                 anything sophisticated here.

                canvassers-page

                (canvassers-page request)
                FIXME: write docs

                roles-page

                (roles-page request)
                FIXME: write docs

                roles-routes

                FIXME: write docs

                team-organisers-page

                (team-organisers-page request)
                FIXME: write docs
                \ No newline at end of file diff --git a/documentation/youyesyet.routes.services.html b/documentation/youyesyet.routes.services.html index 29cf074..87024de 100644 --- a/documentation/youyesyet.routes.services.html +++ b/documentation/youyesyet.routes.services.html @@ -1,4 +1,4 @@ -youyesyet.routes.services documentation

                youyesyet.routes.services

                REST API.
                +youyesyet.routes.services documentation

                youyesyet.routes.services

                REST API.
                 

                service-routes

                FIXME: write docs
                \ No newline at end of file diff --git a/documentation/youyesyet.utils.html b/documentation/youyesyet.utils.html index 2286012..c2d655d 100644 --- a/documentation/youyesyet.utils.html +++ b/documentation/youyesyet.utils.html @@ -1,3 +1,3 @@ -youyesyet.utils documentation

                youyesyet.utils

                FIXME: write docs

                coerce-to-number

                (coerce-to-number v)
                FIXME: write docs
                \ No newline at end of file +youyesyet.utils documentation

                youyesyet.utils

                FIXME: write docs

                coerce-to-number

                (coerce-to-number v)
                FIXME: write docs
                \ No newline at end of file diff --git a/documentation/youyesyet.validation.html b/documentation/youyesyet.validation.html index 17fb005..74382ff 100644 --- a/documentation/youyesyet.validation.html +++ b/documentation/youyesyet.validation.html @@ -1,3 +1,3 @@ -youyesyet.validation documentation

                youyesyet.validation

                FIXME: write docs
                \ No newline at end of file +youyesyet.validation documentation

                youyesyet.validation

                FIXME: write docs
                \ No newline at end of file diff --git a/resources/sql/queries.sql b/resources/sql/queries.sql index 017463e..40b815d 100644 --- a/resources/sql/queries.sql +++ b/resources/sql/queries.sql @@ -87,8 +87,9 @@ ORDER BY roles.name, roles.id -- :name list-elector-intentions :? :* --- :doc short form of `list-intentions-by-elector`, returning far less data, --- for use in `youyesyet.routes.rest/get-local-data`, q.v. +-- :doc short form of `list-intentions-by-elector`, returning far less data, for use in `youyesyet.routes.rest/get-local-data`, q.v. +-- TODO: should be limited to visits in the past 24 hours, to prevent the app being +-- used to harrass NO voters. See https://github.com/simon-brooke/youyesyet/issues/58 SELECT intentions.id, intentions.option_id, visits.date FROM intentions, visits WHERE intentions.visit_id = visits.id diff --git a/src/clj/youyesyet/authorisation.clj b/src/clj/youyesyet/authorisation.clj index 2ca529b..8b13789 100644 --- a/src/clj/youyesyet/authorisation.clj +++ b/src/clj/youyesyet/authorisation.clj @@ -1,4 +1 @@ -(ns ^{:doc "Field-level authorisation. Messy." - :author "Simon Brooke"} - youyesyet.authorisation - (:require [youyesyet.env :refer [defaults]])) + diff --git a/src/cljs/youyesyet/canvasser_app/handlers.cljs b/src/cljs/youyesyet/canvasser_app/handlers.cljs index d857bc2..80bd7e6 100644 --- a/src/cljs/youyesyet/canvasser_app/handlers.cljs +++ b/src/cljs/youyesyet/canvasser_app/handlers.cljs @@ -51,6 +51,16 @@ :anchor nil)) +(defn handle-forbidden + "If response has status 403 (forbidden) redirect to the login page." + [response & forms] + (if + (= (str (:status response)) "403") + (do + (js/console.log "Forbidden! redirecting") + (set! (.-location js/document) "/login")) + (apply 'do forms))) + (defn compose-packet [item] "Convert this `item` into a URI which can be sent as a GET call" @@ -197,10 +207,12 @@ ;; TODO: signal something has failed? It doesn't matter very much, unless it keeps failing. (js/console.log (str "Failed to fetch locality data" response)) ;; loop to do it again - (dispatch [:dispatch-later [{:ms 60000 :dispatch [:fetch-locality]}]]) - {:db (assoc - (remove-from-feedback db :fetch-locality) - :error (cons :fetch-locality (:error db)))})) + (handle-forbidden + response + (dispatch [:dispatch-later [{:ms 60000 :dispatch [:fetch-locality]}]]) + {:db (assoc + (remove-from-feedback db :fetch-locality) + :error (cons :fetch-locality (:error db)))}))) (reg-event-fx