mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-18 16:36:15 +00:00
Added RESTful file/dir api
This commit is contained in:
@@ -6,12 +6,17 @@ from rest_framework.permissions import BasePermission
|
||||
|
||||
from seaserv import check_permission
|
||||
|
||||
SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS']
|
||||
|
||||
class IsRepoWritable(BasePermission):
|
||||
"""
|
||||
Allows access only for users who has write permission to the repo.
|
||||
"""
|
||||
|
||||
def has_permission(self, request, view, obj=None):
|
||||
if request.method in SAFE_METHODS:
|
||||
return True
|
||||
|
||||
repo_id = view.kwargs.get('repo_id', '')
|
||||
user = request.user.username if request.user else ''
|
||||
|
||||
|
Reference in New Issue
Block a user