Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

RESPA-231 | Various permission fixes and improvements #671

Merged

Conversation

tommimanbytes
Copy link
Contributor

@tommimanbytes tommimanbytes commented Jan 30, 2020

Resource permissions

  • Queryset filtering by permissions (with_perm-method of resource queryset) are now aware of new roles (Unit Group Admin, Unit Admin, Unit Manager, Unit Viewer). Also wrote unit tests for with_perm-method.

  • Permissions of each role are now defined in permissions.py in UNIT_ROLE_PERMISSIONS variable so they can be accessed from a single location in code. This makes reading and modifying role permissions much easier.
    image

  • Refactored method structure of resource models permissions to increase readability. Also renamed a couple of can_* - methods to be exactly same name as corresponding permission for consistency as most of the methods already were.

  1. can_* - methods now always calls only _has_perm method
  2. _has_perm method now calls _has_role_permission and _has_explicit_permission
  3. _has_role_permission checks if user has role that implicitly allows them to have certain permission. Uses before mentoined UNIT_ROLE_PERMISSIONS variable from permissions.py
  4. _has_explicit_permission checks if user has explicit Django Guardian permission to the resource
  • is_admin, is_manager and is_viewer now returns true only when user truly has that role. Is_manager used to return true even if user only had admin role.

Permissions.rst documentation

  • Removed resource permissions from Respa Admin Permissions section and created another similar table to represent role permissions under Resource Permissions section.
    image

  • Various minor fixes to documentation where unclear or inconsistent with implementation

This PR also solves RESPA-109

@tommimanbytes tommimanbytes force-pushed the RESPA-231/various-permission-fixes-and-improvements branch from bc548e1 to 2e36d56 Compare January 30, 2020 10:12
@tommimanbytes tommimanbytes force-pushed the RESPA-231/various-permission-fixes-and-improvements branch from 2e36d56 to 8d05889 Compare January 30, 2020 10:14
@tommimanbytes tommimanbytes changed the title Various permission fixes and improvements RESPA-231 | Various permission fixes and improvements Jan 30, 2020
@codecov-io
Copy link

codecov-io commented Jan 30, 2020

Codecov Report

Merging #671 into develop will increase coverage by 0.02%.
The diff coverage is 92.2%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #671      +/-   ##
===========================================
+ Coverage    81.93%   81.96%   +0.02%     
===========================================
  Files          200      200              
  Lines        13631    13660      +29     
  Branches      1354     1352       -2     
