aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2018-10-18 10:29:55 +0200
committerThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2018-10-18 10:29:55 +0200
commit5dbce6f9480c8a7d9b115f9b2b7fae97f5f3c4bb (patch)
treefd88b7895582ccd9c633736074587544bd823a29
parentd176763a25e042c0d35d9b2d6f2d50ea7c155519 (diff)
Latest modifications
-rw-r--r--docs/env/intranet/index.rst375
-rw-r--r--docs/environment.rst (renamed from docs/env/index.rst)39
-rw-r--r--docs/index.rst2
-rw-r--r--docs/intranet/adherents-jeune.pngbin0 -> 80431 bytes
-rw-r--r--docs/intranet/adherents-responsable.pngbin0 -> 79574 bytes
-rw-r--r--docs/intranet/adherents.rst72
-rw-r--r--docs/intranet/auth-decouverte.png (renamed from docs/env/login-decouverte.png)bin56622 -> 56622 bytes
-rw-r--r--docs/intranet/auth-mailids.png (renamed from docs/env/mailids.png)bin41231 -> 41231 bytes
-rw-r--r--docs/intranet/auth-petitions.png (renamed from docs/env/login-petitions.png)bin16012 -> 16012 bytes
-rw-r--r--docs/intranet/auth-valorise.png (renamed from docs/env/login-valorise.png)bin21606 -> 21606 bytes
-rw-r--r--docs/intranet/auth.rst39
-rw-r--r--docs/intranet/codes.rst162
-rw-r--r--docs/intranet/events.rst59
-rw-r--r--docs/intranet/ids.rst23
-rw-r--r--docs/intranet/index.rst75
-rw-r--r--docs/intranet/misc.rst54
-rw-r--r--docs/intranet/operations.rst99
-rw-r--r--docs/intranet/places.rst16
-rw-r--r--docs/intranet/structures.rst26
-rwxr-xr-xsgdfi/_dbs/_code.py49
-rwxr-xr-xsgdfi/_intranet.py1
21 files changed, 647 insertions, 444 deletions
diff --git a/docs/env/intranet/index.rst b/docs/env/intranet/index.rst
deleted file mode 100644
index 6547c12..0000000
--- a/docs/env/intranet/index.rst
+++ /dev/null
@@ -1,375 +0,0 @@
-The intranet
-============
-
-For historical details and context, consult `SGDF's digital environment
-description <../index.html#the-intranet>`_.
-
-The intranet is available through `<https://intranet.sgdf.fr/>`_ (and a
-test instance is available through
-`<http://intranet-qualification.sgdf.fr/>`_). It is an `Intr@ssoc`_ derivative,
-which is made in `ASP.NET`_ (that's tipped off by the ``X-Powered-By`` header
-and the ``.aspx`` extensions in the URL) and runs on a webserver that
-identifies itself as `Microsoft IIS`_ 7.5.
-
-SGDF is not the only french scouting organization to use it, the
-`Éclaireuses et Éclaireurs de France <EEDF_>`_ also do.
-
-There are three kind of interactions with the intranet:
-
-- through ``GET``-ting a page.
-- through ``POST``-ing a page while gathering fields on the ``GET`` version
- (including a CSRF token).
-- through gathering a `Microsoft Ajax`_ page fragment.
-
-Returned documents are usually one of these:
-
-- ``text/html``: an HTML document or fragment.
-- ``text/csv``: a CSV document.
-- ``text/xml``: an XML document.
-- ``application/x-microsoft-ajax`` (sent as ``text/plain``): a
- `Microsoft Ajax`_ response.
-- ``application/json``: a JSON document.
-
-Codes
------
-
-The intranet represents structures and adherents through a central code system,
-where each code is composed of nine (9) characters, usually decimal digits.
-One code is usually attributed to only one element, although there are
-exceptions of this (see the examples).
-
-A code cannot be used to predict an element's type (because of exceptions), but
-it can in most cases, using these rules (empirically obtained, where ``#``
-represent any character):
-
-- if the code is ``000000000``, then the element is a top.
-- if the code is ``##0000000`` or ``##9999999``, then the element is a
- “centre national”.
-- if the code starts with ``12``, ``13``, ``14``, ``15``, ``16`` (or ``17``?),
- then the element is an adherent.
-- if the code starts with ``98``:
-
- - if the five following characters are ``88001``:
-
- - if the code ends with ``#8``, then the element is a
- “membres associés national”.
- - otherwise, then the element is a “centre national”.
- - otherwise:
-
- - if the code ends with ``8#``, then the element is a “membres
- associés national”.
- - otherwise, then the element is a “centre national”.
-- otherwise:
-
- - the department code is the two following characters.
- - the territory number is the following character.
- - the group number is the two following characters.
- - if the group number is ``00``:
-
- - if the two last characters are ``00``, then the element is a territory.
- - otherwise, then the element is a “membres associés territorial”.
- - otherwise:
-
- - if the two last characters are ``00``, then the element is a group.
- - if the two last characters are ``1#``, then the element is a
- louveteaux-jeanettes unit.
- - if the two last characters are ``2#``, then the element is a
- scouts-guides unit.
- - if the two last characters are ``3#``, then the element is a
- pionniers-caravelles unit.
- - if the two last characters are ``7#``, then the element is a
- farfadet unit.
- - if the two last characters are ``9#``, then the element is a
- Vent du Large unit.
- - otherwise, then the element is a “membres associés local”.
-
-Code examples follow:
-
-``000000000``
- “SCOUTS ET GUIDES DE FRANCE” or “GUIDES DE FRANCE” (sommet)
-
-``010000000``
- “CENTRE NATIONAL” or “REGION ALSACE” (centre national).
-
-``010100000``
- “CONSEIL ADMINISTRATION” (territoire).
-
-``010200000``
- “EQUIPE NATIONALE” (territoire) or “GUIDE” (groupe).
-
-``016700000``
- “DEPARTEMENT BAS RHIN” (territoire).
-
-``016703200``
- “GROUPE DISTRICT STRASBOURG SUD” (groupe).
-
-``016703300``
- “DISTRICT DOMPETER” (territoire).
-
-``034300000``
- “DEPARTEMENT HAUTE LOIRE” (territoire).
-
-``090000000``
- “REGION FRANCHE-COMTE” (centre national).
-
-``100000000``
- “CR ILE DE FRANCE” (centre national).
-
-``107530000``
- “CODEPIE PARIS EST” (territoire).
-
-``107700100``
- “GROUPE DE MONTEREAU” (groupe).
-
-``107700141``
- “1ERE COMPAGNONS MONTEREAU” (unité 17-20 ans).
-
-``107700301``
- “GROUPE 1E MEAUX - UNITE” (Autres).
-
-``107700371``
- “1ERE SARABANDE MEAUX” (Unité Farfadet).
-
-``107700781``
- “RESEAU DES PARENTS ET AMIS DE MONTEREAU” (Membres associés local).
-
-``107840391``
- “VENT DU LARGE ST SYMPHORIEN” (Unité Vent du Large).
-
-``109999999``
- “REGION ILE DE FRANCE” (centre national).
-
-``121160477``
- Anonymous (adhérent)
-
-``163382220``
- Anonymous (adhérent).
-
-``3B0000000``
- “ILE DE FRANCE EST” (centre national).
-
-``700000000``
- “OUEST” (centre national).
-
-``709999999``
- “MOUVEMENTS ASSOCIES” (centre national).
-
-``969711400``
- “GROUPE ABYMES” (groupe).
-
-``980010000``
- “EQUIPES NATIONALES ADMINISTRATION GENERALE” (centre national).
-
-``988600310``
- “COLIBRI” (centre national).
-
-``988601081``
- “MEMBRES ASSOCIES JAMBVILLE” (centre national).
-
-``988800130``
- “FORMATION CR NORD EST” (centre national).
-
-``988800180``
- “FORMATION CR OUTRE MER” (centre national).
-
-``988900901``
- “EQUIPE NATIONALE RESEAU IMPESA” (centre national).
-
-``991000700``
- “GROUPE V.N - LIMOGES” (groupe).
-
-``TO0000000``
- “NOUVELLE CALEDONIE” (centre national).
-
-``TO9810000``
- “NOUVELLE CALEDONIE NORD” (territoire).
-
-Where to find things
---------------------
-
-Paths usually start with ``/Specialisation/Sgdf``, probably because the app
-is an adaptation of `Intr@ssoc`_ and needs its own path, although pages can
-also be accessed without this prefix (duplicate content, well done guys).
-
-``/Default.aspx``
- Login page.
-
-``/Accueil.aspx``
- A home page where you are redirected when you can find some tips and
- announcements, plus the menu.
-
-``/erreurs/Erreur.aspx``
- An error has occured and the user is redirected to this page, which
- takes a few GET parameters:
-
- ``aspxerrorpath``
- The path of the error, e.g.
- ``/Specialisation/Sgdf/animation/ModifDateCalendrier.aspx``.
-
-``/adherents/RechercherAdherent.aspx``
- The main search page for adherents. Loads the results through page
- fragments.
-
-``/adherents/ListeAdherents.aspx``
- An adherents list, less complete than the search form above. Loads the
- results through page fragments.
-
-``/adherents/ResumeAdherent.aspx``
- A page containing information about an adherent. Information is requested
- through fragments.
-
-``/structures/ResumeStructure.aspx``
- A summary page for a structure. Loads the tabs through forms (not
- fragments).
-
-``/Commun/ResumeLieuActivite.aspx``
- Place summary. Takes an ``id`` GET parameter which is the intranet
- ID for the place.
-
-``/animation/ConsulterCalendrier.aspx``
- A calendar. Loads month/structure relationships through fragments.
-
-``/animation/CreerDateCalendrier.aspx``
- A form to create or duplicate an event (transmitted to this page by the
- previous one). While creating, it takes the following GET parameters:
-
- ``date``
- The number of seconds of the day since January 1st, 1, with seven
- zeroes behind. This can be obtained with the following calculation
- in Python, ``dt`` being the ``datetime.datetime`` instance of the
- date you want to encode:
-
- .. code-block:: python
-
- td = dt - datetime(1, 1, 1, 0, 0)
- dateparam = f"{td.total_seconds()}0000000"
-
- ``idStructure``
- The identifier for the structure to which to link the event to.
-
- And while duplicating, it takes the following GET parameters:
-
- ``idDuplique``
- The identifier of the event to duplicate.
-
- ``idStructure``
- The identifier for the structure to which to link the event to.
-
-``/animation/ModifDateCalendrier.aspx``
- A form to edit an event. It takes the following GET parameters:
-
- ``id``
- The identifier of the event to modify.
-
-``/ActivitesAnnee/EditerRegistrePresence.aspx``
- A form to modify the attendee register.
-
-``/nominations/DemandeNomination.aspx``
- A form to request for nomination.
-
-``/Popups/RechercheStructure.aspx``
- Searches through public structures. Uses the following GET parameters:
-
- ``dummy``
- Must be ``1``. The form won't work correctly without it, for
- some reason.
-
- ``operations``
- An intranet identifier (?), e.g. ``fCx2YIJV6Qq+qLBWSyMcwA==``.
-
-``/popups/JournalEvenements.aspx``
- Get events corresponding to an entity on the application. Takes the
- following GET parameters:
-
- ``typeEntite``
- The entity type, amongst:
-
- ``1``
- Structure/season relation. (?)
-
- ``2``
- ?
-
- ``3``
- Patrimony (??)
-
- ``4``
- Adherent.
-
- ``5``
- ?
-
- ``6``
- ?
-
- ``7``
- ?
-
- ``8``
- Event (calendar date).
-
- ``9``
- ?
-
- ``10``
- ?
-
- ``11``
- Training course.
-
- ``12``
- Training course registration.
-
- ``13``
- Camp.
-
- ``14``
- Place.
-
- ``15``
- Membership form (?).
-
- ``16``
- J&S declaration (?).
-
- ``17``
- ?
-
- ``18``
- ?
-
- ``19``
- Rally registration.
-
- ``20``
- ?
-
- ``21``
- ?
-
- ``22``
- ?
-
- ``23``
- ?
-
- ``24``
- ?
-
- ``25``
- ?
-
- ``idEntite``
- An intranet identifier (16 byte sequence, base64 encoded).
-
-``/WebServices/AutoComplete.asmx/GetFonctions``
- An XML document containing function data for autocompleting.
-
- Takes a ``q`` GET parameter which can be empty (e.g. ``?q=``) to get
- all functions.
-
-.. _Intr@ssoc: http://www.intrassoc.com/
-.. _ASP.NET: https://www.asp.net/
-.. _Microsoft IIS: https://www.iis.net/
-.. _Microsoft Ajax: https://msdn.microsoft.com/fr-fr/library/ee341002(v=vs.100).aspx
-.. _EEDF: https://www.eedf.fr/
diff --git a/docs/env/index.rst b/docs/environment.rst
index 78710e8..e58b607 100644
--- a/docs/env/index.rst
+++ b/docs/environment.rst
@@ -74,43 +74,7 @@ The `main website <https://www.sgdf.fr/>`_, also contains a few tools:
The Intranet
------------
-Most management actions linked to the organization goes through the intranet,
-available at `<https://intranet.sgdf.fr/>`_. It is edited, maintained and
-hosted by `Supralog`_ since circa 2006. A test instance of this intranet
-is available at `<http://intranet-qualification.sgdf.fr/>`_.
-Once the registration process for a person in charge is complete, this person
-will receive an e-mail from `adherents@sgdf.fr <mailto:adherents@sgdf.fr>`_
-with their adherent code, which serves as a login name, and a default
-password:
-
-.. image:: mailids.png
-
-These credentials will be useful for logging into the intranet, but also
-other websites, including:
-
-- `<http://decouverte.sgdf.fr/>`_:
-
- .. image:: login-decouverte.png
-- `<https://petitions.sgdf.fr/>`_:
-
- .. image:: login-petitions.png
-- `<https://valorise-toi.sgdf.fr/>`_:
-
- .. image:: login-valorise.png
-
-The intranet allows one to manage, amongst other things:
-
-- registrations and adherents.
-- functions within the organization (nominations, …).
-- structures (groups, territories, …).
-- estate, places.
-- events (meetings, work meetings, camps, rallies, …).
-- accountancy (spendings, donations, …).
-- training courses.
-- accidents and sinisters.
-
-For more information, please consult the following pages:
.. toctree::
:maxdepth: 2
@@ -168,6 +132,9 @@ Other platforms
Amongst the other websites more or less intern to the organization, one
can find:
+- `<https://intranet.sgdf.fr/>`_: the intranet.
+- `<http://intranet-qualification.sgdf.fr/>`_: a test version of the intranet,
+ with test data.
- `<https://sites.sgdf.fr/>`_: a website platform for groups and territories.
- `<https://blogs.sgdf.fr/>`_: the older version of the above, which will
be shut down by 2019.
diff --git a/docs/index.rst b/docs/index.rst
index dfa73e7..4df2c38 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -13,7 +13,7 @@ provide machine access to the websites in this digital environment.
:maxdepth: 2
usage/index
- env/index
+ environment
.. _SGDF: https://www.sgdf.fr/
.. _Scoutisme Français: https://www.scoutisme-francais.fr/
diff --git a/docs/intranet/adherents-jeune.png b/docs/intranet/adherents-jeune.png
new file mode 100644
index 0000000..48d0425
--- /dev/null
+++ b/docs/intranet/adherents-jeune.png
Binary files differ
diff --git a/docs/intranet/adherents-responsable.png b/docs/intranet/adherents-responsable.png
new file mode 100644
index 0000000..151d5cd
--- /dev/null
+++ b/docs/intranet/adherents-responsable.png
Binary files differ
diff --git a/docs/intranet/adherents.rst b/docs/intranet/adherents.rst
new file mode 100644
index 0000000..fc0afce
--- /dev/null
+++ b/docs/intranet/adherents.rst
@@ -0,0 +1,72 @@
+Adherents
+=========
+
+An adherent is an individual who is part of the organization, because they
+have paid a contribution or have been invited for two months once.
+
+Representation
+--------------
+
+An adherent has the following properties:
+
+- an iid.
+- civilité, e.g. « M. » ou « Mlle ».
+- prénom.
+- nom de famille (de jeune fille).
+- nom d'usage.
+- code adhérent si la personne a déjà été adhérente.
+- adresse.
+- numéro de téléphone du domicile.
+- numéro de fax.
+- numéro de téléphone du bureau.
+- numéro de portable 1.
+- numéro de portable 2.
+- adresse de courriel personnelle.
+- adresse de courriel professionnelle.
+- date de naissance.
+- nom de la ville de naissance.
+- nom du pays de naissance.
+- profession.
+- régime d'allocations (général (CAF, Maritime, SNCF, …), MSA ou autre).
+- numéro d'allocataire.
+- si les interventions médico-chirurgicales sont autorisées pour cet individu.
+- si le droit à l'image a été accordé au mouvement pour cet individu.
+- si le responsable légal de l'individu a certifié avoir souscrit une assurance
+ responsabilité civile chef de famille.
+- ?? (AutoriseMailInfoMouvement)
+- ?? (AutoriseMailInfoExterne)
+
+TODO: code fonctions
+
+Paths
+-----
+
+``/adherents/RechercherAdherent.aspx``
+ The main search page for adherents. Loads the results through page
+ fragments.
+
+``/adherents/ListeAdherents.aspx``
+ An adherents list, less complete than the search form above. Loads the
+ results through page fragments.
+
+``/adherents/ResumeAdherent.aspx``
+ A page containing information about an adherent. Information is requested
+ through fragments. Uses a GET parameter:
+
+ ``id``
+ The intranet identifier for the individual.
+
+``/adherents/ModifierAdherent.aspx``
+ A form for modifying an adherent. GET parameters:
+
+ ``id``
+ The intranet identifier for the individual.
+
+``/adherents/ModifierCompetences.aspx``
+ A form for modifying an individual's skills. GET parameters:
+
+ ``id``
+ The intranet identifier for the individual.
+
+``/Competences/ResumeCompetencePersonne.aspx``
+ A form for giving one's skills.
diff --git a/docs/env/login-decouverte.png b/docs/intranet/auth-decouverte.png
index 80f605c..80f605c 100644
--- a/docs/env/login-decouverte.png
+++ b/docs/intranet/auth-decouverte.png
Binary files differ
diff --git a/docs/env/mailids.png b/docs/intranet/auth-mailids.png
index 5da4114..5da4114 100644
--- a/docs/env/mailids.png
+++ b/docs/intranet/auth-mailids.png
Binary files differ
diff --git a/docs/env/login-petitions.png b/docs/intranet/auth-petitions.png
index bb537b4..bb537b4 100644
--- a/docs/env/login-petitions.png
+++ b/docs/intranet/auth-petitions.png
Binary files differ
diff --git a/docs/env/login-valorise.png b/docs/intranet/auth-valorise.png
index 2b7974c..2b7974c 100644
--- a/docs/env/login-valorise.png
+++ b/docs/intranet/auth-valorise.png
Binary files differ
diff --git a/docs/intranet/auth.rst b/docs/intranet/auth.rst
new file mode 100644
index 0000000..598229f
--- /dev/null
+++ b/docs/intranet/auth.rst
@@ -0,0 +1,39 @@
+Authentication
+==============
+
+The intranet provides authentication for itself through a login page, and
+other services as a central authentication service.
+
+Once the registration process for a person in charge is complete, this person
+will receive an e-mail from `adherents@sgdf.fr <mailto:adherents@sgdf.fr>`_
+with their adherent code, which serves as a login name, and a default
+password:
+
+.. image:: auth-mailids.png
+
+These credentials can be used for the intranet and the approved external
+services using it to authenticate and identify users.
+
+Internal authentication
+-----------------------
+
+
+
+External authentication
+-----------------------
+
+Authentication can be provided to approved services through a Web Service,
+`Authentification.asmx`_. Example services using this external authentication
+service are:
+
+- `<http://decouverte.sgdf.fr/>`_:
+
+ .. image:: auth-decouverte.png
+- `<https://petitions.sgdf.fr/>`_:
+
+ .. image:: auth-petitions.png
+- `<https://valorise-toi.sgdf.fr/>`_:
+
+ .. image:: auth-valorise.png
+
+.. _Authentification.asmx: https://intranet.sgdf.fr/Specialisation/Sgdf/WebServices/Authentification.asmx
diff --git a/docs/intranet/codes.rst b/docs/intranet/codes.rst
new file mode 100644
index 0000000..5d296af
--- /dev/null
+++ b/docs/intranet/codes.rst
@@ -0,0 +1,162 @@
+Codes
+=====
+
+The intranet represents structures and adherents through a central code system,
+where each code is composed of nine (9) characters, usually decimal digits.
+One code is usually attributed to only one element, although there are
+exceptions of this (see the examples).
+
+Predicting the element type
+---------------------------
+
+A code cannot be used to predict an element's type (because of exceptions), but
+it can in most cases, using these rules (empirically obtained, where ``#``
+represent any character):
+
+- if the code is ``000000000``, then the element is a top.
+- if the code is ``##0000000`` or ``##9999999``, then the element is a
+ “centre national”.
+- if the code starts with ``12``, ``13``, ``14``, ``15``, ``16`` (or ``17``?),
+ then the element is an adherent.
+- if the code starts with ``98``:
+
+ - if the five following characters are ``88001``:
+
+ - if the code ends with ``#8``, then the element is a
+ “membres associés national”.
+ - otherwise, then the element is a “centre national”.
+ - otherwise:
+
+ - if the code ends with ``8#``, then the element is a “membres
+ associés national”.
+ - otherwise, then the element is a “centre national”.
+- otherwise:
+
+ - the department code is the two following characters.
+ - the territory number is the following character.
+ - the group number is the two following characters.
+ - if the group number is ``00``:
+
+ - if the two last characters are ``00``, then the element is a territory.
+ - otherwise, then the element is a “membres associés territorial”.
+ - otherwise:
+
+ - if the two last characters are ``00``, then the element is a group.
+ - if the two last characters are ``1#``, then the element is a
+ louveteaux-jeanettes unit.
+ - if the two last characters are ``2#``, then the element is a
+ scouts-guides unit.
+ - if the two last characters are ``3#``, then the element is a
+ pionniers-caravelles unit.
+ - if the two last characters are ``7#``, then the element is a
+ farfadet unit.
+ - if the two last characters are ``9#``, then the element is a
+ Vent du Large unit.
+ - otherwise, then the element is a “membres associés local”.
+
+Examples
+--------
+
+Code examples follow:
+
+``000000000``
+ “SCOUTS ET GUIDES DE FRANCE” or “GUIDES DE FRANCE” (sommet)
+
+``010000000``
+ “CENTRE NATIONAL” or “REGION ALSACE” (centre national).
+
+``010100000``
+ “CONSEIL ADMINISTRATION” (territoire).
+
+``010200000``
+ “EQUIPE NATIONALE” (territoire) or “GUIDE” (groupe).
+
+``016700000``
+ “DEPARTEMENT BAS RHIN” (territoire).
+
+``016703200``
+ “GROUPE DISTRICT STRASBOURG SUD” (groupe).
+
+``016703300``
+ “DISTRICT DOMPETER” (territoire).
+
+``034300000``
+ “DEPARTEMENT HAUTE LOIRE” (territoire).
+
+``090000000``
+ “REGION FRANCHE-COMTE” (centre national).
+
+``100000000``
+ “CR ILE DE FRANCE” (centre national).
+
+``107530000``
+ “CODEPIE PARIS EST” (territoire).
+
+``107700100``
+ “GROUPE DE MONTEREAU” (groupe).
+
+``107700141``
+ “1ERE COMPAGNONS MONTEREAU” (unité 17-20 ans).
+
+``107700301``
+ “GROUPE 1E MEAUX - UNITE” (Autres).
+
+``107700371``
+ “1ERE SARABANDE MEAUX” (Unité Farfadet).
+
+``107700781``
+ “RESEAU DES PARENTS ET AMIS DE MONTEREAU” (Membres associés local).
+
+``107840391``
+ “VENT DU LARGE ST SYMPHORIEN” (Unité Vent du Large).
+
+``109999999``
+ “REGION ILE DE FRANCE” (centre national).
+
+``121160477``
+ Anonymous (adhérent).
+
+``152968525``
+ Anonymous (adhérent).
+
+``163382220``
+ Anonymous (adhérent).
+
+``3B0000000``
+ “ILE DE FRANCE EST” (centre national).
+
+``700000000``
+ “OUEST” (centre national).
+
+``709999999``
+ “MOUVEMENTS ASSOCIES” (centre national).
+
+``969711400``
+ “GROUPE ABYMES” (groupe).
+
+``980010000``
+ “EQUIPES NATIONALES ADMINISTRATION GENERALE” (centre national).
+
+``988600310``
+ “COLIBRI” (centre national).
+
+``988601081``
+ “MEMBRES ASSOCIES JAMBVILLE” (centre national).
+
+``988800130``
+ “FORMATION CR NORD EST” (centre national).
+
+``988800180``
+ “FORMATION CR OUTRE MER” (centre national).
+
+``988900901``
+ “EQUIPE NATIONALE RESEAU IMPESA” (centre national).
+
+``991000700``
+ “GROUPE V.N - LIMOGES” (groupe).
+
+``TO0000000``
+ “NOUVELLE CALEDONIE” (centre national).
+
+``TO9810000``
+ “NOUVELLE CALEDONIE NORD” (territoire).
diff --git a/docs/intranet/events.rst b/docs/intranet/events.rst
new file mode 100644
index 0000000..0d068e4
--- /dev/null
+++ b/docs/intranet/events.rst
@@ -0,0 +1,59 @@
+Events
+======
+
+An event is TODO
+
+Representation
+--------------
+
+TODO
+
+Paths
+-----
+
+``/animation/ConsulterCalendrier.aspx``
+ A calendar. Loads month/structure relationships through fragments.
+
+``/animation/CreerDateCalendrier.aspx``
+ A form to create or duplicate an event (transmitted to this page by the
+ previous one). While creating, it takes the following GET parameters:
+
+ ``date``
+ The number of seconds of the day since January 1st, 1, with seven
+ zeroes behind. This can be obtained with the following calculation
+ in Python, ``dt`` being the ``datetime.datetime`` instance of the
+ date you want to encode:
+
+ .. code-block:: python
+
+ td = dt - datetime(1, 1, 1, 0, 0)
+ dateparam = f"{td.total_seconds()}0000000"
+
+ ``idStructure``
+ The identifier for the structure to which to link the event to.
+
+ And while duplicating, it takes the following GET parameters:
+
+ ``idDuplique``
+ The identifier of the event to duplicate.
+
+ ``idStructure``
+ The identifier for the structure to which to link the event to.
+
+``/animation/ModifDateCalendrier.aspx``
+ A form to edit an event. It takes the following GET parameters:
+
+ ``id``
+ The identifier of the event to modify.
+
+Miscallaneous
+-------------
+
+I'm fairly sure there is a web service for gathering events: in the `SGDF
+sites <https://sites.sgdf.fr/>`_ tutorials, there is one for synchronizing
+events with the intranet and a Google Agenda available `here
+<https://sites.sgdf.fr/tutoriels/administrer-le-calendrier/>`_:
+
+.. image:: https://sites.sgdf.fr/wp-content/uploads/2017/03/2017-12-04-12_45_19-Photos-768x370.jpg
+
+Still, the service name is to be found.
diff --git a/docs/intranet/ids.rst b/docs/intranet/ids.rst
new file mode 100644
index 0000000..fd40ce8
--- /dev/null
+++ b/docs/intranet/ids.rst
@@ -0,0 +1,23 @@
+Identifying elements
+====================
+
+The intranet uses various techniques to identify elements.
+
+Intranet identifiers (iid)
+--------------------------
+
+The intranet uses 16-byte identifiers in URLs to know which structure to get,
+etc. I call one a “intranet identifier” or “iid” for short. IIDs are
+usually base64-encoded and quoted for them to be used as HTTP GET parameters,
+e.g. ``?id=yCkyTmNDHpp8CotDhWoEkQ%3D%3D``.
+
+An IID can be used on the intranet for two objects of different types.
+It happens often that IIDs used by calendar events are also used for
+representing membership form printouts.
+
+Codes
+-----
+
+Inherited from the Intr@ssoc base is a common code system for adherents and
+structures. Codes are described more in depth in `its own document
+<codes.html>`_.
diff --git a/docs/intranet/index.rst b/docs/intranet/index.rst
new file mode 100644
index 0000000..513bc4b
--- /dev/null
+++ b/docs/intranet/index.rst
@@ -0,0 +1,75 @@
+The intranet
+============
+
+Most management actions linked to the organization goes through the intranet,
+which is edited, maintained and hosted by `Supralog`_ since circa 2006.
+It is available through:
+
+- the official domain, `<https://intranet.sgdf.fr/>`_.
+- a development domain, `<https://sgdf.intrassoc.com/>`_, although the
+ HTTPS certificate doesn't cover it.
+
+A test instance is available through:
+
+- the official domain, `<http://intranet-qualification.sgdf.fr/>`_.
+- a development domain, `<http://sgdf-qualification.intrassoc.com/>`_.
+
+The intranet allows one to manage, amongst other things:
+
+- registrations and adherents.
+- access to other services.
+- functions within the organization (nominations, …).
+- structures (groups, territories, …).
+- estate, places.
+- events (meetings, work meetings, camps, rallies, …).
+- accountancy (spendings, donations, …).
+- training courses.
+- accidents and sinisters.
+
+The intranet is an `Intr@ssoc`_ derivative (this is also the case, amongst
+french scouting organizations, for the `Éclaireuses et Éclaireurs
+de France <EEDF_>`_). It is made in `ASP.NET`_ (that's tipped off by the
+``X-Powered-By`` header and the ``.aspx`` extensions in the URL) and runs on
+a webserver that identifies itself as `Microsoft IIS`_ 7.5.
+
+Paths usually start with ``/Specialisation/Sgdf``, probably because the app
+is an adaptation of `Intr@ssoc`_ and needs its own path, although most pages
+can also be accessed without this prefix (duplicate content, well done guys).
+
+There are three kind of interactions with the intranet:
+
+- through ``GET``-ting a page.
+- through ``POST``-ing a page while gathering fields on the ``GET`` version
+ (including a CSRF token).
+- through gathering a `Microsoft Ajax`_ page fragment.
+- through SOAP 1.1 and 1.2 for web services (unused in SGDFi).
+
+Returned documents are usually one of these:
+
+- ``text/html``: an HTML document or fragment.
+- ``text/csv``: a CSV document.
+- ``text/xml``: an XML document.
+- ``application/x-microsoft-ajax`` (sent as ``text/plain``): a
+ `Microsoft Ajax`_ response.
+- ``application/json``: a JSON document.
+
+See these documents for more details:
+
+.. toctree::
+ :maxdepth: 2
+
+ auth
+ ids
+ adherents
+ structures
+ events
+ places
+ operations
+ misc
+
+.. _Supralog: http://www.supralog.com
+.. _Intr@ssoc: http://www.intrassoc.com/
+.. _ASP.NET: https://www.asp.net/
+.. _Microsoft IIS: https://www.iis.net/
+.. _Microsoft Ajax: https://msdn.microsoft.com/fr-fr/library/ee341002(v=vs.100).aspx
+.. _EEDF: https://www.eedf.fr/
diff --git a/docs/intranet/misc.rst b/docs/intranet/misc.rst
new file mode 100644
index 0000000..f480222
--- /dev/null
+++ b/docs/intranet/misc.rst
@@ -0,0 +1,54 @@
+Miscallaneous
+=============
+
+Other locations
+---------------
+
+``/Default.aspx``
+ Login page.
+
+``/Accueil.aspx``
+ A home page where you are redirected when you can find some tips and
+ announcements, plus the menu.
+
+``/erreurs/Erreur.aspx``
+ An error has occured and the user is redirected to this page, which
+ takes a few GET parameters:
+
+ ``aspxerrorpath``
+ The path of the error, e.g.
+ ``/Specialisation/Sgdf/animation/ModifDateCalendrier.aspx``.
+
+``/Recherche.aspx``
+ The direct search, on the top right of most pages when the user is logged
+ in, redirects to this page, which takes two GET arguments:
+
+ ``type``
+ The type of element to search, amongst ``adh`` for adherents and
+ ``str`` for structures.
+
+ ``text``
+ The text to search.
+
+ This page redirects either:
+
+ - to the adherent or structure page if exactly one result has been found.
+ - to the appropriate search page with pre-filled fields:
+
+ - for adherents, the first and common names with wildcards at the end.
+ - for structures, the structure name with wildcards before and after.
+
+``/ActivitesAnnee/EditerRegistrePresence.aspx``
+ A form to modify the attendee register.
+
+``/nominations/DemandeNomination.aspx``
+ A form to request for nomination.
+
+``/BiensLocauxAssurances/RechercherBien.aspx``
+ List owned places.
+
+``/WebServices/AutoComplete.asmx/GetFonctions``
+ An XML document containing function data for autocompleting.
+
+ Takes a ``q`` GET parameter which can be empty (e.g. ``?q=``) to get
+ all functions.
diff --git a/docs/intranet/operations.rst b/docs/intranet/operations.rst
new file mode 100644
index 0000000..a1626fd
--- /dev/null
+++ b/docs/intranet/operations.rst
@@ -0,0 +1,99 @@
+Operations
+==========
+
+The operations, called events on the intranet but which I renamed to avoid
+confusion with the events happening outside the intranet, are actions the
+users do on the intranet.
+
+Representation
+--------------
+
+TODO
+
+Paths
+-----
+
+``/popups/JournalEvenements.aspx``
+ Get events corresponding to an entity on the application. Takes the
+ following GET parameters:
+
+ ``typeEntite``
+ The entity type, amongst:
+
+ ``1``
+ Structure/season relation. (?)
+
+ ``2``
+ ?
+
+ ``3``
+ Patrimony (??)
+
+ ``4``
+ Adherent.
+
+ ``5``
+ ?
+
+ ``6``
+ ?
+
+ ``7``
+ ?
+
+ ``8``
+ Event (calendar date).
+
+ ``9``
+ ?
+
+ ``10``
+ ?
+
+ ``11``
+ Training course.
+
+ ``12``
+ Training course registration.
+
+ ``13``
+ Camp.
+
+ ``14``
+ Place.
+
+ ``15``
+ Membership form (?).
+
+ ``16``
+ J&S declaration (?).
+
+ ``17``
+ ?
+
+ ``18``
+ ?
+
+ ``19``
+ Rally registration.
+
+ ``20``
+ ?
+
+ ``21``
+ ?
+
+ ``22``
+ ?
+
+ ``23``
+ ?
+
+ ``24``
+ ?
+
+ ``25``
+ ?
+
+ ``idEntite``
+ An intranet identifier (16 byte sequence, base64 encoded).
diff --git a/docs/intranet/places.rst b/docs/intranet/places.rst
new file mode 100644
index 0000000..45e051e
--- /dev/null
+++ b/docs/intranet/places.rst
@@ -0,0 +1,16 @@
+Places
+======
+
+A place is TODO.
+
+Representation
+--------------
+
+TODO
+
+Paths
+-----
+
+``/Commun/ResumeLieuActivite.aspx``
+ Place summary. Takes an ``id`` GET parameter which is the intranet
+ ID for the place.
diff --git a/docs/intranet/structures.rst b/docs/intranet/structures.rst
new file mode 100644
index 0000000..5a008f8
--- /dev/null
+++ b/docs/intranet/structures.rst
@@ -0,0 +1,26 @@
+Structures
+==========
+
+A structure is TODO
+
+Representation
+--------------
+
+TODO
+
+Paths
+-----
+
+``/structures/ResumeStructure.aspx``
+ A summary page for a structure. Loads the tabs through forms (not
+ fragments).
+
+``/Popups/RechercheStructure.aspx``
+ Searches through public structures. Uses the following GET parameters:
+
+ ``dummy``
+ Must be ``1``. The form won't work correctly without it, for
+ some reason.
+
+ ``operations``
+ An intranet identifier (?), e.g. ``fCx2YIJV6Qq+qLBWSyMcwA==``.
diff --git a/sgdfi/_dbs/_code.py b/sgdfi/_dbs/_code.py
index 29ac9ef..b416e30 100755
--- a/sgdfi/_dbs/_code.py
+++ b/sgdfi/_dbs/_code.py
@@ -22,43 +22,24 @@ class CodeType(_Enum):
""" Adherent. """
ADHERENT = 2
-# If a code starts with:
-# - 000000000, then it is the top.
-# - X0 or X1, then it is a structure (see below for subtypes).
-# - X2 to X6, then it is an adherent.
-# - 0 or X8, then it is a structure related to the national.
-#
-# If it is a structure and its code ends with:
-# - 0000, then it is a territory (territoire).
-# - 0081, then it is a “membre associés territorial”,
-# usually a “Développement et réseaux.”.
-# - 00, then it is a group (groupe).
-# - 81, then it is a “membre associés local”.
-#
-# XXX: … (units? other types?)
-#
-# If it is related to the national, then
-# - X80 or X86, then it is a centre national.
-# - X88, then if the code ends with:
-# - 0X or 10, then it is a centre national.
-# - [1-7]8, then it is a “membres associés national” (développement et
-# réseau formation).
-# - 8X, then it is a “membre associés national”.
-#
-# For any substructure, after the 10 or 11, the code starts with two digits
-# representing the department (e.g. 78 or 91) and a digit representing the
-# territory number for this department.
+_strcodeallowed = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def _strcode(value):
""" Normalize the code and validate it. """
+ oldvalue = value
+
try:
- value = int(value)
- assert value >= 0 and value <= 999999999
- except (ValueError, AssertionError):
- raise ValueError("Invalid code.") from None
+ value = f"{int(value):09d}"
+ except ValueError:
+ pass
+
+ value = value.strip().upper()
+ value = value.rjust(9, '0')
- return f"{value:09d}"
+ if len(value) != 9 or any(c not in _strcodeallowed for c in value):
+ raise ValueError(f"Can't get a code out of {repr(oldvalue)}")
+ return value
class Code:
""" A structure code, which is a 9-digit number. """
@@ -155,7 +136,11 @@ class Code:
return self.__code
def __eq__(self, value):
- return self.__code == _strcode(value)
+ try:
+ code = _strcode(value)
+ return self.__code == code
+ except ValueError:
+ return False
@property
def type(self):
diff --git a/sgdfi/_intranet.py b/sgdfi/_intranet.py
index e349bd3..1d76a9e 100755
--- a/sgdfi/_intranet.py
+++ b/sgdfi/_intranet.py
@@ -53,6 +53,7 @@ class IntranetSession:
# Connexion.
self.login()
+ # XXX: get information about self.
def __repr__(self):
return f"{self.__class__.__name__}(user = {repr(self.__user)})"