-
Notifications
You must be signed in to change notification settings - Fork 13
add federation #972
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
Merged
Merged
add federation #972
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
1179946
add federation plugin, add federation models, add API route for share…
jeriox 6a4310d
handle AccessToken that does not belong to a FederatedGuest
jeriox 6850f14
add frontend view to display incoming events, add OAuth2 flow, add AP…
jeriox bf2a0e1
add nav link, use correct signup url
jeriox d231692
check access token validity before serving the event detail view
jeriox 4185a7d
add shift signup flow for federated users, add referrer to start corr…
jeriox 87dc507
set session expiration
jeriox bb1f471
add QualificationSerializer
jeriox 63f27a7
respect included qualifications
jeriox 1e22bb3
improve incoming event view
jeriox 8970552
make pylint happy
jeriox 4b35cba
add form to select guests to share an event with
jeriox 7321fe5
add RedeemFederationInviteCodeView
jeriox 59cacbc
finish invite flow
jeriox 79a0d00
fix event create
jeriox 2e86193
fix event create
jeriox 3a07f18
fix event create
jeriox fb1861d
fix naming
jeriox 68bb977
add delete views for host and guest, handle invite code expiration
jeriox 9ded743
add InviteCodeRevealView, add explanations and experimental labels
jeriox 77fe893
remove expired invite codes
jeriox 2b442d1
fix authorize translation
felixrindt 22a6bae
address some review comments
jeriox 04ae30e
address more review comments
jeriox 562dde9
address more reivew comments
jeriox 1440dfd
add flow to tear down federation connection
jeriox de76505
fix poetry.lock
jeriox 87f18b3
fix tests
jeriox 9fef232
fix linter
jeriox 9485687
address review comments
jeriox 610a00d
fix css for external event list
jeriox 8160a41
start adding tests
jeriox 611196a
add test_redeem_invitecode_api
jeriox b47304e
add shared_event_list_test
jeriox ec1dfb6
add shared_event_detail test
jeriox fc8a61b
Merge remote-tracking branch 'origin/main' into federation
jeriox 16c233f
fix lockfile
jeriox 5c09069
remove django_db_serialized_rollback
jeriox 409cc65
lint templates
jeriox d291fdd
run all tests with rollback emulation
jeriox f513a08
enable OAuth testing
jeriox 1c7976a
Merge remote-tracking branch 'origin/main' into federation
jeriox 15ab80b
fix poetry.lock
jeriox d6705e7
add translations
jeriox 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| from django.db.models import Q | ||
| from django.utils import timezone | ||
| from oauth2_provider.contrib.rest_framework import IsAuthenticatedOrTokenHasScope | ||
| from rest_framework.exceptions import PermissionDenied | ||
| from rest_framework.fields import SerializerMethodField | ||
| from rest_framework.generics import RetrieveAPIView | ||
| from rest_framework.relations import SlugRelatedField | ||
| from rest_framework.serializers import ModelSerializer | ||
|
|
||
| from ephios.core.models import Qualification, UserProfile | ||
|
|
||
|
|
||
| class QualificationSerializer(ModelSerializer): | ||
| category = SlugRelatedField(slug_field="uuid", read_only=True) | ||
| includes = SerializerMethodField() | ||
|
|
||
| class Meta: | ||
| model = Qualification | ||
| fields = [ | ||
| "uuid", | ||
| "title", | ||
| "abbreviation", | ||
| "category", | ||
| "includes", | ||
| ] | ||
|
|
||
| def get_includes(self, obj): | ||
| qualifications = Qualification.collect_all_included_qualifications(obj.includes.all()) | ||
| return [q.uuid for q in qualifications] | ||
|
|
||
|
|
||
| class UserProfileSerializer(ModelSerializer): | ||
| qualifications = SerializerMethodField() | ||
|
|
||
| class Meta: | ||
| model = UserProfile | ||
| fields = [ | ||
| "first_name", | ||
| "last_name", | ||
| "date_of_birth", | ||
| "email", | ||
| "qualifications", | ||
| ] | ||
|
|
||
| def get_qualifications(self, obj): | ||
| return QualificationSerializer( | ||
| Qualification.objects.filter( | ||
| Q(grants__user=obj) | ||
| & (Q(grants__expires__gte=timezone.now()) | Q(grants__expires__isnull=True)) | ||
| ), | ||
| many=True, | ||
| ).data | ||
|
|
||
|
|
||
| class UserProfileMeView(RetrieveAPIView): | ||
| serializer_class = UserProfileSerializer | ||
| queryset = UserProfile.objects.all() | ||
| permission_classes = [IsAuthenticatedOrTokenHasScope] | ||
| required_scopes = ["ME_READ"] | ||
|
|
||
| def get_object(self): | ||
| if self.request.user is None: | ||
| raise PermissionDenied() | ||
| return self.request.user | ||
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.