Implement editing users management and permission updates
- Added auto-creation of PlayerUser records from player metadata (user_card_data) - Fixed player_user table schema (removed player_id, made user_code unique globally) - Created admin page for managing editing users (view, update names, delete) - Updated permissions: normal users can now access admin panel, editing users, and leftover media - Admin-only access: user management, system dependencies, logo customization - Fixed edited media workflow to preserve original files - Content.filename now points to edited_media folder, keeping originals intact - Added user display names in edited media page (shows name if set, code otherwise) - Fixed leftover media file size calculation (handle None values) - Split editing users into separate card on admin panel with description
This commit is contained in:
@@ -343,6 +343,7 @@ def edited_media(player_id: int):
|
||||
|
||||
# Get all edited media history from player
|
||||
from app.models.player_edit import PlayerEdit
|
||||
from app.models.player_user import PlayerUser
|
||||
|
||||
edited_media = PlayerEdit.query.filter_by(player_id=player_id)\
|
||||
.order_by(PlayerEdit.created_at.desc())\
|
||||
@@ -356,10 +357,21 @@ def edited_media(player_id: int):
|
||||
if content:
|
||||
content_files[edit.content_id] = content
|
||||
|
||||
# Get user mappings for display names
|
||||
user_mappings = {}
|
||||
for edit in edited_media:
|
||||
if edit.user and edit.user not in user_mappings:
|
||||
player_user = PlayerUser.query.filter_by(user_code=edit.user).first()
|
||||
if player_user:
|
||||
user_mappings[edit.user] = player_user.user_name or edit.user
|
||||
else:
|
||||
user_mappings[edit.user] = edit.user
|
||||
|
||||
return render_template('players/edited_media.html',
|
||||
player=player,
|
||||
edited_media=edited_media,
|
||||
content_files=content_files)
|
||||
content_files=content_files,
|
||||
user_mappings=user_mappings)
|
||||
except Exception as e:
|
||||
log_action('error', f'Error loading edited media for player {player_id}: {str(e)}')
|
||||
flash('Error loading edited media.', 'danger')
|
||||
|
||||
Reference in New Issue
Block a user