Add folders with password sharing and email invites
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+11
-1
@@ -3,6 +3,9 @@ from functools import wraps
|
||||
from flask import abort, flash, redirect, url_for
|
||||
from flask_login import current_user
|
||||
|
||||
from app.folder_utils import can_edit_folder, is_folder_owner
|
||||
from app.models import FolderMember
|
||||
|
||||
|
||||
def admin_required(f):
|
||||
@wraps(f)
|
||||
@@ -20,7 +23,14 @@ def can_manage_photo(photo):
|
||||
return False
|
||||
if current_user.is_admin:
|
||||
return True
|
||||
return photo.user_id == current_user.id
|
||||
if photo.user_id == current_user.id:
|
||||
return True
|
||||
if photo.folder_id and photo.folder:
|
||||
if is_folder_owner(photo.folder, current_user):
|
||||
return True
|
||||
if can_edit_folder(photo.folder, current_user):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def photo_owner_or_admin(photo):
|
||||
|
||||
Reference in New Issue
Block a user