mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-19 23:48:51 +00:00
Merge pull request #5034 from haiwen/onlyoffice-co-editing-change-name
can change name when anonymous user edit file
This commit is contained in:
commit
fa4bdcec3c
@ -171,12 +171,21 @@ def get_onlyoffice_dict(request, username, repo_id, file_path, file_id='',
|
|||||||
"customization": {
|
"customization": {
|
||||||
"forcesave": ONLYOFFICE_FORCE_SAVE,
|
"forcesave": ONLYOFFICE_FORCE_SAVE,
|
||||||
},
|
},
|
||||||
"user": {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if request.user.is_authenticated:
|
||||||
|
user_dict = {
|
||||||
"id": username,
|
"id": username,
|
||||||
"name": email2nickname(username)
|
"name": email2nickname(username)
|
||||||
}
|
}
|
||||||
|
config['editorConfig']['user'] = user_dict
|
||||||
|
else:
|
||||||
|
anonymous_dict = {
|
||||||
|
"request": True,
|
||||||
|
"label": "Guest"
|
||||||
}
|
}
|
||||||
}
|
config['editorConfig']['customization']['anonymous'] = anonymous_dict
|
||||||
|
|
||||||
return_dict['onlyoffice_jwt_token'] = jwt.encode(config, ONLYOFFICE_JWT_SECRET)
|
return_dict['onlyoffice_jwt_token'] = jwt.encode(config, ONLYOFFICE_JWT_SECRET)
|
||||||
|
|
||||||
|
@ -44,11 +44,19 @@ html, body { padding:0; margin:0; height:100%; }
|
|||||||
"mode": {% if can_edit %}"edit"{% else %}"view"{% endif %},
|
"mode": {% if can_edit %}"edit"{% else %}"view"{% endif %},
|
||||||
"customization": {
|
"customization": {
|
||||||
"forcesave": {% if onlyoffice_force_save %}true{% else %}false{% endif %},
|
"forcesave": {% if onlyoffice_force_save %}true{% else %}false{% endif %},
|
||||||
|
{% if not request.user.is_authenticated %}
|
||||||
|
"anonymous": {
|
||||||
|
"request": true,
|
||||||
|
"label": "Guest"
|
||||||
},
|
},
|
||||||
|
{% endif %}
|
||||||
|
},
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
"user": {
|
"user": {
|
||||||
"id": "{{ username|escapejs }}",
|
"id": "{{ username|escapejs }}",
|
||||||
"name": "{{ username|email2nickname|escapejs }}"
|
"name": "{{ username|email2nickname|escapejs }}"
|
||||||
}
|
}
|
||||||
|
{% endif %}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var docEditor = new DocsAPI.DocEditor("placeholder", config);
|
var docEditor = new DocsAPI.DocEditor("placeholder", config);
|
||||||
|
Loading…
Reference in New Issue
Block a user