Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
a5d0490
WIP user sync from coops pt
Theophile-Madet Jun 11, 2025
40b5bcf
LDAP as default login backend
Theophile-Madet Jun 11, 2025
c4c7c8f
Updated README.md
Theophile-Madet Jun 11, 2025
e2c65f5
Small reliability update in coops_pt_auth_backend.py
Theophile-Madet Jun 11, 2025
c79bff3
Added automated celery task for syncing users
Theophile-Madet Jun 11, 2025
0ced188
Hide some of the sidebar links if SHIFT_ONLY is enabled.
Theophile-Madet Jun 11, 2025
58247fb
Update misc sidebar links in rizoma content mode.
Theophile-Madet Jun 11, 2025
cbcdf87
WIP data migration capabilities
Theophile-Madet Jun 12, 2025
78f0c74
Data transition from old required capabilities to new configurable on…
Theophile-Madet Jun 12, 2025
6e8a8bd
Added models and slots for the configurable shift slot warnings
Theophile-Madet Jun 12, 2025
ca8fb6e
Data migration from old to configurable warning fields (logic not don…
Theophile-Madet Jun 12, 2025
26e77c8
Tests green \o/
Theophile-Madet Jun 12, 2025
454ecd7
A few fixes around loging in with the coops pt API.
Theophile-Madet Jun 23, 2025
249af20
Admin role from coops pt backend
Theophile-Madet Jun 23, 2025
15190a7
Create ShareOwners if necessary
Theophile-Madet Jun 23, 2025
757c6fe
Hourly sync of coops pt users and members.
Theophile-Madet Jun 23, 2025
9b81d8b
Removed unused calls to len()
Theophile-Madet Jun 23, 2025
2cfd3e0
WIP editing warnings
Theophile-Madet Jun 23, 2025
2ada71e
Shift slot warnings can be edited and assigned to slots.
Theophile-Madet Jun 24, 2025
f9adb4f
Qualifications can be edited and assigned to shifts
Theophile-Madet Jun 24, 2025
c918b3e
Editable user qualifications
Theophile-Madet Jun 24, 2025
34f18f5
Added qualification filters back.
Theophile-Madet Jun 24, 2025
2c15f5f
Import names from coops pt api
Theophile-Madet Jun 24, 2025
fdacf8f
WIP updating or skipping tests in coops.pt login mode.
Theophile-Madet Jul 1, 2025
61ae480
Fixed user data generation in coopts pt login mode
Theophile-Madet Jul 7, 2025
3d85461
Show purchase tracking only outside of shifts_only mode
Theophile-Madet Jul 7, 2025
ecdd512
Added member pictures.
Theophile-Madet Jul 7, 2025
20ea8b2
Hide more content in shifts only mode.
Theophile-Madet Jul 7, 2025
64c972f
Fixed member edit not working
Theophile-Madet Jul 8, 2025
ad1f964
Added portugal translation files
Theophile-Madet Jul 28, 2025
20530ff
Use an API key instead of an admin account and bearer tokens when com…
Theophile-Madet Aug 4, 2025
05edd93
Fixed user sync task using the old command name
Theophile-Madet Aug 4, 2025
cd14581
feat: added import command for the rizoma shifts.
Theophile-Madet Aug 28, 2025
ac246a5
feat: consistent and configurable slot/slot_template ordering.
Theophile-Madet Aug 28, 2025
8f6270d
fix: set default language to english for rizoma
Theophile-Madet Sep 2, 2025
d7170a5
fix: avoid NoneType error in tapir.coop.emails.extra_shares_confirmat…
Theophile-Madet Sep 2, 2025
422901f
fix: avoid NoneType error in some mails
Theophile-Madet Sep 2, 2025
7829e8a
feat: Create TapirUsers for all rizoma members including those that d…
Theophile-Madet Sep 2, 2025
91c2043
feat: Added profile pictures to the tapir user detail page.
Theophile-Madet Sep 2, 2025
1a983a8
feat: Added an option to the sync_users_with_coops_pt_backend command…
Theophile-Madet Sep 2, 2025
cb3b5e9
fix: strip first and last names when syncing members
Theophile-Madet Sep 2, 2025
4e60d01
feat: import shift attendance templates from the rizoma shift data.
Theophile-Madet Sep 2, 2025
f586572
fix: Celery workers now use the environment variables from the .env f…
Theophile-Madet Sep 4, 2025
eeaee5b
feat: create google calendar events for each shift attendance.
Theophile-Madet Sep 9, 2025
fe10368
feat: when trying to login with an unwknown user, check if a user has…
Theophile-Madet Sep 15, 2025
798e157
Add Portuguese translations (#659)
emmanuelgratuze Sep 15, 2025
c7809f4
fix: search members by casefolded names when importing rizoma shifts.
Theophile-Madet Sep 16, 2025
7169c27
misc: translations from weblate.
Theophile-Madet Sep 16, 2025
d64b51b
feat: working google login and calendar events
Theophile-Madet Sep 16, 2025
bf52846
fix: better name for the google client secret file var.
Theophile-Madet Sep 16, 2025
84d414e
feat: updated the README.md file for more info about the Rizoma version.
Theophile-Madet Sep 16, 2025
b4bc22c
feat: when importing rizoma shifts:
Theophile-Madet Sep 17, 2025
ba40869
feat: when importing members from coops.pt,
Theophile-Madet Sep 17, 2025
d4ddc1d
Weblate translations (#670)
Theophile-Madet Sep 26, 2025
c4097ad
fix: don't show the solidarity shift checkbox on the registration for…
Theophile-Madet Sep 26, 2025
7661a0c
fix: disabled member edit views when in shift only mode.
Theophile-Madet Sep 26, 2025
9b26d04
feat: added views to deleted a shift slot.
Theophile-Madet Sep 26, 2025
97cb5aa
feat: added views to delete a shift slot.
Theophile-Madet Sep 26, 2025
098c71c
misc: translations from weblate
Theophile-Madet Sep 29, 2025
b21c086
feat: added views to deleted an ABCD slot template.
Theophile-Madet Sep 29, 2025
5419d0f
feat: added views to deleted an ABCD shift.
Theophile-Madet Sep 29, 2025
f528a1b
feat: added a command to import the shift capabilities for rizoma users.
Theophile-Madet Sep 29, 2025
1fad339
misc: updated translation file.
Theophile-Madet Sep 29, 2025
e7c6165
fix: The date is the header for shift detail pages is not translated.
Theophile-Madet Oct 2, 2025
d13b3a0
Update layout for Rizoma version (#663)
emmanuelgratuze Oct 2, 2025
e12fea9
fix: members from coops.pt that are not active (field _isActiveSince)…
Theophile-Madet Oct 2, 2025
3f671e3
feat: added a second shift reminder email 2 days before the shift, fo…
Theophile-Madet Oct 2, 2025
c07900c
misc: removed file that should not be in git
Theophile-Madet Oct 2, 2025
95f7466
fix: calendar loads without too many DB queries again
Theophile-Madet Oct 2, 2025
b2b04c4
misc: small documentation update about syncing user data with coops.pt
Theophile-Madet Oct 6, 2025
2dfcc1e
misc: typo fix in the readme
Theophile-Madet Oct 6, 2025
5292dc3
feat: Added a feature flag to block all outgoing emails.
Theophile-Madet Oct 9, 2025
fd4b336
feat: Added a command that creates google calendar events for all fut…
Theophile-Madet Oct 9, 2025
1b127e3
fix: the shift detail pages now checks for capabilities correctly.
Theophile-Madet Oct 11, 2025
39b747f
feat: thresholds for self unregistering and self looking for standins…
Theophile-Madet Oct 11, 2025
b68e5e2
feat: ABCD users can unregister from their not-ABCD shifts but only i…
Theophile-Madet Oct 11, 2025
d415857
feat: added a command to get the new coop pt ids in case they changed.
Theophile-Madet Oct 16, 2025
c49a2b5
fix: removed unused parameter check from the fetch_new_coops_pt_ids c…
Theophile-Madet Oct 16, 2025
7ef2627
fix: invalid update in update_tapir_user_external_ids
Theophile-Madet Oct 16, 2025
d3597f8
fix: invalid update in update_tapir_user_external_ids
Theophile-Madet Oct 16, 2025
6098a50
feat: better google calendar events
Theophile-Madet Oct 16, 2025
90dce71
fix: after fetching new coops.pt ids, activate the corresponding user…
Theophile-Madet Oct 17, 2025
341b302
fix: logout link in the base template was using GET instead of POST
Theophile-Madet Oct 22, 2025
0686af2
misc: added a __str__ to FeatureFlag
Theophile-Madet Oct 22, 2025
196e73c
misc: added unit tests for the coops pt auth backend
Theophile-Madet Oct 22, 2025
24a27c4
misc: added unit tests for coops_pt_login_manager
Theophile-Madet Oct 22, 2025
80413cb
fix: don't import rizoma members that don't have the "Consumo" tag.
Theophile-Madet Nov 3, 2025
f992030
fix: Updated the filter tag for rizoma member imports from "Consumo" …
Theophile-Madet Nov 3, 2025
19b0d17
fix: when syncing users, if some users need to be deleted, remove the…
Theophile-Madet Nov 7, 2025
c898267
feat: When syncing users with the coops.pt backend, update the email …
Theophile-Madet Nov 7, 2025
056ccaf
fix: members coming from coops.pt can now have a null phone number.
Theophile-Madet Nov 19, 2025
55f7d22
Rizoma: better group affiliation checks (#713)
Theophile-Madet Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DEBUG=True
DJANGO_VITE_DEBUG=True
ACTIVE_LOGIN_BACKEND=ldap
COOPS_PT_API_BASE_URL=https://api.demo.coops.pt
ENABLE_RIZOMA_CONTENT=False
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,7 @@ dist-ssr
/static/
/.vite/deps_temp_bc2e2334/package.json
/members-current.csv

rsa_keys/
/google_client_secret_desktop.json
/google_user_token.json
84 changes: 73 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,38 @@
[![Python code test coverage](https://sonarcloud.io/api/project_badges/measure?project=SuperCoopBerlin_tapir&metric=coverage)](https://sonarcloud.io/summary/new_code?id=SuperCoopBerlin_tapir)
[![Lines of python code](https://sonarcloud.io/api/project_badges/measure?project=SuperCoopBerlin_tapir&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=SuperCoopBerlin_tapir)

Tapir is a member and shift management system of the food cooperative [SuperCoop Berlin](https://supercoop.de).
Tapir is a member and shift management system for [SuperCoop Berlin](https://supercoop.de)
and [Rizoma](https://www.rizomacoop.pt/)
Our Vorstand and member office uses Tapir to manage shifts and members, for example their personal data, capabilities,
payments and shift statuses. It is also used for automatic mails and evaluate new applicants.
Members can use Tapir to register or unregister for shifts, search for a stand-in and see their shift status as well as
upcoming shifts.


<img src="https://user-images.githubusercontent.com/18083323/179391686-4cfa724f-4847-4859-aba4-f074722d69ca.png" width="68%"/> <img src="https://user-images.githubusercontent.com/18083323/179391799-96f4e204-9bd2-4739-b8f9-3bc25a70f717.JPG" width="22.6%"/>

The Tapir project is developed by SuperCoop members, in collaberation with [WirMarkt Hamburg](https://wirmarkt.de/) and
is licensed under the terms of the [AGPL license](LICENSE.md).
The Tapir project is developed by SuperCoop members and is licensed under the terms of the [AGPL license](LICENSE.md).
If you're interested in using Tapir for your own coop, please contact [Théo](https://github.com/Theophile-Madet)
or [SuperCoop](https://supercoop.de/en/contact/), we'll be very happy to help!

SuperCoop members can access the system at [https://members.supercoop.de](https://members.supercoop.de).

> Tapir (/ˈteɪpər/) [has a trunk](https://www.youtube.com/watch?v=JgwBecM_E6Q), but not quite such a beautiful one
> as [Mme. l'élephan](https://github.com/elefan-grenoble/gestion-compte). Tapir is
> badass, [but not quite as badass as the other animals](https://www.youtube.com/watch?v=zJm6nDnR2SE). Let's teach Tapir
> some tricks!
Tapir (/ˈteɪpər/) was original inspired by the french
coop [L'éléfan](https://github.com/elefan-grenoble/gestion-compte), thanks to them for the inspiration.

A fork for community supported agriculture organization exists [here](https://github.com/FoodCoopX/wirgarten-tapir).
While they stil both use the name Tapir, they have diverged a lot and don't share any code anymore.

## Getting started

### Prerequisites

- Docker
- [Poetry](https://python-poetry.org/docs/)

Please note that while the actual program runs in a Docker container, you're adviced to install packages locally in order to use your IDE properly. For that you need a C Compiler such as gcc for Linux or the Visual C++ Build tools.
Please note that while the actual program runs in a Docker container, you're adviced to install packages locally in
order to use your IDE properly. For that you need a C Compiler such as gcc for Linux or the Visual C++ Build tools.

### Install

1. Clone the project.
Expand All @@ -49,8 +56,8 @@ For local development and testing, set up the test database and load test data
```sh
# Create tables
docker compose exec web poetry run python manage.py migrate
# Load admin (password: admin) account
docker compose exec web poetry run python manage.py loaddata admin_account
# Copy the .env file
docker compose exec web cp .env.test .env
# Load lots of test users & shifts
docker compose exec web poetry run python manage.py generate_test_data --reset_all
```
Expand All @@ -73,4 +80,59 @@ You can do so **without any programming or Python knowledge**! Just choose a tas
## Troubleshooting

* On macOS, in order to set up a local Python `venv`, you might have to install Postgresql to get `psycopg2` working.
Use `brew install postgresql` for that.
Use `brew install postgresql` for that.

## Rizoma version

Currently, two versions of Tapir exist: for SuperCoop on the `master` branch and for Rizoma under the `rizoma` branch.
If you keep the .env file as is, you'll get the SuperCoop version, which has member management and shift management.
By setting the .env file like this, you'll get the rizoma version, which concentrates on shifts and uses an external
identity provider.

```dotenv
DEBUG=True
DJANGO_VITE_DEBUG=
ACTIVE_LOGIN_BACKEND=coops.pt
COOPS_PT_API_BASE_URL=https://invalid_url.com
ENABLE_RIZOMA_CONTENT=True
SHIFTS_ONLY=True
COOPS_PT_API_KEY=invalid_api_key
COOPS_PT_RSA_PUBLIC_KEY_FILE_PATH=invalid_path
TEMPLATE_SUB_FOLDER=rizoma
```

### User synchronization with coops.pt

#### Setup

You need to define 2 environment variables for the user sync to work.

- The API key `COOPS_PT_API_KEY`, which you should get from [...].coops.pt/developers
- The path to the RSA public key file `COOPS_PT_RSA_PUBLIC_KEY_FILE_PATH`.
This key is used to validate the JWT tokens returned by the coops.pt API when logging in.
The key in the file should be in the "PKCS#1 PEM-encoded"-Format.

#### Automated sync

- Every hour, a celery task (`tapir.rizoma.tasks.sync_users_with_coops_pt_backend`) synchronizes the user list and the
member list from coops.pt instance (env var `COOPS_PT_API_BASE_URL`) in the Tapir DB.
- Changes done in Tapir are not reflected back to coops.pt.
- Members deleted from the coops.pt instance will be deleted from the Tapir instance.
- Newly created users can be used to log in right away, there is no need to wait for a sync.
- You can also run `manage.py sync_users_with_coops_pt_backend` to trigger a sync manually.

### Google calendar invites

When members register to a shift, it is possible to send them an invitation to a Google calendar event by mail.
This requires running local instance and the following setup:

- get a google secret json file from your Google app (
see [the docs](https://developers.google.com/workspace/calendar/api/quickstart/python))
- on your local machine, set the env var PATH_TO_GOOGLE_CLIENT_SECRET_FILE as path to that file and start your local
instance
- run `manage.py get_google_authorized_user_file`, login if necessary and authorize the app
- this will create a `google_user_token.json` file
- copy that file to your server, with the same name and relative path
- on the feature flag page (.../core/featureflag_list), enable the relevant flag:
`feature_flags.shifts.google_calendar_events_for_shifts`
- done!
Loading
Loading