Merge branch 'develop' into feature/restore-history

This commit is contained in:
Alexander Kondratev
2023-11-13 16:16:10 +07:00
committed by GitHub
50 changed files with 374 additions and 56 deletions

View File

@ -77,9 +77,7 @@ class FormatManager():
formats = self.all()
filtered = filter(
lambda format: (
format.type == 'cell' and 'xlsx' in format.convert or
format.type == 'slide' and 'pptx' in format.convert or
format.type == 'word' and 'docx' in format.convert
'auto-convert' in format.actions
),
formats
)

View File

@ -21,7 +21,7 @@ from typing import Optional
class User:
def __init__(self, uid, name, email, group, reviewGroups, commentGroups, userInfoGroups, favorite,
deniedPermissions, descriptions, templates):
deniedPermissions, descriptions, templates, avatar):
self.id = uid
self.name = name
self.email = email
@ -33,6 +33,7 @@ class User:
self.descriptions = descriptions
self.templates = templates
self.userInfoGroups = userInfoGroups
self.avatar = avatar
descr_user_1 = [
@ -42,7 +43,8 @@ descr_user_1 = [
"Can perform all actions with comments",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users"
"Can see the information about all users",
"Has an avatar"
]
descr_user_2 = [
@ -52,7 +54,8 @@ descr_user_2 = [
"Can remove his own comments only"),
"This file is marked as favorite",
"Can create new files from the editor",
"Can see the information about users from Group2 and users who dont belong to any group"
"Can see the information about users from Group2 and users who dont belong to any group",
"Has an avatar"
]
descr_user_3 = [
@ -85,7 +88,7 @@ descr_user_0 = [
USERS = [
User('uid-1', 'John Smith', 'smith@example.com',
'', None, {}, None,
None, [], descr_user_1, True),
None, [], descr_user_1, True, True),
User('uid-2', 'Mark Pottato', 'pottato@example.com',
'group-2', ['group-2', ''], {
'view': "",
@ -93,17 +96,17 @@ USERS = [
'remove': ["group-2"]
},
['group-2', ''],
True, [], descr_user_2, False),
True, [], descr_user_2, False, True),
User('uid-3', 'Hamish Mitchell', None,
'group-3', ['group-2'], {
'view': ["group-3", "group-2"],
'edit': ["group-2"],
'remove': []
}, ['group-2'],
False, ["copy", "download", "print"], descr_user_3, False),
False, ["copy", "download", "print"], descr_user_3, False, False),
User('uid-0', None, None,
'', None, {}, [],
None, ["protect"], descr_user_0, False)
None, ["protect"], descr_user_0, False, False)
]
DEFAULT_USER = USERS[0]

View File

@ -231,6 +231,16 @@ def edit(request):
}
]
usersInfo = []
if user.id != 'uid-0':
for userInfo in users.getAllUsers():
u = userInfo
u.image = docManager.getServerUrl(True, request) + f'/static/images/{u.id}.jpg' if user.avatar else None
usersInfo.append({"id": u.id, "name": u.name, "email": u.email, "image": u.image, "group": u.group,
"reviewGroups": u.reviewGroups, "commentGroups": u.commentGroups, "favorite": u.favorite,
"deniedPermissions": u.deniedPermissions, "descriptions": u.descriptions,
"templates": u.templates, "userInfoGroups": u.userInfoGroups, "avatar": u.avatar})
if meta: # if the document meta data exists,
infObj = { # write author and creation time parameters to the information object
'owner': meta['uname'],
@ -293,7 +303,9 @@ def edit(request):
'user': { # the user currently viewing or editing the document
'id': user.id if user.id != 'uid-0' else None,
'name': user.name,
'group': user.group
'group': user.group,
'image': docManager.getServerUrl(True, request) + f'/static/images/{user.id}.jpg' if user.avatar
else None
},
'embedded': { # the parameters for the embedded document type
# the absolute URL that will allow the document to be saved onto the user personal computer
@ -368,7 +380,8 @@ def edit(request):
'dataDocument': dataDocument, # document which will be compared with the current document
'dataSpreadsheet': json.dumps(dataSpreadsheet), # recipient data for mail merging
'usersForMentions': json.dumps(usersForMentions) if user.id != 'uid-0' else None,
'usersForProtect': json.dumps(usersForProtect) if user.id != 'uid-0' else None
'usersInfo': json.dumps(usersInfo),
'usersForProtect': json.dumps(usersForProtect) if user.id != 'uid-0' else None,
}
return render(request, 'editor.html', context) # execute the "editor.html" template with context data