===========================================
+ Hits         11169    11196      +27     
- Misses        2187     2188       +1     
- Partials       275      276       +1
Impacted Files Coverage Δ
resources/auth.py 100% <100%> (ø) ⬆️
comments/models.py 82.85% <100%> (ø) ⬆️
resources/api/resource.py 88.61% <100%> (+0.02%) ⬆️
resources/tests/test_resource_api.py 100% <100%> (ø) ⬆️
caterings/api.py 99.25% <100%> (ø) ⬆️
resources/models/permissions.py 100% <100%> (ø) ⬆️
resources/models/reservation.py 84.07% <100%> (ø) ⬆️
respa_admin/permissions.py 100% <100%> (ø) ⬆️
resources/tests/test_resource.py 100% <100%> (ø) ⬆️
resources/models/unit.py 92% <73.33%> (-2.7%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 846a3c6...8d05889. Read the comment docs.

Copy link
Member

@jussiarpalahti jussiarpalahti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems legit

@jussiarpalahti jussiarpalahti merged commit 84a9f49 into develop Feb 3, 2020
@tommimanbytes tommimanbytes deleted the RESPA-231/various-permission-fixes-and-improvements branch March 4, 2020 12:35
ezkat added a commit to City-of-Turku/respa that referenced this pull request Jul 30, 2020
* Use distinct on unit queryset

* Change validation of management view

* Fix API document version numbering

* Change filter_reserver_info search behaviour

* Change login view texts

* Add missing translations for Respa admin unit views

* Respa admin: translation for unnamed new time period

* Enforce language in respa admin unit view tests

* Pseudonymize user data

* Add tests for pseudonymizing user data

* Change to correct term anonymization, remove unnecessary if clause

* Update OpenAPI spec (City-of-Helsinki#647)

* Update OpenAPI spec

Update OpenAPI specification to include test server url

* fix url typo

* RESPA-177 | Enable Unit Admins and Unit Managers to bypass payment (City-of-Helsinki#649)

* Add permissions for unit manager

* Make changes according to review

* Create can_bypass_payments permission

* Minor changes to payment bypass and add tests

* Add documentation for can_bypass_payment

* Add translations

* Fill in tests for manager level as well

* Change user permissions test to actually test ignoring payment

* Add custom_label property to generic select component

* Change translation

* Changes according to code review

* Changed double quotes to single

* Minor refactor to minimize redundancy in select element template

* Anonymize uuid

* Ignore age check for staff (#17)

* Update auth.py

* I hate mondays

* Database query optimizations for resource and reservation API endpoints

* Changed function level imports to module level in auth helper

* Add is_manager to permissions object

* Allow admins to bypass min_period

* Created missing migrations for changes in accessibility models

* Add unit viewer role which grants right to modify and see certain fields in reservations

* Remove hvara import

* Upgrade Pillo and Django

* Added translations for changes in unit viewer role

* Remove extra border width definition from text area (City-of-Helsinki#656)

* Added instructions to Open API documentation for usage of multiple extra data fields with include parameter (City-of-Helsinki#662)

* Update README.md

* Update requests and sentry-sdk

* Upgrade JS dependencies

* Upgrade helusers and make necessary adjustments

* Update django-helusers to 0.5.5

* Change staticfiles to static in HTML templates

* Create pytest filters to avoid non-relevant warnings

* Change order of installed apps (City-of-Helsinki#665)

* Set anonymized reservations state to cancelled

* Add .env.example and update README.md

* SMS Notifications (#18)

* Added token and session authentications for single resource viewset

* Refactor comment choices

* Change naming

* Feature/sms notifications with delay (#19)

* SMS Notifications

* Rename field verbose name & add translation

Fields modified:
    * sms_sms_reminder
    * sms_reminder_delay

* Increase the max value limit for reminder

* Migration

* address -> street_address

* use address_postal_full instead street_address

* Add project versioning to browsable API interface

* AssertionError fix

AssertionError: Re-adding the same key breaks proper expiration

* Move custom renderer under repsa folder

* Kulkunen SiPass driver changes (City-of-Helsinki#672)

* Kulkunen SiPass driver changes due to changes in SiPass API

* Override DRF's TokenAdmin

* Various permission fixes and improvements (City-of-Helsinki#671)

* Fix admin bypassing time restrictions

* Add extra checks to removing user permissions in JS

* Change order-by-link class hover background-color

* Initial

* Bump Django to 2.2.9 (#21)

* Bump Django to 2.2.9

* Bump Django to 2.2.9

* Add&Update requirements

* Added can_comment_reservations and can_view_reservation_user permissions for Unit Managers

* Some fixes and additions to permissions improvements (City-of-Helsinki#679)

* Fixed bug where anonymizing users didn't anonymize data in related SocialAccount and EmailAddress models causing errors (City-of-Helsinki#680)

* Allow customizing respa admin theme

* Update Python dependencies to secure versions

* Upgrade vulnerable dependencies and switch to using npm

* Add Theme customization block in README

* Update packages (#23)

* Update requirements.txt

* Bump django to 2.2.10

django-allauth to 0.41.0
pillow to 7.0.0

* Added payment terms field to Resource model and API. Also added the field to Respa Admin and tests.

* Added translations

* Check user from kwargs first

* Bump up version number

* Add Matomo analytics snippet to base template

* Fix merge conflicts with helsinki's respa (#1)

* Use distinct on unit queryset

* Change validation of management view

* Fix API document version numbering

* Change filter_reserver_info search behaviour

* Change login view texts

* Add missing translations for Respa admin unit views

* Respa admin: translation for unnamed new time period

* Enforce language in respa admin unit view tests

* Pseudonymize user data

* Add tests for pseudonymizing user data

* Change to correct term anonymization, remove unnecessary if clause

* Update OpenAPI spec (City-of-Helsinki#647)

* Update OpenAPI spec

Update OpenAPI specification to include test server url

* fix url typo

* RESPA-177 | Enable Unit Admins and Unit Managers to bypass payment (City-of-Helsinki#649)

* Add permissions for unit manager

* Make changes according to review

* Create can_bypass_payments permission

* Minor changes to payment bypass and add tests

* Add documentation for can_bypass_payment

* Add translations

* Fill in tests for manager level as well

* Change user permissions test to actually test ignoring payment

* Add custom_label property to generic select component

* Change translation

* Changes according to code review

* Changed double quotes to single

* Minor refactor to minimize redundancy in select element template

* Anonymize uuid

* Database query optimizations for resource and reservation API endpoints

* Changed function level imports to module level in auth helper

* Add is_manager to permissions object

* Allow admins to bypass min_period

* Created missing migrations for changes in accessibility models

* Add unit viewer role which grants right to modify and see certain fields in reservations

* Remove hvara import

* Upgrade Pillo and Django

* Added translations for changes in unit viewer role

* Remove extra border width definition from text area (City-of-Helsinki#656)

* Added instructions to Open API documentation for usage of multiple extra data fields with include parameter (City-of-Helsinki#662)

* Update requests and sentry-sdk

* Upgrade JS dependencies

* Upgrade helusers and make necessary adjustments

* Update django-helusers to 0.5.5

* Change staticfiles to static in HTML templates

* Create pytest filters to avoid non-relevant warnings

* Change order of installed apps (City-of-Helsinki#665)

* Set anonymized reservations state to cancelled

* Add .env.example and update README.md

* Added token and session authentications for single resource viewset

* Refactor comment choices

* Change naming

* Add project versioning to browsable API interface

* Move custom renderer under repsa folder

* Kulkunen SiPass driver changes (City-of-Helsinki#672)

* Kulkunen SiPass driver changes due to changes in SiPass API

* Override DRF's TokenAdmin

* Various permission fixes and improvements (City-of-Helsinki#671)

* Fix admin bypassing time restrictions

* Add extra checks to removing user permissions in JS

* Change order-by-link class hover background-color

* Added can_comment_reservations and can_view_reservation_user permissions for Unit Managers

* Some fixes and additions to permissions improvements (City-of-Helsinki#679)

* Fixed bug where anonymizing users didn't anonymize data in related SocialAccount and EmailAddress models causing errors (City-of-Helsinki#680)

* Allow customizing respa admin theme

* Update Python dependencies to secure versions

* Upgrade vulnerable dependencies and switch to using npm

* Add Theme customization block in README

* Check user from kwargs first

* Bump up version number

* Remove tkusers, use inherit instead

* Push files that git missed because of WSL permission conflicts

* Re-add code that randomly vanished

* Merge remote-tracking branch 'helsinki/develop' into FIX/level-to-helsinki

* Remove duplicate translations

* Remove duplicate function

* Relative import

* Remove unnecessary import

* Fix tests

* OAuth2Adapter -> HelsinkiOAuth2Adapter

* Fix import

Co-authored-by: otiala <44601448+otiala@users.noreply.github.com>
Co-authored-by: Petteri Laine <petteri.laine@iki.fi>
Co-authored-by: tommimanbytes <56429082+tommimanbytes@users.noreply.github.com>
Co-authored-by: Juha Suvanto <38026367+juhasuv@users.noreply.github.com>

* timedelta -> datetime.timedelta (#2)

* Squash some migrations created from editing users model (#3)

* Fix/merge duplicates (#4)

* Remove duplicates

* Squash migrations

* Fix signals not firing on cancelled reservations

* Optimize

* Bump PyYAML to 5.3 (#25)

* Requirements, remove exchangelib logging

* Remove duplicate translations

* Optimize

* Update .gitignore

* Added missing resource migrations

* Fix wrong timezone sent to outlook when appointment was made through api

(And bit more optimization)

* Bump django to 2.2.11 (#28)

* Machine to machine authentication (#29)

* Added M2M auth endpoint

* Daemon thread

* Who put that in there?

* Taggit search fields (#30)

* Add django-taggit

* Add tag field to respa_admin

* Update .travis.yml

* Update .travis.yml

* Make respa_exchange toggleable

* Revert .travis config

* Merge migrations

* Extend helusers SocialAccountAdapter

* Extend helusers SocialAccountAdapter, set assumed uuid

* Merge branch 'develop' into feature/outlook-integration

* Use provided email address as primary

* Merge branch 'develop' into feature/outlook-integration

* Remove duplicate columns from migration files

* Return resource keywords via api

* Feature/reservation home municipality (#31)

* Added home municipality field for reservations

* Added translations to home municipalities

* Added home municipalities to ra resource form

* Added fi translations

* Changed home municipality model naming and reservation home municipality to be object with translations rather than simple char field

* Changed how home municipalites are shown in admin and fixes to home municipality api logic

* Changed home municipality to not be always required via api

* Added home municipality field and set str tests

* Fixed reservation home municipality not handling dicts correctly via api

* Added sv translations for home municipality

* Added migrations for home municipality data

* Feature/phonenumber filter (#32)

* Filter reservations with reserver_phone_number

* change phonenumber default to str

* Feature/reservations without authentication (#33)

* Added unauthenticated option to resource auths

* Check for AnonymousUser

Co-authored-by: SanttuA <santtualatalo@gmail.com>

* Added validation checks for resource form to handle unauthenticated resource auth type (#34)

* Feature/var156 abloy integration (#35)

Added Abloy integration for kulkunen access code system. Abloy integration works mostly in the same way as sipass and requires an outside cronjob to run sync_kulkunen.

* Changed sms reminders to only allow certain notification types (#37)

* Fix search filter (#38)

* Merge upstream to develop (#39)

* Merge upstream/develop

* Bump django-parler

* Revert test changes

* Fix merge conflicts (#41)

* Merge develop to master (#20)

* Ignore age check for staff (#17)

* Update README.md

* SMS Notifications (#18)

* Feature/sms notifications with delay (#19)

* SMS Notifications

* Rename field verbose name & add translation

Fields modified:
    * sms_sms_reminder
    * sms_reminder_delay

* Increase the max value limit for reminder

* Bump django to 2.2.14 (#36)

& update insecure packages

Co-authored-by: Jussi Heikkilä <jussi.heikkila@haltu.fi>
Co-authored-by: Oskari Tiala <oskari.tiala@haltu.fi>
Co-authored-by: Petteri Laine <petteri.l.laine@hel.fi>
Co-authored-by: Jussi Heikkilä <jussi.heikkila@haltu.fi>
Co-authored-by: otiala <44601448+otiala@users.noreply.github.com>
Co-authored-by: Tommi Mantila <tommi@manbytes.fi>
Co-authored-by: tommimanbytes <56429082+tommimanbytes@users.noreply.github.com>
Co-authored-by: Juha Suvanto <38026367+juhasuv@users.noreply.github.com>
Co-authored-by: Petteri Laine <petteri.laine@iki.fi>
Co-authored-by: aceViilee <51813121+aceViilee@users.noreply.github.com>
Co-authored-by: SanttuA <santtualatalo@gmail.com>
ezkat added a commit to City-of-Turku/respa that referenced this pull request Aug 11, 2020
* Use distinct on unit queryset

* Change validation of management view

* Fix API document version numbering

* Change filter_reserver_info search behaviour

* Change login view texts

* Add missing translations for Respa admin unit views

* Respa admin: translation for unnamed new time period

* Enforce language in respa admin unit view tests

* Pseudonymize user data

* Add tests for pseudonymizing user data

* Change to correct term anonymization, remove unnecessary if clause

* Update OpenAPI spec (City-of-Helsinki#647)

* Update OpenAPI spec

Update OpenAPI specification to include test server url

* fix url typo

* RESPA-177 | Enable Unit Admins and Unit Managers to bypass payment (City-of-Helsinki#649)

* Add permissions for unit manager

* Make changes according to review

* Create can_bypass_payments permission

* Minor changes to payment bypass and add tests

* Add documentation for can_bypass_payment

* Add translations

* Fill in tests for manager level as well

* Change user permissions test to actually test ignoring payment

* Add custom_label property to generic select component

* Change translation

* Changes according to code review

* Changed double quotes to single

* Minor refactor to minimize redundancy in select element template

* Anonymize uuid

* Ignore age check for staff (#17)

* Update auth.py

* I hate mondays

* Database query optimizations for resource and reservation API endpoints

* Changed function level imports to module level in auth helper

* Add is_manager to permissions object

* Allow admins to bypass min_period

* Created missing migrations for changes in accessibility models

* Add unit viewer role which grants right to modify and see certain fields in reservations

* Remove hvara import

* Upgrade Pillo and Django

* Added translations for changes in unit viewer role

* Remove extra border width definition from text area (City-of-Helsinki#656)

* Added instructions to Open API documentation for usage of multiple extra data fields with include parameter (City-of-Helsinki#662)

* Update README.md

* Update requests and sentry-sdk

* Upgrade JS dependencies

* Upgrade helusers and make necessary adjustments

* Update django-helusers to 0.5.5

* Change staticfiles to static in HTML templates

* Create pytest filters to avoid non-relevant warnings

* Change order of installed apps (City-of-Helsinki#665)

* Set anonymized reservations state to cancelled

* Add .env.example and update README.md

* SMS Notifications (#18)

* Added token and session authentications for single resource viewset

* Refactor comment choices

* Change naming

* Feature/sms notifications with delay (#19)

* SMS Notifications

* Rename field verbose name & add translation

Fields modified:
    * sms_sms_reminder
    * sms_reminder_delay

* Increase the max value limit for reminder

* Migration

* address -> street_address

* use address_postal_full instead street_address

* Add project versioning to browsable API interface

* AssertionError fix

AssertionError: Re-adding the same key breaks proper expiration

* Move custom renderer under repsa folder

* Kulkunen SiPass driver changes (City-of-Helsinki#672)

* Kulkunen SiPass driver changes due to changes in SiPass API

* Override DRF's TokenAdmin

* Various permission fixes and improvements (City-of-Helsinki#671)

* Fix admin bypassing time restrictions

* Add extra checks to removing user permissions in JS

* Change order-by-link class hover background-color

* Initial

* Bump Django to 2.2.9 (#21)

* Bump Django to 2.2.9

* Bump Django to 2.2.9

* Add&Update requirements

* Added can_comment_reservations and can_view_reservation_user permissions for Unit Managers

* Some fixes and additions to permissions improvements (City-of-Helsinki#679)

* Fixed bug where anonymizing users didn't anonymize data in related SocialAccount and EmailAddress models causing errors (City-of-Helsinki#680)

* Allow customizing respa admin theme

* Update Python dependencies to secure versions

* Upgrade vulnerable dependencies and switch to using npm

* Add Theme customization block in README

* Update packages (#23)

* Update requirements.txt

* Bump django to 2.2.10

django-allauth to 0.41.0
pillow to 7.0.0

* Added payment terms field to Resource model and API. Also added the field to Respa Admin and tests.

* Added translations

* Check user from kwargs first

* Bump up version number

* Add Matomo analytics snippet to base template

* Fix merge conflicts with helsinki's respa (#1)

* Use distinct on unit queryset

* Change validation of management view

* Fix API document version numbering

* Change filter_reserver_info search behaviour

* Change login view texts

* Add missing translations for Respa admin unit views

* Respa admin: translation for unnamed new time period

* Enforce language in respa admin unit view tests

* Pseudonymize user data

* Add tests for pseudonymizing user data

* Change to correct term anonymization, remove unnecessary if clause

* Update OpenAPI spec (City-of-Helsinki#647)

* Update OpenAPI spec

Update OpenAPI specification to include test server url

* fix url typo

* RESPA-177 | Enable Unit Admins and Unit Managers to bypass payment (City-of-Helsinki#649)

* Add permissions for unit manager

* Make changes according to review

* Create can_bypass_payments permission

* Minor changes to payment bypass and add tests

* Add documentation for can_bypass_payment

* Add translations

* Fill in tests for manager level as well

* Change user permissions test to actually test ignoring payment

* Add custom_label property to generic select component

* Change translation

* Changes according to code review

* Changed double quotes to single

* Minor refactor to minimize redundancy in select element template

* Anonymize uuid

* Database query optimizations for resource and reservation API endpoints

* Changed function level imports to module level in auth helper

* Add is_manager to permissions object

* Allow admins to bypass min_period

* Created missing migrations for changes in accessibility models

* Add unit viewer role which grants right to modify and see certain fields in reservations

* Remove hvara import

* Upgrade Pillo and Django

* Added translations for changes in unit viewer role

* Remove extra border width definition from text area (City-of-Helsinki#656)

* Added instructions to Open API documentation for usage of multiple extra data fields with include parameter (City-of-Helsinki#662)

* Update requests and sentry-sdk

* Upgrade JS dependencies

* Upgrade helusers and make necessary adjustments

* Update django-helusers to 0.5.5

* Change staticfiles to static in HTML templates

* Create pytest filters to avoid non-relevant warnings

* Change order of installed apps (City-of-Helsinki#665)

* Set anonymized reservations state to cancelled

* Add .env.example and update README.md

* Added token and session authentications for single resource viewset

* Refactor comment choices

* Change naming

* Add project versioning to browsable API interface

* Move custom renderer under repsa folder

* Kulkunen SiPass driver changes (City-of-Helsinki#672)

* Kulkunen SiPass driver changes due to changes in SiPass API

* Override DRF's TokenAdmin

* Various permission fixes and improvements (City-of-Helsinki#671)

* Fix admin bypassing time restrictions

* Add extra checks to removing user permissions in JS

* Change order-by-link class hover background-color

* Added can_comment_reservations and can_view_reservation_user permissions for Unit Managers

* Some fixes and additions to permissions improvements (City-of-Helsinki#679)

* Fixed bug where anonymizing users didn't anonymize data in related SocialAccount and EmailAddress models causing errors (City-of-Helsinki#680)

* Allow customizing respa admin theme

* Update Python dependencies to secure versions

* Upgrade vulnerable dependencies and switch to using npm

* Add Theme customization block in README

* Check user from kwargs first

* Bump up version number

* Remove tkusers, use inherit instead

* Push files that git missed because of WSL permission conflicts

* Re-add code that randomly vanished

* Merge remote-tracking branch 'helsinki/develop' into FIX/level-to-helsinki

* Remove duplicate translations

* Remove duplicate function

* Relative import

* Remove unnecessary import

* Fix tests

* OAuth2Adapter -> HelsinkiOAuth2Adapter

* Fix import

Co-authored-by: otiala <44601448+otiala@users.noreply.github.com>
Co-authored-by: Petteri Laine <petteri.laine@iki.fi>
Co-authored-by: tommimanbytes <56429082+tommimanbytes@users.noreply.github.com>
Co-authored-by: Juha Suvanto <38026367+juhasuv@users.noreply.github.com>

* timedelta -> datetime.timedelta (#2)

* Squash some migrations created from editing users model (#3)

* Fix/merge duplicates (#4)

* Remove duplicates

* Squash migrations

* Fix signals not firing on cancelled reservations

* Optimize

* Bump PyYAML to 5.3 (#25)

* Requirements, remove exchangelib logging

* Remove duplicate translations

* Optimize

* Update .gitignore

* Added missing resource migrations

* Fix wrong timezone sent to outlook when appointment was made through api

(And bit more optimization)

* Bump django to 2.2.11 (#28)

* Machine to machine authentication (#29)

* Added M2M auth endpoint

* Daemon thread

* Who put that in there?

* Taggit search fields (#30)

* Add django-taggit

* Add tag field to respa_admin

* Update .travis.yml

* Update .travis.yml

* Make respa_exchange toggleable

* Revert .travis config

* Merge migrations

* Extend helusers SocialAccountAdapter

* Extend helusers SocialAccountAdapter, set assumed uuid

* Merge branch 'develop' into feature/outlook-integration

* Use provided email address as primary

* Merge branch 'develop' into feature/outlook-integration

* Remove duplicate columns from migration files

* Return resource keywords via api

* Feature/reservation home municipality (#31)

* Added home municipality field for reservations

* Added translations to home municipalities

* Added home municipalities to ra resource form

* Added fi translations

* Changed home municipality model naming and reservation home municipality to be object with translations rather than simple char field

* Changed how home municipalites are shown in admin and fixes to home municipality api logic

* Changed home municipality to not be always required via api

* Added home municipality field and set str tests

* Fixed reservation home municipality not handling dicts correctly via api

* Added sv translations for home municipality

* Added migrations for home municipality data

* Feature/phonenumber filter (#32)

* Filter reservations with reserver_phone_number

* change phonenumber default to str

* Feature/reservations without authentication (#33)

* Added unauthenticated option to resource auths

* Check for AnonymousUser

* 356343b

* 5e2ff17

Co-authored-by: SanttuA <santtualatalo@gmail.com>

* Added validation checks for resource form to handle unauthenticated resource auth type (#34)

* Feature/var156 abloy integration (#35)

Added Abloy integration for kulkunen access code system. Abloy integration works mostly in the same way as sipass and requires an outside cronjob to run sync_kulkunen.

* Bump django to 2.2.14 (#36)

& update insecure packages

* Changed sms reminders to only allow certain notification types (#37)

* Fix search filter (#38)

* Merge upstream to develop (#39)

* Merge upstream/develop

* Bump django-parler

* Revert test changes

* Fix merge conflicts (#41)

* Merge develop to master (#20)

* Ignore age check for staff (#17)

* Update auth.py

* Update README.md

* SMS Notifications (#18)

* Feature/sms notifications with delay (#19)

* SMS Notifications

* Rename field verbose name & add translation

Fields modified:
    * sms_sms_reminder
    * sms_reminder_delay

* Increase the max value limit for reminder

* Migration

* address -> street_address

* use address_postal_full instead street_address

* AssertionError fix

AssertionError: Re-adding the same key breaks proper expiration

* Bump Django to 2.2.9 (#22)

* Merge branch 'master' of https://github.com/ezkat/respa into fix-master-conflicts

Co-authored-by: Jussi Heikkilä <jussi.heikkila@haltu.fi>

* Upgrade packages

* Fix tests

* Remove old files

* OIDC hotfix

Co-authored-by: Oskari Tiala <oskari.tiala@haltu.fi>
Co-authored-by: Petteri Laine <petteri.l.laine@hel.fi>
Co-authored-by: Jussi Heikkilä <jussi.heikkila@haltu.fi>
Co-authored-by: otiala <44601448+otiala@users.noreply.github.com>
Co-authored-by: Tommi Mantila <tommi@manbytes.fi>
Co-authored-by: tommimanbytes <56429082+tommimanbytes@users.noreply.github.com>
Co-authored-by: Juha Suvanto <38026367+juhasuv@users.noreply.github.com>
Co-authored-by: Petteri Laine <petteri.laine@iki.fi>
Co-authored-by: aceViilee <51813121+aceViilee@users.noreply.github.com>
Co-authored-by: SanttuA <santtualatalo@gmail.com>
ezkat added a commit to City-of-Turku/respa that referenced this pull request Dec 3, 2020
* Use distinct on unit queryset

* Change validation of management view

* Fix API document version numbering

* Change filter_reserver_info search behaviour

* Change login view texts

* Add missing translations for Respa admin unit views

* Respa admin: translation for unnamed new time period

* Enforce language in respa admin unit view tests

* Pseudonymize user data

* Add tests for pseudonymizing user data

* Change to correct term anonymization, remove unnecessary if clause

* Update OpenAPI spec (City-of-Helsinki#647)

* Update OpenAPI spec

Update OpenAPI specification to include test server url

* fix url typo

* RESPA-177 | Enable Unit Admins and Unit Managers to bypass payment (City-of-Helsinki#649)

* Add permissions for unit manager

* Make changes according to review

* Create can_bypass_payments permission

* Minor changes to payment bypass and add tests

* Add documentation for can_bypass_payment

* Add translations

* Fill in tests for manager level as well

* Change user permissions test to actually test ignoring payment

* Add custom_label property to generic select component

* Change translation

* Changes according to code review

* Changed double quotes to single

* Minor refactor to minimize redundancy in select element template

* Anonymize uuid

* Ignore age check for staff (#17)

* Update auth.py

* I hate mondays

* Database query optimizations for resource and reservation API endpoints

* Changed function level imports to module level in auth helper

* Add is_manager to permissions object

* Allow admins to bypass min_period

* Created missing migrations for changes in accessibility models

* Add unit viewer role which grants right to modify and see certain fields in reservations

* Remove hvara import

* Upgrade Pillo and Django

* Added translations for changes in unit viewer role

* Remove extra border width definition from text area (City-of-Helsinki#656)

* Added instructions to Open API documentation for usage of multiple extra data fields with include parameter (City-of-Helsinki#662)

* Update README.md

* Update requests and sentry-sdk

* Upgrade JS dependencies

* Upgrade helusers and make necessary adjustments

* Update django-helusers to 0.5.5

* Change staticfiles to static in HTML templates

* Create pytest filters to avoid non-relevant warnings

* Change order of installed apps (City-of-Helsinki#665)

* Set anonymized reservations state to cancelled

* Add .env.example and update README.md

* SMS Notifications (#18)

* Added token and session authentications for single resource viewset

* Refactor comment choices

* Change naming

* Feature/sms notifications with delay (#19)

* SMS Notifications

* Rename field verbose name & add translation

Fields modified:
    * sms_sms_reminder
    * sms_reminder_delay

* Increase the max value limit for reminder

* Migration

* address -> street_address

* use address_postal_full instead street_address

* Add project versioning to browsable API interface

* AssertionError fix

AssertionError: Re-adding the same key breaks proper expiration

* Move custom renderer under repsa folder

* Kulkunen SiPass driver changes (City-of-Helsinki#672)

* Kulkunen SiPass driver changes due to changes in SiPass API

* Override DRF's TokenAdmin

* Various permission fixes and improvements (City-of-Helsinki#671)

* Fix admin bypassing time restrictions

* Add extra checks to removing user permissions in JS

* Change order-by-link class hover background-color

* Initial

* Bump Django to 2.2.9 (#21)

* Bump Django to 2.2.9

* Bump Django to 2.2.9

* Add&Update requirements

* Added can_comment_reservations and can_view_reservation_user permissions for Unit Managers

* Some fixes and additions to permissions improvements (City-of-Helsinki#679)

* Fixed bug where anonymizing users didn't anonymize data in related SocialAccount and EmailAddress models causing errors (City-of-Helsinki#680)

* Allow customizing respa admin theme

* Update Python dependencies to secure versions

* Upgrade vulnerable dependencies and switch to using npm

* Add Theme customization block in README

* Update packages (#23)

* Update requirements.txt

* Bump django to 2.2.10

django-allauth to 0.41.0
pillow to 7.0.0

* Added payment terms field to Resource model and API. Also added the field to Respa Admin and tests.

* Added translations

* Check user from kwargs first

* Bump up version number

* Add Matomo analytics snippet to base template

* Fix merge conflicts with helsinki's respa (#1)

* Use distinct on unit queryset

* Change validation of management view

* Fix API document version numbering

* Change filter_reserver_info search behaviour

* Change login view texts

* Add missing translations for Respa admin unit views

* Respa admin: translation for unnamed new time period

* Enforce language in respa admin unit view tests

* Pseudonymize user data

* Add tests for pseudonymizing user data

* Change to correct term anonymization, remove unnecessary if clause

* Update OpenAPI spec (City-of-Helsinki#647)

* Update OpenAPI spec

Update OpenAPI specification to include test server url

* fix url typo

* RESPA-177 | Enable Unit Admins and Unit Managers to bypass payment (City-of-Helsinki#649)

* Add permissions for unit manager

* Make changes according to review

* Create can_bypass_payments permission

* Minor changes to payment bypass and add tests

* Add documentation for can_bypass_payment

* Add translations

* Fill in tests for manager level as well

* Change user permissions test to actually test ignoring payment

* Add custom_label property to generic select component

* Change translation

* Changes according to code review

* Changed double quotes to single

* Minor refactor to minimize redundancy in select element template

* Anonymize uuid

* Database query optimizations for resource and reservation API endpoints

* Changed function level imports to module level in auth helper

* Add is_manager to permissions object

* Allow admins to bypass min_period

* Created missing migrations for changes in accessibility models

* Add unit viewer role which grants right to modify and see certain fields in reservations

* Remove hvara import

* Upgrade Pillo and Django

* Added translations for changes in unit viewer role

* Remove extra border width definition from text area (City-of-Helsinki#656)

* Added instructions to Open API documentation for usage of multiple extra data fields with include parameter (City-of-Helsinki#662)

* Update requests and sentry-sdk

* Upgrade JS dependencies

* Upgrade helusers and make necessary adjustments

* Update django-helusers to 0.5.5

* Change staticfiles to static in HTML templates

* Create pytest filters to avoid non-relevant warnings

* Change order of installed apps (City-of-Helsinki#665)

* Set anonymized reservations state to cancelled

* Add .env.example and update README.md

* Added token and session authentications for single resource viewset

* Refactor comment choices

* Change naming

* Add project versioning to browsable API interface

* Move custom renderer under repsa folder

* Kulkunen SiPass driver changes (City-of-Helsinki#672)

* Kulkunen SiPass driver changes due to changes in SiPass API

* Override DRF's TokenAdmin

* Various permission fixes and improvements (City-of-Helsinki#671)

* Fix admin bypassing time restrictions

* Add extra checks to removing user permissions in JS

* Change order-by-link class hover background-color

* Added can_comment_reservations and can_view_reservation_user permissions for Unit Managers

* Some fixes and additions to permissions improvements (City-of-Helsinki#679)

* Fixed bug where anonymizing users didn't anonymize data in related SocialAccount and EmailAddress models causing errors (City-of-Helsinki#680)

* Allow customizing respa admin theme

* Update Python dependencies to secure versions

* Upgrade vulnerable dependencies and switch to using npm

* Add Theme customization block in README

* Check user from kwargs first

* Bump up version number

* Remove tkusers, use inherit instead

* Push files that git missed because of WSL permission conflicts

* Re-add code that randomly vanished

* Merge remote-tracking branch 'helsinki/develop' into FIX/level-to-helsinki

* Remove duplicate translations

* Remove duplicate function

* Relative import

* Remove unnecessary import

* Fix tests

* OAuth2Adapter -> HelsinkiOAuth2Adapter

* Fix import

Co-authored-by: otiala <44601448+otiala@users.noreply.github.com>
Co-authored-by: Petteri Laine <petteri.laine@iki.fi>
Co-authored-by: tommimanbytes <56429082+tommimanbytes@users.noreply.github.com>
Co-authored-by: Juha Suvanto <38026367+juhasuv@users.noreply.github.com>

* timedelta -> datetime.timedelta (#2)

* Squash some migrations created from editing users model (#3)

* Fix/merge duplicates (#4)

* Remove duplicates

* Squash migrations

* Fix signals not firing on cancelled reservations

* Optimize

* Bump PyYAML to 5.3 (#25)

* Requirements, remove exchangelib logging

* Remove duplicate translations

* Optimize

* Update .gitignore

* Added missing resource migrations

* Fix wrong timezone sent to outlook when appointment was made through api

(And bit more optimization)

* Bump django to 2.2.11 (#28)

* Machine to machine authentication (#29)

* Added M2M auth endpoint

* Daemon thread

* Who put that in there?

* Taggit search fields (#30)

* Add django-taggit

* Add tag field to respa_admin

* Update .travis.yml

* Update .travis.yml

* Make respa_exchange toggleable

* Revert .travis config

* Merge migrations

* Extend helusers SocialAccountAdapter

* Extend helusers SocialAccountAdapter, set assumed uuid

* Merge branch 'develop' into feature/outlook-integration

* Use provided email address as primary

* Merge branch 'develop' into feature/outlook-integration

* Remove duplicate columns from migration files

* Return resource keywords via api

* Feature/reservation home municipality (#31)

* Added home municipality field for reservations

* Added translations to home municipalities

* Added home municipalities to ra resource form

* Added fi translations

* Changed home municipality model naming and reservation home municipality to be object with translations rather than simple char field

* Changed how home municipalites are shown in admin and fixes to home municipality api logic

* Changed home municipality to not be always required via api

* Added home municipality field and set str tests

* Fixed reservation home municipality not handling dicts correctly via api

* Added sv translations for home municipality

* Added migrations for home municipality data

* Feature/phonenumber filter (#32)

* Filter reservations with reserver_phone_number

* change phonenumber default to str

* Feature/reservations without authentication (#33)

* Added unauthenticated option to resource auths

* Check for AnonymousUser

* 356343b

* 5e2ff17

Co-authored-by: SanttuA <santtualatalo@gmail.com>

* Added validation checks for resource form to handle unauthenticated resource auth type (#34)

* Feature/var156 abloy integration (#35)

Added Abloy integration for kulkunen access code system. Abloy integration works mostly in the same way as sipass and requires an outside cronjob to run sync_kulkunen.

* Bump django to 2.2.14 (#36)

& update insecure packages

* Changed sms reminders to only allow certain notification types (#37)

* Fix search filter (#38)

* Merge upstream to develop (#39)

* Merge upstream/develop

* Bump django-parler

* Revert test changes

* Fix merge conflicts (#41)

* Merge develop to master (#20)

* Ignore age check for staff (#17)

* Update auth.py

* Update README.md

* SMS Notifications (#18)

* Feature/sms notifications with delay (#19)

* SMS Notifications

* Rename field verbose name & add translation

Fields modified:
    * sms_sms_reminder
    * sms_reminder_delay

* Increase the max value limit for reminder

* Migration

* address -> street_address

* use address_postal_full instead street_address

* AssertionError fix

AssertionError: Re-adding the same key breaks proper expiration

* Bump Django to 2.2.9 (#22)

* Merge branch 'master' of https://github.com/ezkat/respa into fix-master-conflicts

Co-authored-by: Jussi Heikkilä <jussi.heikkila@haltu.fi>

* Upgrade packages

* Fix tests

* Remove old files

* OIDC hotfix

* Fix anonymous reservation permission

* Misc/has arrived reservation field (#46)

* Add has_arrived field
* Don't send modified mail from patching single fields
  Update _has_perm to use unit authorization levels manager/admin

* Add HasArrivedFilterBackend (#47)

* Added documentation for Infotori form integration (#49)

* Feature/unit specific template groups (#50)

trello 191

* unit specific template groups

* added missing migration

* refactored template selection

* added validation when saving template

* validation to templates when adding to group

* handle exception if more than 1 of type

* removed unnecessary prints

Co-authored-by: Hannes Honkasaari <hannes.honkasaari@turku.fi>

* Bump django to 2.2.16 (#51)

* Bump Django to 2.2.16

* Hotfix/Resource tags

* Field 'modified_at' is updated on every save (#52)

Previously modified_at was updated only in creation and it could not
be used to determine if data has actually changed afterwards.

Co-authored-by: Oskari Tiala <oskari.tiala@haltu.fi>
Co-authored-by: Petteri Laine <petteri.l.laine@hel.fi>
Co-authored-by: Jussi Heikkilä <jussi.heikkila@haltu.fi>
Co-authored-by: otiala <44601448+otiala@users.noreply.github.com>
Co-authored-by: Tommi Mantila <tommi@manbytes.fi>
Co-authored-by: tommimanbytes <56429082+tommimanbytes@users.noreply.github.com>
Co-authored-by: Juha Suvanto <38026367+juhasuv@users.noreply.github.com>
Co-authored-by: Petteri Laine <petteri.laine@iki.fi>
Co-authored-by: aceViilee <51813121+aceViilee@users.noreply.github.com>
Co-authored-by: SanttuA <santtualatalo@gmail.com>
Co-authored-by: Hannes <50320115+hienous@users.noreply.github.com>
Co-authored-by: Hannes Honkasaari <hannes.honkasaari@turku.fi>
Co-authored-by: Panu Suominen <panu.wetterstrand@iki.fi>
ezkat added a commit to City-of-Turku/respa that referenced this pull request Jun 3, 2021
* Use distinct on unit queryset

* Change validation of management view

* Fix API document version numbering

* Change filter_reserver_info search behaviour

* Change login view texts

* Add missing translations for Respa admin unit views

* Respa admin: translation for unnamed new time period

* Enforce language in respa admin unit view tests

* Pseudonymize user data

* Add tests for pseudonymizing user data

* Change to correct term anonymization, remove unnecessary if clause

* Update OpenAPI spec (City-of-Helsinki#647)

* Update OpenAPI spec

Update OpenAPI specification to include test server url

* fix url typo

* RESPA-177 | Enable Unit Admins and Unit Managers to bypass payment (City-of-Helsinki#649)

* Add permissions for unit manager

* Make changes according to review

* Create can_bypass_payments permission

* Minor changes to payment bypass and add tests

* Add documentation for can_bypass_payment

* Add translations

* Fill in tests for manager level as well

* Change user permissions test to actually test ignoring payment

* Add custom_label property to generic select component

* Change translation

* Changes according to code review

* Changed double quotes to single

* Minor refactor to minimize redundancy in select element template

* Anonymize uuid

* Ignore age check for staff (#17)

* Update auth.py

* I hate mondays

* Database query optimizations for resource and reservation API endpoints

* Changed function level imports to module level in auth helper

* Add is_manager to permissions object

* Allow admins to bypass min_period

* Created missing migrations for changes in accessibility models

* Add unit viewer role which grants right to modify and see certain fields in reservations

* Remove hvara import

* Upgrade Pillo and Django

* Added translations for changes in unit viewer role

* Remove extra border width definition from text area (City-of-Helsinki#656)

* Added instructions to Open API documentation for usage of multiple extra data fields with include parameter (City-of-Helsinki#662)

* Update README.md

* Update requests and sentry-sdk

* Upgrade JS dependencies

* Upgrade helusers and make necessary adjustments

* Update django-helusers to 0.5.5

* Change staticfiles to static in HTML templates

* Create pytest filters to avoid non-relevant warnings

* Change order of installed apps (City-of-Helsinki#665)

* Set anonymized reservations state to cancelled

* Add .env.example and update README.md

* SMS Notifications (#18)

* Added token and session authentications for single resource viewset

* Refactor comment choices

* Change naming

* Feature/sms notifications with delay (#19)

* SMS Notifications

* Rename field verbose name & add translation

Fields modified:
    * sms_sms_reminder
    * sms_reminder_delay

* Increase the max value limit for reminder

* Migration

* address -> street_address

* use address_postal_full instead street_address

* Add project versioning to browsable API interface

* AssertionError fix

AssertionError: Re-adding the same key breaks proper expiration

* Move custom renderer under repsa folder

* Kulkunen SiPass driver changes (City-of-Helsinki#672)

* Kulkunen SiPass driver changes due to changes in SiPass API

* Override DRF's TokenAdmin

* Various permission fixes and improvements (City-of-Helsinki#671)

* Fix admin bypassing time restrictions

* Add extra checks to removing user permissions in JS

* Change order-by-link class hover background-color

* Initial

* Bump Django to 2.2.9 (#21)

* Bump Django to 2.2.9

* Bump Django to 2.2.9

* Add&Update requirements

* Added can_comment_reservations and can_view_reservation_user permissions for Unit Managers

* Some fixes and additions to permissions improvements (City-of-Helsinki#679)

* Fixed bug where anonymizing users didn't anonymize data in related SocialAccount and EmailAddress models causing errors (City-of-Helsinki#680)

* Allow customizing respa admin theme

* Update Python dependencies to secure versions

* Upgrade vulnerable dependencies and switch to using npm

* Add Theme customization block in README

* Update packages (#23)

* Update requirements.txt

* Bump django to 2.2.10

django-allauth to 0.41.0
pillow to 7.0.0

* Added payment terms field to Resource model and API. Also added the field to Respa Admin and tests.

* Added translations

* Check user from kwargs first

* Bump up version number

* Add Matomo analytics snippet to base template

* Fix merge conflicts with helsinki's respa (#1)

* Use distinct on unit queryset

* Change validation of management view

* Fix API document version numbering

* Change filter_reserver_info search behaviour

* Change login view texts

* Add missing translations for Respa admin unit views

* Respa admin: translation for unnamed new time period

* Enforce language in respa admin unit view tests

* Pseudonymize user data

* Add tests for pseudonymizing user data

* Change to correct term anonymization, remove unnecessary if clause

* Update OpenAPI spec (City-of-Helsinki#647)

* Update OpenAPI spec

Update OpenAPI specification to include test server url

* fix url typo

* RESPA-177 | Enable Unit Admins and Unit Managers to bypass payment (City-of-Helsinki#649)

* Add permissions for unit manager

* Make changes according to review

* Create can_bypass_payments permission

* Minor changes to payment bypass and add tests

* Add documentation for can_bypass_payment

* Add translations

* Fill in tests for manager level as well

* Change user permissions test to actually test ignoring payment

* Add custom_label property to generic select component

* Change translation

* Changes according to code review

* Changed double quotes to single

* Minor refactor to minimize redundancy in select element template

* Anonymize uuid

* Database query optimizations for resource and reservation API endpoints

* Changed function level imports to module level in auth helper

* Add is_manager to permissions object

* Allow admins to bypass min_period

* Created missing migrations for changes in accessibility models

* Add unit viewer role which grants right to modify and see certain fields in reservations

* Remove hvara import

* Upgrade Pillo and Django

* Added translations for changes in unit viewer role

* Remove extra border width definition from text area (City-of-Helsinki#656)

* Added instructions to Open API documentation for usage of multiple extra data fields with include parameter (City-of-Helsinki#662)

* Update requests and sentry-sdk

* Upgrade JS dependencies

* Upgrade helusers and make necessary adjustments

* Update django-helusers to 0.5.5

* Change staticfiles to static in HTML templates

* Create pytest filters to avoid non-relevant warnings

* Change order of installed apps (City-of-Helsinki#665)

* Set anonymized reservations state to cancelled

* Add .env.example and update README.md

* Added token and session authentications for single resource viewset

* Refactor comment choices

* Change naming

* Add project versioning to browsable API interface

* Move custom renderer under repsa folder

* Kulkunen SiPass driver changes (City-of-Helsinki#672)

* Kulkunen SiPass driver changes due to changes in SiPass API

* Override DRF's TokenAdmin

* Various permission fixes and improvements (City-of-Helsinki#671)

* Fix admin bypassing time restrictions

* Add extra checks to removing user permissions in JS

* Change order-by-link class hover background-color

* Added can_comment_reservations and can_view_reservation_user permissions for Unit Managers

* Some fixes and additions to permissions improvements (City-of-Helsinki#679)

* Fixed bug where anonymizing users didn't anonymize data in related SocialAccount and EmailAddress models causing errors (City-of-Helsinki#680)

* Allow customizing respa admin theme

* Update Python dependencies to secure versions

* Upgrade vulnerable dependencies and switch to using npm

* Add Theme customization block in README

* Check user from kwargs first

* Bump up version number

* Remove tkusers, use inherit instead

* Push files that git missed because of WSL permission conflicts

* Re-add code that randomly vanished

* Merge remote-tracking branch 'helsinki/develop' into FIX/level-to-helsinki

* Remove duplicate translations

* Remove duplicate function

* Relative import

* Remove unnecessary import

* Fix tests

* OAuth2Adapter -> HelsinkiOAuth2Adapter

* Fix import

Co-authored-by: otiala <44601448+otiala@users.noreply.github.com>
Co-authored-by: Petteri Laine <petteri.laine@iki.fi>
Co-authored-by: tommimanbytes <56429082+tommimanbytes@users.noreply.github.com>
Co-authored-by: Juha Suvanto <38026367+juhasuv@users.noreply.github.com>

* timedelta -> datetime.timedelta (#2)

* Squash some migrations created from editing users model (#3)

* Fix/merge duplicates (#4)

* Remove duplicates

* Squash migrations

* Fix signals not firing on cancelled reservations

* Optimize

* Bump PyYAML to 5.3 (#25)

* Requirements, remove exchangelib logging

* Remove duplicate translations

* Optimize

* Update .gitignore

* Added missing resource migrations

* Fix wrong timezone sent to outlook when appointment was made through api

(And bit more optimization)

* Bump django to 2.2.11 (#28)

* Machine to machine authentication (#29)

* Added M2M auth endpoint

* Daemon thread

* Who put that in there?

* Taggit search fields (#30)

* Add django-taggit

* Add tag field to respa_admin

* Update .travis.yml

* Update .travis.yml

* Make respa_exchange toggleable

* Revert .travis config

* Merge migrations

* Extend helusers SocialAccountAdapter

* Extend helusers SocialAccountAdapter, set assumed uuid

* Merge branch 'develop' into feature/outlook-integration

* Use provided email address as primary

* Merge branch 'develop' into feature/outlook-integration

* Remove duplicate columns from migration files

* Return resource keywords via api

* Feature/reservation home municipality (#31)

* Added home municipality field for reservations

* Added translations to home municipalities

* Added home municipalities to ra resource form

* Added fi translations

* Changed home municipality model naming and reservation home municipality to be object with translations rather than simple char field

* Changed how home municipalites are shown in admin and fixes to home municipality api logic

* Changed home municipality to not be always required via api

* Added home municipality field and set str tests

* Fixed reservation home municipality not handling dicts correctly via api

* Added sv translations for home municipality

* Added migrations for home municipality data

* Feature/phonenumber filter (#32)

* Filter reservations with reserver_phone_number

* change phonenumber default to str

* Feature/reservations without authentication (#33)

* Added unauthenticated option to resource auths

* Check for AnonymousUser

* 356343b

* 5e2ff17

Co-authored-by: SanttuA <santtualatalo@gmail.com>

* Added validation checks for resource form to handle unauthenticated resource auth type (#34)

* Feature/var156 abloy integration (#35)

Added Abloy integration for kulkunen access code system. Abloy integration works mostly in the same way as sipass and requires an outside cronjob to run sync_kulkunen.

* Bump django to 2.2.14 (#36)

& update insecure packages

* Changed sms reminders to only allow certain notification types (#37)

* Fix search filter (#38)

* Merge upstream to develop (#39)

* Merge upstream/develop

* Bump django-parler

* Revert test changes

* Fix merge conflicts (#41)

* Merge develop to master (#20)

* Ignore age check for staff (#17)

* Update auth.py

* Update README.md

* SMS Notifications (#18)

* Feature/sms notifications with delay (#19)

* SMS Notifications

* Rename field verbose name & add translation

Fields modified:
    * sms_sms_reminder
    * sms_reminder_delay

* Increase the max value limit for reminder

* Migration

* address -> street_address

* use address_postal_full instead street_address

* AssertionError fix

AssertionError: Re-adding the same key breaks proper expiration

* Bump Django to 2.2.9 (#22)

* Merge branch 'master' of https://github.com/ezkat/respa into fix-master-conflicts

Co-authored-by: Jussi Heikkilä <jussi.heikkila@haltu.fi>

* Upgrade packages

* Fix tests

* Remove old files

* OIDC hotfix

* Fix anonymous reservation permission

* Misc/has arrived reservation field (#46)

* Add has_arrived field
* Don't send modified mail from patching single fields
  Update _has_perm to use unit authorization levels manager/admin

* Add HasArrivedFilterBackend (#47)

* Added documentation for Infotori form integration (#49)

* Feature/unit specific template groups (#50)

trello 191

* unit specific template groups

* added missing migration

* refactored template selection

* added validation when saving template

* validation to templates when adding to group

* handle exception if more than 1 of type

* removed unnecessary prints

Co-authored-by: Hannes Honkasaari <hannes.honkasaari@turku.fi>

* Bump django to 2.2.16 (#51)

* Bump Django to 2.2.16

* Hotfix/Resource tags

* Field 'modified_at' is updated on every save (#52)

Previously modified_at was updated only in creation and it could not
be used to determine if data has actually changed afterwards.

* Syncs reservations to and from Outlook calendar (#54)

Unit managers can link a resource to their calendar by clicking the
button in the Varaamo user interface.

This is not yet production-ready code, and has limitations, including:
 - Unit tests are missing. We are refactoring the code in order to
   to better facilitate testing.
 - Opening Hours are not yet syncing in this version
 - Reservations do not sync automatically. One must visit /v1/o365/sync
   in order to sync all changes.
 - All error situations are not taken into account
 - Outlook calendars have a random number after the name, this will not
   be the case in the final version.
 - The ability to add the customer's name, phone number and email is
   not implemented in this version
 - Deleting links using button in Varaamo does not work. Django admin
   can be used. Calendars in Outlook are not deleted, however.
 - Synchronising the name and contact information of the customer is
   currently not supported

Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>

* Respa Outlook integration - latest version (#56)

* Syncs reservations to and from Outlook calendar

Unit managers can link a resource to their calendar by clicking the
button in the Varaamo user interface.

This is not yet production-ready code, and has limitations, including:
 - Unit tests are missing. We are refactoring the code in order to
   to better facilitate testing.
 - Opening Hours are not yet syncing in this version
 - Reservations do not sync automatically. One must visit /v1/o365/sync
   in order to sync all changes.
 - All error situations are not taken into account
 - Outlook calendars have a random number after the name, this will not
   be the case in the final version.
 - The ability to add the customer's name, phone number and email is
   not implemented in this version
 - Deleting links using button in Varaamo does not work. Django admin
   can be used. Calendars in Outlook are not deleted, however.
 - Synchronising the name and contact information of the customer is
   currently not supported

* Operations related to reservation synchronisation can be generated

* Generic implementation can be used to synchronise different items

* Respa's reservations can be manipulated through sync compatible interface

* O365 eventes can be manipulated through generic syncronisation repository interface

Change detection does not yet work properly

* Changes from O365 are detected

Detection is somewhat naive as all events are fetched.

* IdMapper is own class which is able to report changes

* Reservation synchronisation uses generic synchronisation components

* Outlook calendar has cache to prevent writing identical data to the cloud

Outlook change key does not provide reliable enough way to detect if
data has actually changed. To prevent changing item unnecessary
calendar remembers events state. This cache is not realiable to use
for long periods of times, but calendar object is expected to be
re-created often.

* Changes in Outlook and Respa starts synchronisation

Implementation is yet naive and full sync is done on every change.
There is still a bug that sometimes causes Respa to overwrite changes
in Outlook.

* All item change keys are stored

Previously change keys were not stored if mappings had not
changed. This caused same events to show as updated all the time.

* Change key behaviour is better tested in contract

* Notifications handle item creations in Respa correctly

* Reservation removals from outlook through notifications are handled correctly

* O365 notification listener checks that client state matches one used when subscription was created

* Linking to O365 performs sync immediately and removing link wipes reservation events from the O365

* O365 notification URL is configurable

* Calling sync API doesn't require permissions

Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>
Co-authored-by: Panu Suominen <panu@weasel.fi>

* Does not sync events too far in the past or the future (#57)

Defaults are to leave events 8 days in the past and 92 days in the
future alone.

Configurable using O365_SYNC_DAYS_BACK and O365_SYNC_DAYS_FORWARD

Also:
* Can handle calendar events with empty subject
* Fix sync loop when removing reservation in Outlook

Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>

* O365 reserver info (#58)

* Syncs reserver's contact info.

* Can filter calendar link list based on user.

This can be used by the frontend to only show own calendar links for a
superuser.

* Calendar prefix for reservations is "Varaus Varaamo"

* Has BeautifulSoup4 requirement.

* Does not fail test.

Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>

* O365 Opening Hours Synchronization (#59)

* Supports syncing opening hours from Outlook Calendar

Opening hours for resources that are linked to an outlook calendar are
managed by creating meetings called "Varattavissa Varaamo" in Outlook
calendar.

* Deletes existing periods from resource when creating calendar link

Existing periods will not sync to Outlook, and the format may be
incompatible

* Prevents deleting period in admin interface when calendar link exists

* Remove unnecessary comments and add a helpful one

* The code that returns no changes for Respa periods is clearer.

* Prefixes for calendar events are configurable

Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>

* Create GitHub Actions config (#60)

* Update README.md

* O365 fixes (#61)

* Has less unnecessary code.

* Uses set_state() when canceling reservation so notificaiton emails work.

* Deleting opening hours works.

* Passes test

* Does not have unused SyncHelper class.

* Uses set_state() when creating reservation so notificaiton emails work.

Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>

* Add oid field to user (#62)

* Turku payment provider (#63)

Added Turku payment provider MaksuPalvelu and a new sap code field for products

* Improves handling of removed calendar links (#64)

* Removes events from outlook when deleting calendar link in Django admin.

* Does not renew subscriptions that are associated with no calendar link

Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>

* O365 improvements (#65)

* Creation of multiple calendar links for same resource is not allowed.

* Manual Outlook sync is now a command and not  a web API endpoint.

Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>

* Updated django-admin-json-editor version to 0.2.3 (#66)

New django-admin-json-editor version fixes potential bootstrap version issues with the json editor.

* Changed turku payment provider notify req response (#67)

Changed response status code from 204 to 200

* Feature/timmi integration (#68)

* Timmi integration initial

* Update requirements.txt

Fix migration file,
Fix tests and rename test
test_tunnistamo_login_redirects_to_helsinki_login to test_tunnistamo_login_redirects_to_provider_login, use .env file to provide custom provider login name for local tests.

Python 3.9.x will break respa, use pyenv to manage python version < 3.9

* Add manual trigger to Github Actions

* Remove pandas from requirements

auto-fill timmi_room_id by using resource name as filter.

* Raise error instead of returning empty

* Add exception message

* Roll back on requirements

* Status code handling

* Begin & End query params

* Add timmi payload model

* Timeout env variable

* reservation -> resource

* Update respa.yml

* Revert feebb4d test changes

* Add python 3.9 to gh actions

* Bump django-enumfields to 2.1.1

* Don't raise KeyError (#69)

* Has a queue for processing O365 events in order to avoid deadlocks. (#70)

Everything puts O365 events in the queue instead of syncing directly.
The queue gets processed (and events synced) by running the
process_outlook_sync_queue Django command, for example from a cron job.

Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>

* Abloy driver grant install changes and error handling (#71)

- reservation access code is reset if api call fails
- user notify mail is sent after successful grant install
- added more tests

* Allowed reservations to end at midnight (#72)

* Changed midnight check comparison operators (#73)

* Update workflow (#75)

* Changed abloy grant removal to use grant user info (#74)

* Misc/timmi integration/sap code (#76)

* Add sap code to payment payload

if the resource is part of timmi integration

* Swap return -> raise

* Respa reservation change detection works (#77)

* sync_operations.py is re-formated

* Sync operations logging instruction works

* Reservation change key calculation uses stable hash function

Unfortunately hash(..) is not stable between different python executable
invocations in python3.

* Process queue logs its operations and uses smaller transactions

* Changed abloy pin code creation and usage (#78)

Access codes are now given more randomly instead of simply giving a previously used code always in the same order

* Added exception raises to abloy grant install (#81)

Added exception raises to grant install abloy api operations so that upper levels can handle the errors as well

* Patch KeyError (#82)

* Patch KeyError

Which happens during detailed reservation search

* Also remove timmi_profile_id

From unit api

* typo (#80)

* Update requirements (#83)

* Add strong auth (#84)

* Add strong auth

* Fix tests

* Add sap_unit (#85)

* Add sap_unit

Fetch sap unit, raise MissingSapCodeError or MissingSapUnitError if sap code or sap unit is not found from the timmi payload.

* Organize product admin form

Add sap unit,
Move sap unit and sap code to their own fieldset.

* order details to notification context (#86)

* added order details to notification context

* improved string formatting in test string

Co-authored-by: Hannes Honkasaari <hannes.honkasaari@turku.fi>

* fixed how notification language is defined (#88)

Co-authored-by: Hannes Honkasaari <hannes.honkasaari@turku.fi>

* added orders tax pricing info to email context (#89)

* added orders tax pricing info to email context

* fixed typos in comment

Co-authored-by: Hannes Honkasaari <hannes.honkasaari@turku.fi>

Co-authored-by: Oskari Tiala <oskari.tiala@haltu.fi>
Co-authored-by: Petteri Laine <petteri.l.laine@hel.fi>
Co-authored-by: Jussi Heikkilä <jussi.heikkila@haltu.fi>
Co-authored-by: otiala <44601448+otiala@users.noreply.github.com>
Co-authored-by: Tommi Mantila <tommi@manbytes.fi>
Co-authored-by: tommimanbytes <56429082+tommimanbytes@users.noreply.github.com>
Co-authored-by: Juha Suvanto <38026367+juhasuv@users.noreply.github.com>
Co-authored-by: Petteri Laine <petteri.laine@iki.fi>
Co-authored-by: aceViilee <51813121+aceViilee@users.noreply.github.com>
Co-authored-by: SanttuA <santtualatalo@gmail.com>
Co-authored-by: Hannes <50320115+hienous@users.noreply.github.com>
Co-authored-by: Hannes Honkasaari <hannes.honkasaari@turku.fi>
Co-authored-by: Panu Suominen <panu.wetterstrand@iki.fi>
Co-authored-by: johlindq <44962785+johlindq@users.noreply.github.com>
Co-authored-by: Johannes Lindqvist <johannes@weasel.fi>
Co-authored-by: Panu Suominen <panu@weasel.fi>
Co-authored-by: Panu Suominen <panu.suominen@iki.fi>
Co-authored-by: Selçuk Tatar <41347478+tansionline@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants