-
Notifications
You must be signed in to change notification settings - Fork 137
chore: common unified admin page #1348
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
Draft
Saksham-Sirohi
wants to merge
2
commits into
fossasia:enext
Choose a base branch
from
Saksham-Sirohi:unified-admin
base: enext
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
Contributor
Reviewer's GuideUnifies organizer team management into the common organizer edit page by embedding full team CRUD, member/invite/token handling, and redirects from legacy team URLs, while updating navigation and templates to point to the new unified interface. Sequence diagram for unified team creation on organizer pagesequenceDiagram
actor Admin
participant Browser
participant OrganizerUpdateView as OrganizerUpdate
participant TeamForm
participant DB as Database
participant Messages
Admin->>Browser: Click Create team (on Teams tab)
Browser->>OrganizerUpdateView: POST /organizer/<slug>/edit, team_action=create, form data (TeamForm)
OrganizerUpdateView->>OrganizerUpdateView: post()
OrganizerUpdateView->>OrganizerUpdateView: can_manage_teams check
alt has team permissions
OrganizerUpdateView->>OrganizerUpdateView: _handle_team_create()
OrganizerUpdateView->>TeamForm: __init__(data, organizer, prefix=team-create)
OrganizerUpdateView->>TeamForm: is_valid()
alt form valid
OrganizerUpdateView->>DB: transaction.atomic begin
OrganizerUpdateView->>TeamForm: save(commit=False)
TeamForm-->>OrganizerUpdateView: team (unsaved)
OrganizerUpdateView->>DB: save team
OrganizerUpdateView->>TeamForm: save_m2m()
OrganizerUpdateView->>DB: add current user to team.members
OrganizerUpdateView->>DB: team.log_action(eventyay.team.created, data)
OrganizerUpdateView->>DB: transaction.atomic commit
OrganizerUpdateView->>Messages: success("The team has been created…")
OrganizerUpdateView->>OrganizerUpdateView: _teams_tab_url(team.pk)
OrganizerUpdateView-->>Browser: HTTP 302 redirect to ?section=teams&team=<id>
else form invalid
OrganizerUpdateView->>Messages: error("Something went wrong…")
OrganizerUpdateView->>OrganizerUpdateView: _team_create_form_override = form
OrganizerUpdateView->>OrganizerUpdateView: _render_with_team_errors(section=teams)
OrganizerUpdateView->>OrganizerUpdateView: _build_unbound_organizer_form()
OrganizerUpdateView->>OrganizerUpdateView: get_context_data(form)
OrganizerUpdateView-->>Browser: Render organizer page with errors
end
else no team permissions
OrganizerUpdateView-->>Browser: PermissionDenied (403)
end
Class diagram for updated organizer and team management viewsclassDiagram
class OrganizerUpdate {
+object Organizer
+can_edit_general_info bool
+can_manage_teams bool
-_team_form_overrides dict
-_team_create_form_override TeamForm
-_forced_section str
-_selected_team_override str
-_team_queryset QuerySet
+dispatch(request, *args, **kwargs)
+post(request, *args, **kwargs)
+get_context_data(**kwargs)
+get_form(form_class)
+form_valid(form)
+get_success_url() str
-_get_team_queryset() QuerySet
-_get_team_create_form() TeamForm
-_build_team_panel(team, selected_team_id) dict
-_team_form_prefix(team) str
-_invite_form_prefix(team) str
-_token_form_prefix(team) str
-_set_team_override(team_id, form, invite_form, token_form)
-_teams_tab_url(team_id, section) str
-_build_unbound_organizer_form() OrganizerForm
-_render_with_team_errors(section)
-_get_team_from_post() Team
-_handle_team_create()
-_handle_team_update()
-_handle_team_members()
-_handle_team_tokens()
-_handle_team_delete()
-_send_invite(instance)
-_can_delete_team(team) bool
-_build_changed_data_dict(form, obj) dict
-_collect_team_change_data(team, form) dict
}
class UnifiedTeamManagementRedirectMixin {
+dispatch(request, *args, **kwargs)
}
class TeamListView {
+get_queryset() QuerySet
}
class TeamMemberView {
}
class TeamCreateView {
}
class TeamUpdateView {
}
class TeamDeleteView {
}
class Team {
+name str
+members ManyToMany(User)
+invites RelatedManager(TeamInvite)
+tokens RelatedManager(TeamAPIToken)
+active_tokens QuerySet
+memcount int
+eventcount int
+invcount int
+all_events bool
+log_action(action, user, data)
}
class Organizer {
+name str
+slug str
+teams RelatedManager(Team)
}
class TeamForm {
+name
+can_create_events
+can_manage_gift_cards
+can_change_teams
+can_change_organizer_settings
+all_events
+limit_events
+can_change_event_settings
+can_change_items
+can_view_orders
+can_change_orders
+can_checkin_orders
+can_view_vouchers
+can_change_vouchers
+can_change_submissions
+is_reviewer
+force_hide_speaker_names
+limit_tracks
}
class InviteForm {
+user
}
class TokenForm {
+name
}
class TeamInvite {
+email str
+team Team
+token str
}
class TeamAPIToken {
+name str
+token str
+active bool
+team Team
}
class User {
+email str
+fullname str
+require_2fa bool
+has_organizer_permission(organizer, permission, request) bool
}
OrganizerUpdate --> Organizer : edits
OrganizerUpdate --> Team : manages teams
OrganizerUpdate --> TeamForm : uses
OrganizerUpdate --> InviteForm : uses
OrganizerUpdate --> TokenForm : uses
OrganizerUpdate --> TeamInvite : creates
OrganizerUpdate --> TeamAPIToken : creates
OrganizerUpdate --> User : adds or removes members
UnifiedTeamManagementRedirectMixin <|-- TeamListView
UnifiedTeamManagementRedirectMixin <|-- TeamMemberView
UnifiedTeamManagementRedirectMixin <|-- TeamCreateView
UnifiedTeamManagementRedirectMixin <|-- TeamUpdateView
UnifiedTeamManagementRedirectMixin <|-- TeamDeleteView
Organizer o-- Team : has many
Team o-- User : members
Team o-- TeamInvite : invites
Team o-- TeamAPIToken : tokens
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
7db9116 to
4ba0ea3
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #921,#919
Summary by Sourcery
Unify organizer administration by moving all team and permission management into the organizer settings page and deprecating legacy team-specific views and URLs.
New Features:
Bug Fixes:
Enhancements: