Пример #1
0
    def get(self, request, repo_id, format=None):
        repo = get_repo(repo_id)
        if check_permission(repo_id, request.user.username) == 'rw':
            token = seafserv_rpc.web_get_access_token(repo_id,
                                                      'dummy',
                                                      'upload',
                                                      request.user.username)
        else:
            return api_error('403')

        if request.cloud_mode and seafserv_threaded_rpc.check_quota(repo_id) < 0:
            return api_error('413')

        upload_url = gen_file_upload_url(token, 'upload')
        return Response(upload_url)
Пример #2
0
    def get(self, request, repo_id):

        repo = get_repo(repo_id)
        if check_permission(repo_id, request.user.username) == 'rw':
            token = seafserv_rpc.web_get_access_token(repo_id,
                                                      'dummy',
                                                      'upload',
                                                      request.user.username)
        else:
            return api_error(request, '403')

        if request.cloud_mode and seafserv_threaded_rpc.check_quota(repo_id) < 0:
            return api_error(request, '413')

        upload_url = gen_file_upload_url(token, 'upload')
        return HttpResponse(json.dumps(upload_url), status=200,
                            content_type=json_content_type)