Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Row Level Access ] - Deployment back-end classes refactoring: Abstraction and variables renaming #3124

Merged
merged 36 commits into from
Jul 26, 2021

Conversation

noliveleger
Copy link
Contributor

@noliveleger noliveleger commented Apr 6, 2021

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Make sure that your code lints and that you've followed our coding style
  5. Write a description of your work suitable for publishing on our forum
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)

Description

While working on MockDeploymentBackend, BaseDeploymentBackend and KobocatDeploymentBackend, I've noticed that I was not really consistent with variable names. This PR tries to bring more consistency in the code.

The primary key of submissions

We have:

  • pk
  • submission_pk
  • submission_id
  • instance_id

It has been renamed submission_id everywhere (Hook too)

Notes: KoBoCAT related branch kpi-3115-row-level-write-perms contains some changes to support the new name for Rest Services

The requesting user

We have

  • user_id
  • user.pk
  • requesting_user_id
  • requesting_user

Most of the time, we have access to the user object, we do not gain any performance (i.e.: any extra db queries) to pass PK only.
It has been renamed user to be consistent with permissions.

BaseDeploymentBackend

It has become an AbstractClass and defines methods which need to be implemented in children classes

Related issues

Related to #3115
Related to #2768

@noliveleger noliveleger marked this pull request as draft April 6, 2021 19:06
…-refactoring

 # Conflicts:
 #	kpi/deployment_backends/base_backend.py
 #	kpi/deployment_backends/kobocat_backend.py
 #	kpi/deployment_backends/mock_backend.py
 #	kpi/views/v2/data.py
…-refactoring

 # Conflicts:
 #	kpi/deployment_backends/kobocat_backend.py
 #	kpi/deployment_backends/mock_backend.py
…-refactoring

 # Conflicts:
 #	kpi/deployment_backends/base_backend.py
 #	kpi/deployment_backends/kobocat_backend.py
 #	kpi/deployment_backends/mock_backend.py
…-refactoring

 # Conflicts:
 #	kpi/deployment_backends/base_backend.py
 #	kpi/deployment_backends/kobocat_backend.py
 #	kpi/deployment_backends/mock_backend.py
 #	kpi/views/v2/data.py
…-refactoring

 # Conflicts:
 #	kpi/deployment_backends/base_backend.py
 #	kpi/deployment_backends/kobocat_backend.py
 #	kpi/deployment_backends/mock_backend.py
BaseDeploymentBackend an abstractclass
@noliveleger noliveleger requested a review from jnm April 30, 2021 15:27
@noliveleger noliveleger changed the title WIP - Refactoring for kpi#3115 [ Row Level Permission ] - Deployment back-end classes refactoring: Abstraction and variables renaming Apr 30, 2021
@noliveleger noliveleger marked this pull request as ready for review April 30, 2021 15:32
@noliveleger noliveleger changed the title [ Row Level Permission ] - Deployment back-end classes refactoring: Abstraction and variables renaming [ Row Level Access ] - Deployment back-end classes refactoring: Abstraction and variables renaming Apr 30, 2021
kobo/apps/hook/models/hook_log.py Show resolved Hide resolved
kobo/apps/hook/models/hook_log.py Show resolved Hide resolved
kpi/deployment_backends/base_backend.py Show resolved Hide resolved
kpi/deployment_backends/mock_backend.py Show resolved Hide resolved
kpi/deployment_backends/mock_backend.py Show resolved Hide resolved
kpi/deployment_backends/mock_backend.py Show resolved Hide resolved
kpi/tests/api/v2/test_api_submissions.py Show resolved Hide resolved
kpi/views/v2/data.py Show resolved Hide resolved
Base automatically changed from 3115-allowed-write-actions-with-partial-perm to 2767-basic-case-management July 26, 2021 18:46
@jnm jnm merged commit b853fff into 2767-basic-case-management Jul 26, 2021
@jnm jnm deleted the 3115-refactoring branch July 26, 2021 19:09
jdugh pushed a commit to geohyd/kpi that referenced this pull request Nov 21, 2022
[ Row Level Access ] - Deployment back-end classes refactoring: Abstraction and variables renaming
jdugh pushed a commit to geohyd/kpi that referenced this pull request Nov 13, 2023
[ Row Level Access ] - Deployment back-end classes refactoring: Abstraction and variables renaming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants