-
-
Notifications
You must be signed in to change notification settings - Fork 226
[feature] Made RegisteredUser model support multi-tenancy #692 #698
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
base: master
Are you sure you want to change the base?
Changes from all commits
7470e3d
c12902d
13d559c
7eb6594
7157409
3b4c451
e478092
dd7228a
13295f0
6e72be3
718ab8d
69bff69
990c037
e6b2c4c
4dde443
931129e
0f904c3
fca0267
3887c2f
adf2fda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,6 +74,7 @@ jobs: | |
| pip install -U pip wheel setuptools | ||
| pip install -U -r requirements-test.txt | ||
| pip install -e .[saml,openvpn_status] | ||
| pip install --upgrade --no-deps --no-cache-dir --force-reinstall "https://github.com/openwisp/openwisp-users/tarball/issues/497-export-users" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: Remove this before merging! |
||
| pip install ${{ matrix.django-version }} | ||
|
|
||
| - name: Start InfluxDB and Redis container | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -539,6 +539,7 @@ class RegisteredUserInline(StackedInline): | |
| form = AlwaysHasChangedForm | ||
| extra = 0 | ||
| readonly_fields = ("modified",) | ||
| fields = ("organization", "method", "is_verified", "modified") | ||
|
|
||
| def has_delete_permission(self, request, obj=None): | ||
| return False | ||
|
|
@@ -549,12 +550,17 @@ def has_delete_permission(self, request, obj=None): | |
| RadiusUserGroupInline, | ||
| PhoneTokenInline, | ||
| ] | ||
| UserAdmin.list_filter += (RegisteredUserFilter, "registered_user__method") | ||
| UserAdmin.list_filter += (RegisteredUserFilter, "registered_users__method") | ||
|
|
||
|
|
||
| def get_is_verified(self, obj): | ||
| try: | ||
| value = "yes" if obj.registered_user.is_verified else "no" | ||
| if not obj.registered_users.exists(): | ||
| value = "unknown" | ||
| elif obj.registered_users.filter(is_verified=True).exists(): | ||
| value = "yes" | ||
| else: | ||
| value = "no" | ||
|
Comment on lines
556
to
+563
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid N+1 queries in This now does up to two 🤖 Prompt for AI Agents |
||
| except Exception: | ||
| value = "unknown" | ||
| icon_url = static(f"admin/img/icon-{value}.svg") | ||
|
|
@@ -564,7 +570,6 @@ def get_is_verified(self, obj): | |
| UserAdmin.get_is_verified = get_is_verified | ||
| UserAdmin.get_is_verified.short_description = _("Verified") | ||
| UserAdmin.list_display.insert(3, "get_is_verified") | ||
| UserAdmin.list_select_related = ("registered_user",) | ||
|
|
||
|
|
||
| class OrganizationRadiusSettingsInline(admin.StackedInline): | ||
|
|
@@ -622,7 +627,7 @@ class Media: | |
| # avoid cluttering the admin with too many models, leave only the | ||
| # minimum required to configure social login and check if it's working | ||
| if app_settings.SOCIAL_REGISTRATION_CONFIGURED: | ||
| from allauth.socialaccount.admin import SocialAccount, SocialApp, SocialAppAdmin | ||
| from allauth.socialaccount.admin import SocialAccount | ||
|
|
||
| class SocialAccountInline(admin.StackedInline): | ||
| model = SocialAccount | ||
|
|
@@ -636,7 +641,6 @@ def has_delete_permission(self, request, obj=None): | |
| return False | ||
|
|
||
| UserAdmin.inlines += [SocialAccountInline] | ||
| admin.site.register(SocialApp, SocialAppAdmin) | ||
|
|
||
|
|
||
| if app_settings.USER_ADMIN_RADIUSTOKEN_INLINE: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
--no-depsflag bypasses dependency resolution and risks broken environments.Installing
openwisp-userswith--no-depsprevents pip from checking or installing its dependencies. If theissues/497-export-usersbranch requires different versions of shared dependencies (Django, other OpenWISP packages, etc.), those won't be resolved, potentially causing runtime failures that only surface during test execution rather than at install time.🔧 Safer installation approach
If
--no-depsis intentionally used to avoid dependency conflicts, document why and verify that all required dependencies are already correctly installed by the previous steps.📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai this is temporary, ignore!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pandafy, understood! I'll disregard this comment. The temporarypip install --no-depsline is a workaround pending the merge of the upstreamopenwisp-usersPR#498.✏️ Learnings added
🧠 Learnings used