-
Notifications
You must be signed in to change notification settings - Fork 1
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
2160 internal user can view access requests #2469
Merged
Sepehr-Sobhani
merged 15 commits into
develop
from
2160-internal-user-can-view-access-requests
Nov 21, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7e3514d
feat: internal users can view access requests
Sepehr-Sobhani 58bae19
test: update endpoint permission test
Sepehr-Sobhani 1afdbb6
chore: update dashboard tiles
Sepehr-Sobhani 230a980
chore: update fixtures to have better data in the grid
Sepehr-Sobhani 06c1312
chore: more informative errors when debugging
Sepehr-Sobhani 987087e
chore: fix eslint errors
Sepehr-Sobhani ae61bb7
chore: limit service access to irc users
Sepehr-Sobhani a12ba25
chore: pass user guid to service
Sepehr-Sobhani 3981d17
chore: modify data access service and add tests for it
Sepehr-Sobhani 98cac1f
test: add service and endpoint tests
Sepehr-Sobhani c165656
test: add frontend tests
Sepehr-Sobhani fa79846
chore: use the related data model for filtering status
Sepehr-Sobhani e6186b6
chore: non-related - make admin table for user and user-operator pret…
Sepehr-Sobhani a8e0aff
test: add more endpoint tests
Sepehr-Sobhani 5f1c36c
chore: implement PR review suggestions
Sepehr-Sobhani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,44 @@ | ||
from ninja import Schema | ||
from typing import Optional | ||
from django.db.models import Q | ||
from ninja import Schema, FilterSchema, Field, ModelSchema | ||
from uuid import UUID | ||
from registration.models import UserOperator | ||
|
||
|
||
class UserOperatorOperatorOut(Schema): | ||
operator_id: UUID | ||
user_operator_id: UUID | ||
|
||
|
||
class UserOperatorFilterSchema(FilterSchema): | ||
user_friendly_id: Optional[str] = Field(None, json_schema_extra={'q': 'user_friendly_id__icontains'}) | ||
status: Optional[str] = None | ||
user__first_name: Optional[str] = Field(None, json_schema_extra={'q': 'user__first_name__icontains'}) | ||
user__last_name: Optional[str] = Field(None, json_schema_extra={'q': 'user__last_name__icontains'}) | ||
user__email: Optional[str] = Field(None, json_schema_extra={'q': 'user__email__icontains'}) | ||
user__bceid_business_name: Optional[str] = Field( | ||
None, json_schema_extra={'q': 'user__bceid_business_name__icontains'} | ||
) | ||
operator__legal_name: Optional[str] = Field(None, json_schema_extra={'q': 'operator__legal_name__icontains'}) | ||
|
||
@staticmethod | ||
def filter_status(value: Optional[str]) -> Q: | ||
# Override the default filter_status method to handle the special case of 'admin' and 'access' | ||
# The value in the frontend is 'admin access' but the value in the database is 'approved' | ||
if value: | ||
if value.lower() in "admin access": | ||
value = "approved" | ||
return Q(status__icontains=value) | ||
return Q() | ||
|
||
|
||
class UserOperatorListOut(ModelSchema): | ||
user__first_name: str = Field(..., alias="user.first_name") | ||
user__last_name: str = Field(..., alias="user.last_name") | ||
user__email: str = Field(..., alias="user.email") | ||
user__bceid_business_name: str = Field(..., alias="user.bceid_business_name") | ||
operator__legal_name: str = Field(..., alias="operator.legal_name") | ||
|
||
class Meta: | ||
model = UserOperator | ||
fields = ['id', 'user_friendly_id', 'status'] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
created_at isn't one of the grid columns, does that matter?
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.
Yes,
created_at
serves as the default value for sorting when users do not specify their own sorting preferences.(It's used for the query)