python: commentGroups

This commit is contained in:
Dmitrii Vershinin
2021-06-15 12:18:34 +02:00
parent 500f93deb8
commit ba5a4e64f5
2 changed files with 28 additions and 6 deletions

View File

@ -27,12 +27,13 @@
from urllib.parse import unquote
class User:
def __init__(self, id, name, email, group, reviewGroups, favorite, deniedPermissions, descriptions):
def __init__(self, id, name, email, group, reviewGroups, commentGroups, favorite, deniedPermissions, descriptions):
self.id = id
self.name = name
self.email = email
self.group = group
self.reviewGroups = reviewGroups
self.commentGroups = commentGroups
self.favorite = favorite
self.deniedPermissions = deniedPermissions
self.descriptions = descriptions
@ -41,18 +42,21 @@ descr_user_1 = [
"File author by default",
"He doesnt belong to any of the groups",
"He can review all the changes",
"He can do everything with the comments",
"The file favorite state is undefined"
]
descr_user_2 = [
"He belongs to Group2",
"He can review only his own changes or the changes made by the users who dont belong to any of the groups",
"He can view, edit and delete only his comments and the comments left by the users who don't belong to any of the groups",
"This file is favorite"
]
descr_user_3 = [
"He belongs to Group3",
"He can review only the changes made by the users from Group2",
"He can view, edit and delete only his comments and the comments left by the users from Group2",
"This file isnt favorite",
"He cant copy data from the file into the clipboard",
"He cant download the file",
@ -63,15 +67,32 @@ descr_user_0 = [
"The user without a name. The name is requested upon the editor opening",
"He doesnt belong to any of the groups",
"He can review all the changes",
"He can do everything with the comments",
"The file favorite state is undefined",
"He cannot mention others in the comments"
]
USERS = [
User('uid-1', 'John Smith', 'smith@mail.ru', None, None, None, [], descr_user_1),
User('uid-2', 'Mark Pottato', 'pottato@mail.ru', 'group-2', ['group-2', ''], True, [], descr_user_2),
User('uid-3', 'Hamish Mitchell', 'mitchell@mail.ru', 'group-3', ['group-2'], False, ["copy", "download", "print"], descr_user_3),
User('uid-0', None, None, None, None, None, [], descr_user_0)
User('uid-1', 'John Smith', 'smith@mail.ru',
None, None, {},
None, [], descr_user_1),
User('uid-2', 'Mark Pottato', 'pottato@mail.ru',
'group-2', ['group-2', ''], {
'view': ["group-2", ""],
'edit': ["group-2", ""],
'remove': ["group-2", ""]
},
True, [], descr_user_2),
User('uid-3', 'Hamish Mitchell', 'mitchell@mail.ru',
'group-3', ['group-2'], {
'view': ["group-3", "group-2"],
'edit': ["group-2"],
'remove': ["group-2"]
},
False, ["copy", "download", "print"], descr_user_3),
User('uid-0', None, None,
None, None, {},
None, [], descr_user_0)
]
DEFAULT_USER = USERS[0]

View File

@ -172,7 +172,8 @@ def edit(request):
'modifyFilter': edMode != 'filter',
'modifyContentControl': edMode != "blockcontent",
'review': canEdit & ((edMode == 'edit') | (edMode == 'review')),
'reviewGroups': user.reviewGroups
'reviewGroups': user.reviewGroups,
'commentGroups': user.commentGroups
}
},
'editorConfig': {