-
Notifications
You must be signed in to change notification settings - Fork 155
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
base: enext
Are you sure you want to change the base?
Changes from all commits
0865294
25d3214
a6bba58
6b10ea9
c1ac731
ef0e02c
f5af4eb
a880658
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 |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Generated by Django 5.2.5 on 2025-11-27 13:17 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('base', '0002_alter_event_header_image_alter_event_locale_and_more'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='team', | ||
| name='can_video_create_channels', | ||
| field=models.BooleanField(default=False, help_text='Allows creating chat/video channels inside Eventyay Video.', verbose_name='Video: Can create channels'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='team', | ||
| name='can_video_create_stages', | ||
| field=models.BooleanField(default=False, help_text='Allows creating livestream stages inside Eventyay Video.', verbose_name='Video: Can create stages'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='team', | ||
| name='can_video_direct_message', | ||
| field=models.BooleanField(default=False, help_text='Grants permission to open new direct message conversations.', verbose_name='Video: Can send direct messages'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='team', | ||
| name='can_video_manage_announcements', | ||
| field=models.BooleanField(default=False, help_text='Allows posting announcements in the Eventyay Video interface.', verbose_name='Video: Can create announcements'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='team', | ||
| name='can_video_manage_configuration', | ||
| field=models.BooleanField(default=False, help_text='Allows editing the global Eventyay Video configuration.', verbose_name='Video: Can edit event configuration'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='team', | ||
| name='can_video_manage_kiosks', | ||
| field=models.BooleanField(default=False, help_text='Allows managing kiosk displays inside Eventyay Video.', verbose_name='Video: Can create and edit kiosks'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='team', | ||
| name='can_video_manage_rooms', | ||
| field=models.BooleanField(default=False, help_text='Allows editing and deleting rooms inside Eventyay Video.', verbose_name='Video: Can create and edit rooms'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='team', | ||
| name='can_video_manage_users', | ||
| field=models.BooleanField(default=False, help_text='Allows moderating users (ban, silence, reactivate) in Eventyay Video.', verbose_name='Video: Can message, ban, and silence users'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='team', | ||
| name='can_video_view_users', | ||
| field=models.BooleanField(default=False, help_text='Allows access to the user directory in Eventyay Video.', verbose_name='Video: Can view users'), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -52,7 +52,7 @@ | |||||
| from eventyay.common.text.path import path_with_hash | ||||||
| from eventyay.common.text.phrases import phrases | ||||||
| from eventyay.common.urls import EventUrls | ||||||
| from eventyay.core.permissions import Permission, SYSTEM_ROLES | ||||||
| from eventyay.core.permissions import MAX_PERMISSIONS_IF_SILENCED, Permission, SYSTEM_ROLES | ||||||
| from eventyay.core.utils.json import CustomJSONEncoder | ||||||
| from eventyay.consts import TIMEZONE_CHOICES | ||||||
| from eventyay.helpers.database import GroupConcat | ||||||
|
|
@@ -65,6 +65,7 @@ | |||||
| has_any_permission, | ||||||
| is_event_visible, | ||||||
| ) | ||||||
| from eventyay.eventyay_common.video.permissions import VIDEO_PERMISSION_BY_FIELD, VIDEO_TRAIT_ROLE_MAP | ||||||
| from .auth import User | ||||||
| from ..settings import settings_hierarkey | ||||||
| from .mixins import OrderedModel, PretalxModel | ||||||
|
|
@@ -1394,6 +1395,16 @@ def decode_token(self, token, allow_raise=False): | |||||
| if exc and allow_raise: | ||||||
| raise exc | ||||||
|
|
||||||
| def _get_trait_grants_with_defaults(self): | ||||||
| base_trait_grants = self.trait_grants if self.trait_grants is not None else default_grants() | ||||||
| slug = getattr(self, "slug", None) or getattr(self, "id", None) | ||||||
| if not slug: | ||||||
| return base_trait_grants | ||||||
| augmented = dict(base_trait_grants) | ||||||
| for role, trait_name in VIDEO_TRAIT_ROLE_MAP.items(): | ||||||
| augmented.setdefault(role, [f"eventyay-video-event-{slug}-{trait_name.replace('_', '-')}"]) | ||||||
| return augmented | ||||||
|
|
||||||
| def has_permission_implicit( | ||||||
| self, | ||||||
| *, | ||||||
|
|
@@ -1403,7 +1414,7 @@ def has_permission_implicit( | |||||
| allow_empty_traits=True, | ||||||
| ): | ||||||
| # Ensure trait_grants and roles are not None - use defaults if missing | ||||||
| event_trait_grants = self.trait_grants if self.trait_grants is not None else default_grants() | ||||||
| event_trait_grants = self._get_trait_grants_with_defaults() | ||||||
| event_roles = self.roles if self.roles is not None else default_roles() | ||||||
|
|
||||||
| for role, required_traits in event_trait_grants.items(): | ||||||
|
|
@@ -1519,9 +1530,16 @@ def get_all_permissions(self, user): | |||||
| allow_empty_traits = user.type == User.UserType.PERSON | ||||||
|
|
||||||
| # Ensure trait_grants and roles are not None | ||||||
| event_trait_grants = self.trait_grants if self.trait_grants is not None else default_grants() | ||||||
| event_trait_grants = self._get_trait_grants_with_defaults() | ||||||
| event_roles = self.roles if self.roles is not None else default_roles() | ||||||
|
|
||||||
| # Track if user has any organizer/admin role | ||||||
| has_organizer_role = False | ||||||
| organizer_roles = {'admin', 'apiuser', 'scheduleuser', 'video_stage_manager', | ||||||
| 'video_channel_manager', 'video_announcement_manager', | ||||||
| 'video_user_viewer', 'video_user_moderator', 'video_room_manager', | ||||||
| 'video_kiosk_manager', 'video_config_manager'} | ||||||
|
||||||
| 'video_kiosk_manager', 'video_config_manager'} | |
| 'video_kiosk_manager', 'video_config_manager', 'video_direct_messaging'} |
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 import statement
from eventyay.core.permissions import MAX_PERMISSIONS_IF_SILENCED, Permission, SYSTEM_ROLESaddsMAX_PERMISSIONS_IF_SILENCEDbut this import is never used in the visible code changes. Consider removing unused imports to keep the code clean.