Skip to content

v2 changes of platform settings#447

Merged
hari-kuriakose merged 10 commits into
mainfrom
feat/MultiTenancyV2-Platform-settings
Jul 15, 2024
Merged

v2 changes of platform settings#447
hari-kuriakose merged 10 commits into
mainfrom
feat/MultiTenancyV2-Platform-settings

Conversation

@muhammad-ali-e

@muhammad-ali-e muhammad-ali-e commented Jul 4, 2024

Copy link
Copy Markdown
Contributor

What

  • v2 changes of platform settings
    • Updated the application name.
    • Imported packages from v2 applications instead of v1.
    • Retrieved organization information from UserContext or Session instead of connection.tenant.

Why

  • The changes are necessary to align with the updated architecture and to ensure compatibility with the v2 applications.
  • To streamline the handling of organization contexts without relying on django_tenants.

How

  • Modified platform_auth_helper.py to update the import statements from v2.
  • Adjusted platform_auth_service.py to import from v2 applications and updated the methods of get_organization by using user context.
  • Updated serializers.py to reflect import changes.
  • Changed the application name in apps.py.
  • Updated views.py for consistency with the new application structure.

Changed files:

  • platform_auth_helper.py (package import changes only)
  • platform_auth_service.py
  • serializers.py (import changes only)
  • apps.py (app name change only)
  • views.py

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • The new methods are self-contained ensuring no impact on current functionality.
  • Also under feature flag multi_tenancy_v2.

Database Migrations

Env Config

Relevant Docs

Related Issues or PRs

  1. unstract-multi-tenantV2 feature-flag changes #422
  2. Feat/multi tenancy v2 context and organization #430
  3. Version 2 of User/Organization Account Module #431
  4. version 2 of user/organization tenant account module - UN-1424 #432

Dependencies Versions

Notes on Testing

Screenshots

Checklist

I have read and understood the Contribution Guidelines.

Comment thread backend/platform_settings_v2/platform_auth_helper.py Outdated
Comment thread backend/platform_settings_v2/platform_auth_helper.py
Comment thread backend/platform_settings_v2/platform_auth_service.py Outdated
Comment thread backend/platform_settings_v2/platform_auth_service.py
Comment thread backend/platform_settings_v2/platform_auth_service.py Outdated
Comment thread backend/platform_settings_v2/platform_auth_service.py Outdated

@ritwik-g ritwik-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks okay. Would be better if we enrich error logs.

@muhammad-ali-e

Copy link
Copy Markdown
Contributor Author

Overall looks okay. Would be better if we enrich error logs.

Addressed All comments

Comment thread backend/platform_settings_v2/exceptions.py Outdated
Comment thread backend/platform_settings_v2/exceptions.py Outdated

@vishnuszipstack vishnuszipstack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left a NIT comment, others looks good.

Comment thread backend/platform_settings_v2/platform_auth_service.py Outdated
muhammad-ali-e and others added 2 commits July 5, 2024 11:32
Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
Signed-off-by: ali <117142933+muhammad-ali-e@users.noreply.github.com>
Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
Signed-off-by: ali <117142933+muhammad-ali-e@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 5, 2024

Copy link
Copy Markdown

Please retry analysis of this Pull-Request directly on SonarCloud

@github-actions

Copy link
Copy Markdown
Contributor
filepath function $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_logs}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup\_skip}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_client\_init}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image\_exists}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config\_without\_mount}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_run\_container}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{9}}$$ $$\textcolor{#23d18b}{\tt{9}}$$

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
31.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@hari-kuriakose hari-kuriakose merged commit c805c80 into main Jul 15, 2024
@hari-kuriakose hari-kuriakose deleted the feat/MultiTenancyV2-Platform-settings branch July 15, 2024 11:28
@hari-kuriakose

Copy link
Copy Markdown
Contributor

We can take care of duplication when we delete v1 eventually. Bypassing.

pk-zipstack pushed a commit that referenced this pull request Aug 20, 2025
* v2 changes of platform settings

* considered optional params

* Addressed Pr comments, Removed unnecessory handling of generic exceptions

* Update backend/platform_settings_v2/exceptions.py

Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
Signed-off-by: ali <117142933+muhammad-ali-e@users.noreply.github.com>

* Update backend/platform_settings_v2/exceptions.py

Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
Signed-off-by: ali <117142933+muhammad-ali-e@users.noreply.github.com>

* optimized toggle_platform_key_status function

* Added TODO comment for a task

---------

Signed-off-by: ali <117142933+muhammad-ali-e@users.noreply.github.com>
Co-authored-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
Co-authored-by: Hari John Kuriakose <hari@zipstack.com>
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.

5 participants