mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 06:34:40 +00:00
modify file comment permission (#3116)
This commit is contained in:
@@ -16,6 +16,7 @@ from seahub.avatar.settings import AVATAR_DEFAULT_SIZE
|
||||
from seahub.base.models import FileComment
|
||||
from seahub.utils.repo import is_repo_owner
|
||||
from seahub.views import check_folder_permission
|
||||
from seahub.constants import PERMISSION_READ_WRITE
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -87,8 +88,7 @@ class FileCommentView(APIView):
|
||||
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
|
||||
|
||||
# permission check
|
||||
username = request.user.username
|
||||
if username != file_comment.author and not is_repo_owner(request, repo_id, username):
|
||||
if check_folder_permission(request, repo_id, '/') != PERMISSION_READ_WRITE:
|
||||
error_msg = 'Permission denied.'
|
||||
return api_error(status.HTTP_403_FORBIDDEN, error_msg)
|
||||
|
||||
|
Reference in New Issue
Block a user