Merge branch 'develop' into feature/restore-history
@ -3,9 +3,12 @@
|
|||||||
- php: getting history via api
|
- php: getting history via api
|
||||||
- ruby: getting history via api
|
- ruby: getting history via api
|
||||||
- python: getting history via api
|
- python: getting history via api
|
||||||
|
- ruby: convert after uploading only tagged formats
|
||||||
|
- python: convert after uploading only tagged formats
|
||||||
|
- php: convert after uploading only tagged formats
|
||||||
- setUsers for region protection
|
- setUsers for region protection
|
||||||
- onRequestOpen method
|
- onRequestOpen method
|
||||||
- nodejs: user avatar
|
- user avatar
|
||||||
- trimming long name of uploading file
|
- trimming long name of uploading file
|
||||||
- nodejs: link in referenceData
|
- nodejs: link in referenceData
|
||||||
- onRequestSelectDocument method
|
- onRequestSelectDocument method
|
||||||
|
|||||||
BIN
web/documentserver-example/csharp-mvc/Content/images/uid-1.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
web/documentserver-example/csharp-mvc/Content/images/uid-2.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
@ -31,7 +31,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
|||||||
"Can perform all actions with comments",
|
"Can perform all actions with comments",
|
||||||
"The file favorite state is undefined",
|
"The file favorite state is undefined",
|
||||||
"Can create files from templates using data from the editor",
|
"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"
|
||||||
};
|
};
|
||||||
|
|
||||||
static List<string> descr_user_2 = new List<string>()
|
static List<string> descr_user_2 = new List<string>()
|
||||||
@ -41,7 +42,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
|||||||
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
|
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
|
||||||
"This file is marked as favorite",
|
"This file is marked as favorite",
|
||||||
"Can create new files from the editor",
|
"Can create new files from the editor",
|
||||||
"Can see the information about users from Group2 and users who don’t belong to any group"
|
"Can see the information about users from Group2 and users who don’t belong to any group",
|
||||||
|
"Has an avatar"
|
||||||
};
|
};
|
||||||
|
|
||||||
static List<string> descr_user_3 = new List<string>()
|
static List<string> descr_user_3 = new List<string>()
|
||||||
@ -85,6 +87,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
|||||||
null,
|
null,
|
||||||
new List<string>(),
|
new List<string>(),
|
||||||
descr_user_1,
|
descr_user_1,
|
||||||
|
true,
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
new User(
|
new User(
|
||||||
@ -103,7 +106,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
|||||||
true,
|
true,
|
||||||
new List<string>(),
|
new List<string>(),
|
||||||
descr_user_2,
|
descr_user_2,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
),
|
),
|
||||||
new User(
|
new User(
|
||||||
"uid-3",
|
"uid-3",
|
||||||
@ -121,6 +125,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
|||||||
false,
|
false,
|
||||||
new List<string>() { "copy", "download", "print" },
|
new List<string>() { "copy", "download", "print" },
|
||||||
descr_user_3,
|
descr_user_3,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new User(
|
new User(
|
||||||
@ -134,6 +139,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
|||||||
null,
|
null,
|
||||||
new List<string>() { "protect" },
|
new List<string>() { "protect" },
|
||||||
descr_user_0,
|
descr_user_0,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
@ -172,6 +178,24 @@ namespace OnlineEditorsExampleMVC.Helpers
|
|||||||
return usersData;
|
return usersData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<Dictionary<string, object>> getUsersInfo(string id)
|
||||||
|
{
|
||||||
|
List<Dictionary<string, object>> usersData = new List<Dictionary<string, object>>();
|
||||||
|
if (id != "uid-0") {
|
||||||
|
foreach (User user in users)
|
||||||
|
{
|
||||||
|
usersData.Add(new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
{"id", user.id},
|
||||||
|
{"name", user.name },
|
||||||
|
{"email", user.email },
|
||||||
|
{"image", user.avatar ? DocManagerHelper.GetServerUrl(false) + "/Content/images/" + user.id + ".png" : null}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return usersData;
|
||||||
|
}
|
||||||
|
|
||||||
// get a list of users with their names and emails for protect
|
// get a list of users with their names and emails for protect
|
||||||
public static List<Dictionary<string, object>> getUsersForProtect(string id)
|
public static List<Dictionary<string, object>> getUsersForProtect(string id)
|
||||||
{
|
{
|
||||||
@ -205,8 +229,9 @@ namespace OnlineEditorsExampleMVC.Helpers
|
|||||||
public List<string> descriptions;
|
public List<string> descriptions;
|
||||||
public bool templates;
|
public bool templates;
|
||||||
public List<string> userInfoGroups;
|
public List<string> userInfoGroups;
|
||||||
|
public bool avatar;
|
||||||
|
|
||||||
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates)
|
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -219,6 +244,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
|||||||
this.descriptions = descriptions;
|
this.descriptions = descriptions;
|
||||||
this.templates = templates;
|
this.templates = templates;
|
||||||
this.userInfoGroups = userInfoGroups;
|
this.userInfoGroups = userInfoGroups;
|
||||||
|
this.avatar = avatar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -190,7 +190,8 @@ namespace OnlineEditorsExampleMVC.Models
|
|||||||
{
|
{
|
||||||
{ "id", !user.id.Equals("uid-0") ? user.id : null },
|
{ "id", !user.id.Equals("uid-0") ? user.id : null },
|
||||||
{ "name", user.name },
|
{ "name", user.name },
|
||||||
{ "group", user.group }
|
{ "group", user.group },
|
||||||
|
{ "image", user.avatar ? DocManagerHelper.GetServerUrl(false) + "/Content/images/" + user.id + ".png" : null}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -373,6 +374,14 @@ namespace OnlineEditorsExampleMVC.Models
|
|||||||
usersForMentions = !user.id.Equals("uid-0") ? jss.Serialize(Users.getUsersForMentions(user.id)) : null;
|
usersForMentions = !user.id.Equals("uid-0") ? jss.Serialize(Users.getUsersForMentions(user.id)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GetUsersInfo(HttpRequest request, out string usersInfo)
|
||||||
|
{
|
||||||
|
var jss = new JavaScriptSerializer();
|
||||||
|
var id = request.Cookies.GetOrDefault("uid", null);
|
||||||
|
var user = Users.getUser(id);
|
||||||
|
usersInfo = jss.Serialize(Users.getUsersInfo(user.id));
|
||||||
|
}
|
||||||
|
|
||||||
//get a users for protect
|
//get a users for protect
|
||||||
public void GetUsersProtect(HttpRequest request, out string usersForProtect)
|
public void GetUsersProtect(HttpRequest request, out string usersForProtect)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -278,6 +278,8 @@
|
|||||||
|
|
||||||
<% string usersForMentions; %>
|
<% string usersForMentions; %>
|
||||||
<% Model.GetUsersMentions(Request, out usersForMentions); %>
|
<% Model.GetUsersMentions(Request, out usersForMentions); %>
|
||||||
|
<% string usersInfo; %>
|
||||||
|
<% Model.GetUsersInfo(Request, out usersInfo); %>
|
||||||
<% string usersForProtect; %>
|
<% string usersForProtect; %>
|
||||||
<% Model.GetUsersProtect(Request, out usersForProtect); %>
|
<% Model.GetUsersProtect(Request, out usersForProtect); %>
|
||||||
|
|
||||||
@ -300,6 +302,18 @@
|
|||||||
var c = event.data.c;
|
var c = event.data.c;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case "info":
|
||||||
|
users = [];
|
||||||
|
var allUsers = <%= usersInfo %>;
|
||||||
|
for (var i = 0; i < event.data.id.length; i++) {
|
||||||
|
for (var j = 0; j < allUsers.length; j++) {
|
||||||
|
if (allUsers[j].id == event.data.id[i]) {
|
||||||
|
users.push(allUsers[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "protect":
|
case "protect":
|
||||||
var users = <%= usersForProtect %>;
|
var users = <%= usersForProtect %>;
|
||||||
break;
|
break;
|
||||||
|
|||||||
BIN
web/documentserver-example/csharp/App_Themes/images/uid-1.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
web/documentserver-example/csharp/App_Themes/images/uid-2.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
@ -303,6 +303,18 @@
|
|||||||
var c = event.data.c;
|
var c = event.data.c;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case "info":
|
||||||
|
users = [];
|
||||||
|
var allUsers = <%= UsersInfo %>;
|
||||||
|
for (var i = 0; i < event.data.id.length; i++) {
|
||||||
|
for (var j = 0; j < allUsers.length; j++) {
|
||||||
|
if (allUsers[j].id == event.data.id[i]) {
|
||||||
|
users.push(allUsers[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "protect":
|
case "protect":
|
||||||
var users = <%= UsersForProtect %>;
|
var users = <%= UsersForProtect %>;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -64,6 +64,7 @@ namespace OnlineEditorsExample
|
|||||||
protected string DocumentData { get; private set; }
|
protected string DocumentData { get; private set; }
|
||||||
protected string DataSpreadsheet { get; private set; }
|
protected string DataSpreadsheet { get; private set; }
|
||||||
protected string UsersForMentions { get; private set; }
|
protected string UsersForMentions { get; private set; }
|
||||||
|
protected string UsersInfo { get; private set; }
|
||||||
protected string UsersForProtect { get; private set; }
|
protected string UsersForProtect { get; private set; }
|
||||||
protected string DocumentType { get { return _Default.DocumentType(FileName); } }
|
protected string DocumentType { get { return _Default.DocumentType(FileName); } }
|
||||||
|
|
||||||
@ -257,7 +258,8 @@ namespace OnlineEditorsExample
|
|||||||
{
|
{
|
||||||
{ "id", !user.id.Equals("uid-0") ? user.id : null },
|
{ "id", !user.id.Equals("uid-0") ? user.id : null },
|
||||||
{ "name", user.name },
|
{ "name", user.name },
|
||||||
{ "group", user.group }
|
{ "group", user.group },
|
||||||
|
{ "image", user.avatar ? _Default.GetServerUrl(false) + "/App_Themes/images/"+ user.id + ".png" : null }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -319,6 +321,9 @@ namespace OnlineEditorsExample
|
|||||||
List<Dictionary<string, object>> usersData = Users.getUsersForMentions(user.id);
|
List<Dictionary<string, object>> usersData = Users.getUsersForMentions(user.id);
|
||||||
UsersForMentions = !user.id.Equals("uid-0") ? jss.Serialize(usersData) : null;
|
UsersForMentions = !user.id.Equals("uid-0") ? jss.Serialize(usersData) : null;
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> usersInfo = Users.getUsersInfo(user.id);
|
||||||
|
UsersInfo = jss.Serialize(usersData);
|
||||||
|
|
||||||
// get users for protect
|
// get users for protect
|
||||||
List<Dictionary<string, object>> usersProtectData = Users.getUsersForProtect(user.id);
|
List<Dictionary<string, object>> usersProtectData = Users.getUsersForProtect(user.id);
|
||||||
UsersForProtect = !user.id.Equals("uid-0") ? jss.Serialize(usersProtectData) : null;
|
UsersForProtect = !user.id.Equals("uid-0") ? jss.Serialize(usersProtectData) : null;
|
||||||
|
|||||||
@ -30,7 +30,8 @@ namespace OnlineEditorsExample
|
|||||||
"Can perform all actions with comments",
|
"Can perform all actions with comments",
|
||||||
"The file favorite state is undefined",
|
"The file favorite state is undefined",
|
||||||
"Can create files from templates using data from the editor",
|
"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"
|
||||||
};
|
};
|
||||||
|
|
||||||
static List<string> descr_user_2 = new List<string>()
|
static List<string> descr_user_2 = new List<string>()
|
||||||
@ -40,7 +41,8 @@ namespace OnlineEditorsExample
|
|||||||
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
|
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
|
||||||
"This file is marked as favorite",
|
"This file is marked as favorite",
|
||||||
"Can create new files from the editor",
|
"Can create new files from the editor",
|
||||||
"Can see the information about users from Group2 and users who don’t belong to any group"
|
"Can see the information about users from Group2 and users who don’t belong to any group",
|
||||||
|
"Has an avatar"
|
||||||
};
|
};
|
||||||
|
|
||||||
static List<string> descr_user_3 = new List<string>()
|
static List<string> descr_user_3 = new List<string>()
|
||||||
@ -84,6 +86,7 @@ namespace OnlineEditorsExample
|
|||||||
null,
|
null,
|
||||||
new List<string>(),
|
new List<string>(),
|
||||||
descr_user_1,
|
descr_user_1,
|
||||||
|
true,
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
new User(
|
new User(
|
||||||
@ -102,7 +105,8 @@ namespace OnlineEditorsExample
|
|||||||
true,
|
true,
|
||||||
new List<string>(),
|
new List<string>(),
|
||||||
descr_user_2,
|
descr_user_2,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
),
|
),
|
||||||
new User(
|
new User(
|
||||||
"uid-3",
|
"uid-3",
|
||||||
@ -120,6 +124,7 @@ namespace OnlineEditorsExample
|
|||||||
false,
|
false,
|
||||||
new List<string>() { "copy", "download", "print" },
|
new List<string>() { "copy", "download", "print" },
|
||||||
descr_user_3,
|
descr_user_3,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new User(
|
new User(
|
||||||
@ -133,6 +138,7 @@ namespace OnlineEditorsExample
|
|||||||
null,
|
null,
|
||||||
new List<string>() { "protect" },
|
new List<string>() { "protect" },
|
||||||
descr_user_0,
|
descr_user_0,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
@ -172,6 +178,24 @@ namespace OnlineEditorsExample
|
|||||||
return usersData;
|
return usersData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<Dictionary<string, object>> getUsersInfo(string id)
|
||||||
|
{
|
||||||
|
List<Dictionary<string, object>> usersData = new List<Dictionary<string, object>>();
|
||||||
|
if(id != "uid-0"){
|
||||||
|
foreach (User user in users)
|
||||||
|
{
|
||||||
|
usersData.Add(new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
{"id", user.id},
|
||||||
|
{"name", user.name },
|
||||||
|
{"email", user.email },
|
||||||
|
{"image", user.avatar ? _Default.GetServerUrl(false) + "/App_Themes/images/"+ user.id + ".png" : null }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return usersData;
|
||||||
|
}
|
||||||
|
|
||||||
// get a list of users with their names and emails for protect
|
// get a list of users with their names and emails for protect
|
||||||
public static List<Dictionary<string, object>> getUsersForProtect(string id)
|
public static List<Dictionary<string, object>> getUsersForProtect(string id)
|
||||||
{
|
{
|
||||||
@ -206,8 +230,9 @@ namespace OnlineEditorsExample
|
|||||||
public List<string> descriptions;
|
public List<string> descriptions;
|
||||||
public bool templates;
|
public bool templates;
|
||||||
public List<string> userInfoGroups;
|
public List<string> userInfoGroups;
|
||||||
|
public bool avatar;
|
||||||
|
|
||||||
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates)
|
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -220,6 +245,7 @@ namespace OnlineEditorsExample
|
|||||||
this.descriptions = descriptions;
|
this.descriptions = descriptions;
|
||||||
this.templates = templates;
|
this.templates = templates;
|
||||||
this.userInfoGroups = userInfoGroups;
|
this.userInfoGroups = userInfoGroups;
|
||||||
|
this.avatar = avatar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,8 @@ public class ExampleData {
|
|||||||
"The file favorite state is undefined",
|
"The file favorite state is undefined",
|
||||||
"Can create a file from a template with data from the editor",
|
"Can create a file from a template with data from the editor",
|
||||||
"Can see the information about all users",
|
"Can see the information about all users",
|
||||||
"Can view chat"
|
"Can view chat",
|
||||||
|
"Has an avatar"
|
||||||
);
|
);
|
||||||
|
|
||||||
// the description for user 2
|
// the description for user 2
|
||||||
@ -71,7 +72,8 @@ public class ExampleData {
|
|||||||
"This file is favorite",
|
"This file is favorite",
|
||||||
"Can create a file from an editor",
|
"Can create a file from an editor",
|
||||||
"Can see the information about users from Group2 and users who don’t belong to any group",
|
"Can see the information about users from Group2 and users who don’t belong to any group",
|
||||||
"Can view chat"
|
"Can view chat",
|
||||||
|
"Has an avatar"
|
||||||
);
|
);
|
||||||
|
|
||||||
// the description for user 3
|
// the description for user 3
|
||||||
@ -93,23 +95,23 @@ public class ExampleData {
|
|||||||
userService.createUser("John Smith", "smith@example.com", descriptionUserFirst,
|
userService.createUser("John Smith", "smith@example.com", descriptionUserFirst,
|
||||||
"", List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
"", List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
||||||
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
||||||
List.of(FilterState.NULL.toString()), null, true, true);
|
List.of(FilterState.NULL.toString()), null, true, true, true);
|
||||||
|
|
||||||
// create user 2 with the specified parameters
|
// create user 2 with the specified parameters
|
||||||
userService.createUser("Mark Pottato", "pottato@example.com", descriptionUserSecond,
|
userService.createUser("Mark Pottato", "pottato@example.com", descriptionUserSecond,
|
||||||
"group-2", List.of("", "group-2"), List.of(FilterState.NULL.toString()),
|
"group-2", List.of("", "group-2"), List.of(FilterState.NULL.toString()),
|
||||||
List.of("group-2", ""), List.of("group-2"), List.of("group-2", ""), true, true,
|
List.of("group-2", ""), List.of("group-2"), List.of("group-2", ""), true, true,
|
||||||
true);
|
true, true);
|
||||||
|
|
||||||
// create user 3 with the specified parameters
|
// create user 3 with the specified parameters
|
||||||
userService.createUser("Hamish Mitchell", null, descriptionUserThird,
|
userService.createUser("Hamish Mitchell", null, descriptionUserThird,
|
||||||
"group-3", List.of("group-2"), List.of("group-2", "group-3"), List.of("group-2"),
|
"group-3", List.of("group-2"), List.of("group-2", "group-3"), List.of("group-2"),
|
||||||
new ArrayList<>(), List.of("group-2"), false, true, true);
|
new ArrayList<>(), List.of("group-2"), false, true, true, false);
|
||||||
|
|
||||||
// create user 0 with the specified parameters
|
// create user 0 with the specified parameters
|
||||||
userService.createUser("Anonymous", null, descriptionUserZero, "",
|
userService.createUser("Anonymous", null, descriptionUserZero, "",
|
||||||
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
||||||
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
||||||
new ArrayList<>(), null, false, false);
|
new ArrayList<>(), null, false, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import com.onlyoffice.integration.documentserver.models.enums.Action;
|
|||||||
import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder;
|
import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder;
|
||||||
import com.onlyoffice.integration.entities.User;
|
import com.onlyoffice.integration.entities.User;
|
||||||
import com.onlyoffice.integration.dto.Mentions;
|
import com.onlyoffice.integration.dto.Mentions;
|
||||||
|
import com.onlyoffice.integration.dto.UserInfo;
|
||||||
import com.onlyoffice.integration.dto.Protect;
|
import com.onlyoffice.integration.dto.Protect;
|
||||||
import com.onlyoffice.integration.documentserver.models.enums.Type;
|
import com.onlyoffice.integration.documentserver.models.enums.Type;
|
||||||
import com.onlyoffice.integration.documentserver.models.filemodel.FileModel;
|
import com.onlyoffice.integration.documentserver.models.filemodel.FileModel;
|
||||||
@ -118,6 +119,8 @@ public class EditorController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
User user = optionalUser.get();
|
User user = optionalUser.get();
|
||||||
|
user.setImage(user.getAvatar() ? storagePathBuilder.getServerUrl(true) + "/css/img/uid-"
|
||||||
|
+ user.getId() + ".png" : null);
|
||||||
|
|
||||||
// get file model with the default file parameters
|
// get file model with the default file parameters
|
||||||
FileModel fileModel = fileConfigurer.getFileModel(
|
FileModel fileModel = fileConfigurer.getFileModel(
|
||||||
@ -152,8 +155,11 @@ public class EditorController {
|
|||||||
// get user data for mentions and add it to the model
|
// get user data for mentions and add it to the model
|
||||||
model.addAttribute("usersForMentions", getUserMentions(uid));
|
model.addAttribute("usersForMentions", getUserMentions(uid));
|
||||||
|
|
||||||
|
model.addAttribute("usersInfo", getUsersInfo(uid));
|
||||||
|
|
||||||
// get user data for protect and add it to the model
|
// get user data for protect and add it to the model
|
||||||
model.addAttribute("usersForProtect", getUserProtect(uid));
|
model.addAttribute("usersForProtect", getUserProtect(uid));
|
||||||
|
|
||||||
return "editor.html";
|
return "editor.html";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,6 +179,19 @@ public class EditorController {
|
|||||||
return usersForMentions;
|
return usersForMentions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<UserInfo> getUsersInfo(final String uid) { // get user data for mentions
|
||||||
|
List<UserInfo> usersInfo = new ArrayList<>();
|
||||||
|
if (uid != null && !uid.equals("4")) {
|
||||||
|
List<User> list = userService.findAll();
|
||||||
|
for (User u : list) {
|
||||||
|
String image = u.getAvatar() ? storagePathBuilder.getServerUrl(true) + "/css/img/uid-"
|
||||||
|
+ u.getId() + ".png" : null;
|
||||||
|
usersInfo.add(new UserInfo(u.getId(), u.getName(), u.getEmail(), image));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return usersInfo;
|
||||||
|
}
|
||||||
|
|
||||||
private List<Protect> getUserProtect(final String uid) { // get user data for protect
|
private List<Protect> getUserProtect(final String uid) { // get user data for protect
|
||||||
List<Protect> usersForProtect = new ArrayList<>();
|
List<Protect> usersForProtect = new ArrayList<>();
|
||||||
if (uid != null && !uid.equals("4")) {
|
if (uid != null && !uid.equals("4")) {
|
||||||
@ -189,6 +208,7 @@ public class EditorController {
|
|||||||
return usersForProtect;
|
return usersForProtect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private String getInsertImage(final Boolean directUrl) { // get an image that will be inserted into the document
|
private String getInsertImage(final Boolean directUrl) { // get an image that will be inserted into the document
|
||||||
Map<String, Object> dataInsertImage = new HashMap<>();
|
Map<String, Object> dataInsertImage = new HashMap<>();
|
||||||
|
|||||||
@ -19,6 +19,8 @@
|
|||||||
package com.onlyoffice.integration.documentserver.models.filemodel;
|
package com.onlyoffice.integration.documentserver.models.filemodel;
|
||||||
|
|
||||||
import com.onlyoffice.integration.documentserver.models.AbstractModel;
|
import com.onlyoffice.integration.documentserver.models.AbstractModel;
|
||||||
|
import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
@ -29,14 +31,17 @@ import org.springframework.stereotype.Component;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class User extends AbstractModel {
|
public class User extends AbstractModel {
|
||||||
|
private FileStoragePathBuilder storagePathBuilder;
|
||||||
private String id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
private String group;
|
private String group;
|
||||||
|
private String image;
|
||||||
|
|
||||||
// the user configuration parameters
|
// the user configuration parameters
|
||||||
public void configure(final int idParam, final String nameParam, final String groupParam) {
|
public void configure(final int idParam, final String nameParam, final String groupParam) {
|
||||||
this.id = "uid-" + idParam; // the user id
|
this.id = "uid-" + idParam; // the user id
|
||||||
this.name = nameParam; // the user name
|
this.name = nameParam; // the user name
|
||||||
this.group = groupParam; // the group the user belongs to
|
this.group = groupParam; // the group the user belongs to
|
||||||
|
this.image = storagePathBuilder.getServerUrl(true) + "/css/img/uid-" + this.id + ".png";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* (c) Copyright Ascensio System SIA 2023
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.onlyoffice.integration.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class UserInfo {
|
||||||
|
private Integer id;
|
||||||
|
private String name;
|
||||||
|
private String email;
|
||||||
|
private String image;
|
||||||
|
}
|
||||||
@ -45,4 +45,6 @@ public class User extends AbstractEntity {
|
|||||||
@ElementCollection
|
@ElementCollection
|
||||||
@CollectionTable(name = "user_descriptions")
|
@CollectionTable(name = "user_descriptions")
|
||||||
private List<String> descriptions;
|
private List<String> descriptions;
|
||||||
|
private Boolean avatar;
|
||||||
|
private String image;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,13 +58,15 @@ public class UserServices {
|
|||||||
final List<String> removeGroups,
|
final List<String> removeGroups,
|
||||||
final List<String> userInfoGroups, final Boolean favoriteDoc,
|
final List<String> userInfoGroups, final Boolean favoriteDoc,
|
||||||
final Boolean chat,
|
final Boolean chat,
|
||||||
final Boolean protect) {
|
final Boolean protect,
|
||||||
|
final Boolean avatar) {
|
||||||
User newUser = new User();
|
User newUser = new User();
|
||||||
newUser.setName(name); // set the user name
|
newUser.setName(name); // set the user name
|
||||||
newUser.setEmail(email); // set the user email
|
newUser.setEmail(email); // set the user email
|
||||||
newUser.setGroup(groupServices.createGroup(group)); // set the user group
|
newUser.setGroup(groupServices.createGroup(group)); // set the user group
|
||||||
newUser.setDescriptions(description); // set the user description
|
newUser.setDescriptions(description); // set the user description
|
||||||
newUser.setFavorite(favoriteDoc); // specify if the user has the favorite documents or not
|
newUser.setFavorite(favoriteDoc); // specify if the user has the favorite documents or not
|
||||||
|
newUser.setAvatar(avatar);
|
||||||
|
|
||||||
List<Group> groupsReview = groupServices
|
List<Group> groupsReview = groupServices
|
||||||
.createGroups(reviewGroups); // define the groups whose changes the user can accept/reject
|
.createGroups(reviewGroups); // define the groups whose changes the user can accept/reject
|
||||||
|
|||||||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
@ -283,6 +283,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var usersForMentions = [[${usersForMentions}]];
|
var usersForMentions = [[${usersForMentions}]];
|
||||||
|
var usersInfo = [[${usersInfo}]];
|
||||||
var usersForProtect = [[${usersForProtect}]];
|
var usersForProtect = [[${usersForProtect}]];
|
||||||
|
|
||||||
if (config.editorConfig.user.id != 4) {
|
if (config.editorConfig.user.id != 4) {
|
||||||
@ -292,6 +293,18 @@
|
|||||||
var c = event.data.c;
|
var c = event.data.c;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case "info":
|
||||||
|
users = [];
|
||||||
|
var allUsers = usersInfo;
|
||||||
|
for (var i = 0; i < event.data.id.length; i++) {
|
||||||
|
for (var j = 0; j < allUsers.length; j++) {
|
||||||
|
if (allUsers[j].id == event.data.id[i]) {
|
||||||
|
users.push(allUsers[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "protect":
|
case "protect":
|
||||||
var users = usersForProtect;
|
var users = usersForProtect;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -108,6 +108,8 @@ public class EditorServlet extends HttpServlet {
|
|||||||
List<Map<String, Object>> usersForMentions = Users.getUsersForMentions(user.getId());
|
List<Map<String, Object>> usersForMentions = Users.getUsersForMentions(user.getId());
|
||||||
List<Map<String, Object>> usersForProtect = Users.getUsersForProtect(user.getId());
|
List<Map<String, Object>> usersForProtect = Users.getUsersForProtect(user.getId());
|
||||||
|
|
||||||
|
List<Map<String, Object>> usersInfo = Users.getUsersInfo(user.getId());
|
||||||
|
|
||||||
// check if the document token is enabled
|
// check if the document token is enabled
|
||||||
if (DocumentManager.tokenEnabled()) {
|
if (DocumentManager.tokenEnabled()) {
|
||||||
file.buildToken(); // generate document token
|
file.buildToken(); // generate document token
|
||||||
@ -132,6 +134,7 @@ public class EditorServlet extends HttpServlet {
|
|||||||
request.setAttribute("dataSpreadsheet", gson.toJson(dataSpreadsheet));
|
request.setAttribute("dataSpreadsheet", gson.toJson(dataSpreadsheet));
|
||||||
request.setAttribute("usersForMentions", !user.getId()
|
request.setAttribute("usersForMentions", !user.getId()
|
||||||
.equals("uid-0") ? gson.toJson(usersForMentions) : null);
|
.equals("uid-0") ? gson.toJson(usersForMentions) : null);
|
||||||
|
request.setAttribute("usersInfo", gson.toJson(usersInfo));
|
||||||
request.setAttribute("usersForProtect", !user.getId()
|
request.setAttribute("usersForProtect", !user.getId()
|
||||||
.equals("uid-0") ? gson.toJson(usersForProtect) : null);
|
.equals("uid-0") ? gson.toJson(usersForProtect) : null);
|
||||||
request.getRequestDispatcher("editor.jsp").forward(request, response);
|
request.getRequestDispatcher("editor.jsp").forward(request, response);
|
||||||
|
|||||||
@ -111,6 +111,8 @@ public class FileModel {
|
|||||||
editorConfig.getUser().setId(!user.getId().equals("uid-0") ? user.getId() : null);
|
editorConfig.getUser().setId(!user.getId().equals("uid-0") ? user.getId() : null);
|
||||||
editorConfig.getUser().setName(user.getName());
|
editorConfig.getUser().setName(user.getName());
|
||||||
editorConfig.getUser().setGroup(user.getGroup());
|
editorConfig.getUser().setGroup(user.getGroup());
|
||||||
|
editorConfig.getUser().setImage(user.getAvatar() ? DocumentManager.getServerUrl(false)
|
||||||
|
+ "/css/img/" + user.getId() + ".png" : null);
|
||||||
|
|
||||||
// write the absolute URL to the file location
|
// write the absolute URL to the file location
|
||||||
editorConfig.getCustomization().getGoback()
|
editorConfig.getCustomization().getGoback()
|
||||||
@ -521,6 +523,7 @@ public class FileModel {
|
|||||||
private String id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
private String group;
|
private String group;
|
||||||
|
private String image;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -545,6 +548,10 @@ public class FileModel {
|
|||||||
public void setGroup(final String groupParam) {
|
public void setGroup(final String groupParam) {
|
||||||
this.group = groupParam;
|
this.group = groupParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setImage(final String imageParam) {
|
||||||
|
this.image = imageParam;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// customization parameters
|
// customization parameters
|
||||||
|
|||||||
@ -32,12 +32,13 @@ public class User {
|
|||||||
private final List<String> descriptions;
|
private final List<String> descriptions;
|
||||||
private final Boolean templates;
|
private final Boolean templates;
|
||||||
private final List<String> userInfoGroups;
|
private final List<String> userInfoGroups;
|
||||||
|
private final Boolean avatar;
|
||||||
|
|
||||||
public User(final String idParam, final String nameParam, final String emailParam, final String groupParam,
|
public User(final String idParam, final String nameParam, final String emailParam, final String groupParam,
|
||||||
final List<String> reviewGroupsParam, final CommentGroups commentGroupsParam,
|
final List<String> reviewGroupsParam, final CommentGroups commentGroupsParam,
|
||||||
final List<String> userInfoGroupsParam, final Boolean favoriteParam,
|
final List<String> userInfoGroupsParam, final Boolean favoriteParam,
|
||||||
final List<String> deniedPermissionsParam, final List<String> descriptionsParam,
|
final List<String> deniedPermissionsParam, final List<String> descriptionsParam,
|
||||||
final Boolean templatesParam) {
|
final Boolean templatesParam, final Boolean avatarParam) {
|
||||||
this.id = idParam;
|
this.id = idParam;
|
||||||
this.name = nameParam;
|
this.name = nameParam;
|
||||||
this.email = emailParam;
|
this.email = emailParam;
|
||||||
@ -49,6 +50,7 @@ public class User {
|
|||||||
this.descriptions = descriptionsParam;
|
this.descriptions = descriptionsParam;
|
||||||
this.templates = templatesParam;
|
this.templates = templatesParam;
|
||||||
this.userInfoGroups = userInfoGroupsParam;
|
this.userInfoGroups = userInfoGroupsParam;
|
||||||
|
this.avatar = avatarParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
@ -94,4 +96,8 @@ public class User {
|
|||||||
public List<String> getUserInfoGroups() {
|
public List<String> getUserInfoGroups() {
|
||||||
return userInfoGroups;
|
return userInfoGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getAvatar() {
|
||||||
|
return avatar;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ public final class Users {
|
|||||||
add("The file favorite state is undefined");
|
add("The file favorite state is undefined");
|
||||||
add("Can create files from templates using data from the editor");
|
add("Can create files from templates using data from the editor");
|
||||||
add("Can see the information about all users");
|
add("Can see the information about all users");
|
||||||
|
add("Has an avatar");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private static List<String> descriptionUserSecond = new ArrayList<String>() {{
|
private static List<String> descriptionUserSecond = new ArrayList<String>() {{
|
||||||
@ -47,6 +48,7 @@ public final class Users {
|
|||||||
add("This file is marked as favorite");
|
add("This file is marked as favorite");
|
||||||
add("Can create new files from the editor");
|
add("Can create new files from the editor");
|
||||||
add("Can see the information about users from Group2 and users who don’t belong to any group");
|
add("Can see the information about users from Group2 and users who don’t belong to any group");
|
||||||
|
add("Has an avatar");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private static List<String> descriptionUserThird = new ArrayList<String>() {{
|
private static List<String> descriptionUserThird = new ArrayList<String>() {{
|
||||||
@ -79,19 +81,19 @@ public final class Users {
|
|||||||
private static List<User> users = new ArrayList<User>() {{
|
private static List<User> users = new ArrayList<User>() {{
|
||||||
add(new User("uid-1", "John Smith", "smith@example.com",
|
add(new User("uid-1", "John Smith", "smith@example.com",
|
||||||
"", null, new CommentGroups(), null,
|
"", null, new CommentGroups(), null,
|
||||||
null, new ArrayList<String>(), descriptionUserFirst, true));
|
null, new ArrayList<String>(), descriptionUserFirst, true, true));
|
||||||
add(new User("uid-2", "Mark Pottato", "pottato@example.com",
|
add(new User("uid-2", "Mark Pottato", "pottato@example.com",
|
||||||
"group-2", Arrays.asList("group-2", ""), new CommentGroups(null,
|
"group-2", Arrays.asList("group-2", ""), new CommentGroups(null,
|
||||||
Arrays.asList("group-2", ""), Arrays.asList("group-2")), Arrays.asList("group-2", ""),
|
Arrays.asList("group-2", ""), Arrays.asList("group-2")), Arrays.asList("group-2", ""),
|
||||||
true, new ArrayList<String>(), descriptionUserSecond, false));
|
true, new ArrayList<String>(), descriptionUserSecond, false, true));
|
||||||
add(new User("uid-3", "Hamish Mitchell", null,
|
add(new User("uid-3", "Hamish Mitchell", null,
|
||||||
"group-3", Arrays.asList("group-2"), new CommentGroups(Arrays.asList("group-3", "group-2"),
|
"group-3", Arrays.asList("group-2"), new CommentGroups(Arrays.asList("group-3", "group-2"),
|
||||||
Arrays.asList("group-2"), null), Arrays.asList("group-2"),
|
Arrays.asList("group-2"), null), Arrays.asList("group-2"),
|
||||||
false, Arrays.asList("copy", "download", "print"),
|
false, Arrays.asList("copy", "download", "print"),
|
||||||
descriptionUserThird, false));
|
descriptionUserThird, false, false));
|
||||||
add(new User("uid-0", null, null,
|
add(new User("uid-0", null, null,
|
||||||
"", null, null, null,
|
"", null, null, null,
|
||||||
null, Arrays.asList("protect"), descriptionUserZero, false));
|
null, Arrays.asList("protect"), descriptionUserZero, false, false));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private Users() { }
|
private Users() { }
|
||||||
@ -125,6 +127,22 @@ public final class Users {
|
|||||||
return usersData;
|
return usersData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<Map<String, Object>> getUsersInfo(final String id) {
|
||||||
|
List<Map<String, Object>> usersData = new ArrayList<>();
|
||||||
|
if (id != "uid-0") {
|
||||||
|
for (User user : users) {
|
||||||
|
Map<String, Object> data = new HashMap<>();
|
||||||
|
data.put("id", user.getId());
|
||||||
|
data.put("name", user.getName());
|
||||||
|
data.put("email", user.getEmail());
|
||||||
|
data.put("image", user.getAvatar() ? DocumentManager.getServerUrl(false)
|
||||||
|
+ "/css/img/" + user.getId() + ".png" : null);
|
||||||
|
usersData.add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return usersData;
|
||||||
|
}
|
||||||
|
|
||||||
// get a list of users with their names and emails for protect
|
// get a list of users with their names and emails for protect
|
||||||
public static List<Map<String, Object>> getUsersForProtect(final String id) {
|
public static List<Map<String, Object>> getUsersForProtect(final String id) {
|
||||||
List<Map<String, Object>> usersData = new ArrayList<>();
|
List<Map<String, Object>> usersData = new ArrayList<>();
|
||||||
|
|||||||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
@ -283,6 +283,7 @@
|
|||||||
|
|
||||||
<%
|
<%
|
||||||
String usersForMentions = (String) request.getAttribute("usersForMentions");
|
String usersForMentions = (String) request.getAttribute("usersForMentions");
|
||||||
|
String usersInfo = (String) request.getAttribute("usersInfo");
|
||||||
String usersForProtect = (String) request.getAttribute("usersForProtect");
|
String usersForProtect = (String) request.getAttribute("usersForProtect");
|
||||||
%>
|
%>
|
||||||
|
|
||||||
@ -293,6 +294,18 @@
|
|||||||
var c = event.data.c;
|
var c = event.data.c;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case "info":
|
||||||
|
users = [];
|
||||||
|
var allUsers = <%=usersInfo%>;
|
||||||
|
for (var i = 0; i < event.data.id.length; i++) {
|
||||||
|
for (var j = 0; j < allUsers.length; j++) {
|
||||||
|
if (allUsers[j].id == event.data.id[i]) {
|
||||||
|
users.push(allUsers[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "protect":
|
case "protect":
|
||||||
var users = <%=usersForProtect%>;
|
var users = <%=usersForProtect%>;
|
||||||
break;
|
break;
|
||||||
|
|||||||
BIN
web/documentserver-example/nodejs/public/images/uid-1.jpg
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
web/documentserver-example/nodejs/public/images/uid-2.jpg
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
web/documentserver-example/php/assets/images/uid-1.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
web/documentserver-example/php/assets/images/uid-2.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
@ -147,10 +147,7 @@ class FormatManager
|
|||||||
$formats = $this->all();
|
$formats = $this->all();
|
||||||
$filtered = [];
|
$filtered = [];
|
||||||
foreach ($formats as $format) {
|
foreach ($formats as $format) {
|
||||||
if ($format->type === 'cell' and in_array('xlsx', $format->convert) or
|
if (in_array('auto-convert', $format->actions)) {
|
||||||
$format->type === 'slide' and in_array('pptx', $format->convert) or
|
|
||||||
$format->type === 'word' and in_array('docx', $format->convert)
|
|
||||||
) {
|
|
||||||
$filtered[] = $format;
|
$filtered[] = $format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ final class ExampleUsers
|
|||||||
"The file favorite state is undefined",
|
"The file favorite state is undefined",
|
||||||
"Can create files from templates using data from the editor",
|
"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",
|
||||||
];
|
];
|
||||||
$this->user2Description = [
|
$this->user2Description = [
|
||||||
"Belongs to Group2",
|
"Belongs to Group2",
|
||||||
@ -47,6 +48,7 @@ final class ExampleUsers
|
|||||||
"This file is marked as favorite",
|
"This file is marked as favorite",
|
||||||
"Can create new files from the editor",
|
"Can create new files from the editor",
|
||||||
"Can see the information about users from Group2 and users who don’t belong to any group",
|
"Can see the information about users from Group2 and users who don’t belong to any group",
|
||||||
|
"Has an avatar",
|
||||||
];
|
];
|
||||||
$this->user3Description = [
|
$this->user3Description = [
|
||||||
"Belongs to Group3",
|
"Belongs to Group3",
|
||||||
@ -84,6 +86,7 @@ final class ExampleUsers
|
|||||||
null,
|
null,
|
||||||
[],
|
[],
|
||||||
$this->user1Description,
|
$this->user1Description,
|
||||||
|
true,
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
new Users(
|
new Users(
|
||||||
@ -101,7 +104,8 @@ final class ExampleUsers
|
|||||||
true,
|
true,
|
||||||
[],
|
[],
|
||||||
$this->user2Description,
|
$this->user2Description,
|
||||||
false
|
false,
|
||||||
|
true
|
||||||
),
|
),
|
||||||
new Users(
|
new Users(
|
||||||
"uid-3",
|
"uid-3",
|
||||||
@ -118,6 +122,7 @@ final class ExampleUsers
|
|||||||
false,
|
false,
|
||||||
["copy", "download", "print"],
|
["copy", "download", "print"],
|
||||||
$this->user3Description,
|
$this->user3Description,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
new Users(
|
new Users(
|
||||||
@ -131,6 +136,7 @@ final class ExampleUsers
|
|||||||
null,
|
null,
|
||||||
["protect"],
|
["protect"],
|
||||||
$this->user0Description,
|
$this->user0Description,
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|||||||
@ -32,6 +32,8 @@ final class Users
|
|||||||
public ?bool $templates;
|
public ?bool $templates;
|
||||||
public ?array $userInfoGroups;
|
public ?array $userInfoGroups;
|
||||||
|
|
||||||
|
public ?bool $avatar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -46,6 +48,7 @@ final class Users
|
|||||||
* @param array|null $deniedPermissions
|
* @param array|null $deniedPermissions
|
||||||
* @param array|null $descriptions
|
* @param array|null $descriptions
|
||||||
* @param bool|null $templates
|
* @param bool|null $templates
|
||||||
|
* @param bool|null $avatar
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -60,7 +63,8 @@ final class Users
|
|||||||
?bool $favorite,
|
?bool $favorite,
|
||||||
?array $deniedPermissions,
|
?array $deniedPermissions,
|
||||||
?array $descriptions,
|
?array $descriptions,
|
||||||
?bool $templates
|
?bool $templates,
|
||||||
|
?bool $avatar
|
||||||
) {
|
) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
@ -73,5 +77,6 @@ final class Users
|
|||||||
$this->descriptions = $descriptions;
|
$this->descriptions = $descriptions;
|
||||||
$this->templates = $templates;
|
$this->templates = $templates;
|
||||||
$this->userInfoGroups = $userInfoGroups;
|
$this->userInfoGroups = $userInfoGroups;
|
||||||
|
$this->avatar = $avatar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,6 +161,7 @@ final class DocEditorView extends View
|
|||||||
"id" => $user->id != "uid-0" ? $user->id : null,
|
"id" => $user->id != "uid-0" ? $user->id : null,
|
||||||
"name" => $user->name,
|
"name" => $user->name,
|
||||||
"group" => $user->group,
|
"group" => $user->group,
|
||||||
|
"image" => $user->avatar ? serverPath(true) . "/assets/images/" . $user->id . ".png" : null
|
||||||
],
|
],
|
||||||
"embedded" => [ // the parameters for the embedded document type
|
"embedded" => [ // the parameters for the embedded document type
|
||||||
// the absolute URL that will allow the document to be saved onto the user personal computer
|
// the absolute URL that will allow the document to be saved onto the user personal computer
|
||||||
@ -220,9 +221,19 @@ final class DocEditorView extends View
|
|||||||
|
|
||||||
// users data for mentions
|
// users data for mentions
|
||||||
$usersForMentions = $user->id != "uid-0" ? $userList->getUsersForMentions($user->id) : null;
|
$usersForMentions = $user->id != "uid-0" ? $userList->getUsersForMentions($user->id) : null;
|
||||||
|
|
||||||
// users data for protect
|
// users data for protect
|
||||||
$usersForProtect = $user->id != "uid-0" ? $userList->getUsersForProtect($user->id) : null;
|
$usersForProtect = $user->id != "uid-0" ? $userList->getUsersForProtect($user->id) : null;
|
||||||
|
|
||||||
|
$usersInfo = [];
|
||||||
|
if ($user->id != 'uid-0') {
|
||||||
|
foreach ($userList->getAllUsers() as $userInfo) {
|
||||||
|
$u = $userInfo;
|
||||||
|
$u->image = $userInfo->avatar ? serverPath(true) . "/assets/images/" . $userInfo->id . ".png" : null;
|
||||||
|
array_push($usersInfo, $u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if the secret key to generate token exists
|
// check if the secret key to generate token exists
|
||||||
if ($jwtManager->isJwtEnabled()) {
|
if ($jwtManager->isJwtEnabled()) {
|
||||||
$config["token"] = $jwtManager->jwtEncode($config); // encode config into the token
|
$config["token"] = $jwtManager->jwtEncode($config); // encode config into the token
|
||||||
@ -242,6 +253,18 @@ final class DocEditorView extends View
|
|||||||
var c = event.data.c;
|
var c = event.data.c;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case \"info\":
|
||||||
|
users = [];
|
||||||
|
var allUsers = {usersInfo};
|
||||||
|
for (var i = 0; i < event.data.id.length; i++) {
|
||||||
|
for (var j = 0; j < allUsers.length; j++) {
|
||||||
|
if (allUsers[j].id == event.data.id[i]) {
|
||||||
|
users.push(allUsers[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case \"protect\":
|
case \"protect\":
|
||||||
var users = {usersForProtect};
|
var users = {usersForProtect};
|
||||||
break;
|
break;
|
||||||
@ -278,6 +301,7 @@ final class DocEditorView extends View
|
|||||||
"config" => json_encode($config),
|
"config" => json_encode($config),
|
||||||
"history" => $historyLayout,
|
"history" => $historyLayout,
|
||||||
"usersForMentions" => json_encode($usersForMentions),
|
"usersForMentions" => json_encode($usersForMentions),
|
||||||
|
"usersInfo" => json_encode($usersInfo),
|
||||||
"usersForProtect" => json_encode($usersForProtect),
|
"usersForProtect" => json_encode($usersForProtect),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,9 +77,7 @@ class FormatManager():
|
|||||||
formats = self.all()
|
formats = self.all()
|
||||||
filtered = filter(
|
filtered = filter(
|
||||||
lambda format: (
|
lambda format: (
|
||||||
format.type == 'cell' and 'xlsx' in format.convert or
|
'auto-convert' in format.actions
|
||||||
format.type == 'slide' and 'pptx' in format.convert or
|
|
||||||
format.type == 'word' and 'docx' in format.convert
|
|
||||||
),
|
),
|
||||||
formats
|
formats
|
||||||
)
|
)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ from typing import Optional
|
|||||||
|
|
||||||
class User:
|
class User:
|
||||||
def __init__(self, uid, name, email, group, reviewGroups, commentGroups, userInfoGroups, favorite,
|
def __init__(self, uid, name, email, group, reviewGroups, commentGroups, userInfoGroups, favorite,
|
||||||
deniedPermissions, descriptions, templates):
|
deniedPermissions, descriptions, templates, avatar):
|
||||||
self.id = uid
|
self.id = uid
|
||||||
self.name = name
|
self.name = name
|
||||||
self.email = email
|
self.email = email
|
||||||
@ -33,6 +33,7 @@ class User:
|
|||||||
self.descriptions = descriptions
|
self.descriptions = descriptions
|
||||||
self.templates = templates
|
self.templates = templates
|
||||||
self.userInfoGroups = userInfoGroups
|
self.userInfoGroups = userInfoGroups
|
||||||
|
self.avatar = avatar
|
||||||
|
|
||||||
|
|
||||||
descr_user_1 = [
|
descr_user_1 = [
|
||||||
@ -42,7 +43,8 @@ descr_user_1 = [
|
|||||||
"Can perform all actions with comments",
|
"Can perform all actions with comments",
|
||||||
"The file favorite state is undefined",
|
"The file favorite state is undefined",
|
||||||
"Can create files from templates using data from the editor",
|
"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 = [
|
descr_user_2 = [
|
||||||
@ -52,7 +54,8 @@ descr_user_2 = [
|
|||||||
"Can remove his own comments only"),
|
"Can remove his own comments only"),
|
||||||
"This file is marked as favorite",
|
"This file is marked as favorite",
|
||||||
"Can create new files from the editor",
|
"Can create new files from the editor",
|
||||||
"Can see the information about users from Group2 and users who don’t belong to any group"
|
"Can see the information about users from Group2 and users who don’t belong to any group",
|
||||||
|
"Has an avatar"
|
||||||
]
|
]
|
||||||
|
|
||||||
descr_user_3 = [
|
descr_user_3 = [
|
||||||
@ -85,7 +88,7 @@ descr_user_0 = [
|
|||||||
USERS = [
|
USERS = [
|
||||||
User('uid-1', 'John Smith', 'smith@example.com',
|
User('uid-1', 'John Smith', 'smith@example.com',
|
||||||
'', None, {}, None,
|
'', None, {}, None,
|
||||||
None, [], descr_user_1, True),
|
None, [], descr_user_1, True, True),
|
||||||
User('uid-2', 'Mark Pottato', 'pottato@example.com',
|
User('uid-2', 'Mark Pottato', 'pottato@example.com',
|
||||||
'group-2', ['group-2', ''], {
|
'group-2', ['group-2', ''], {
|
||||||
'view': "",
|
'view': "",
|
||||||
@ -93,17 +96,17 @@ USERS = [
|
|||||||
'remove': ["group-2"]
|
'remove': ["group-2"]
|
||||||
},
|
},
|
||||||
['group-2', ''],
|
['group-2', ''],
|
||||||
True, [], descr_user_2, False),
|
True, [], descr_user_2, False, True),
|
||||||
User('uid-3', 'Hamish Mitchell', None,
|
User('uid-3', 'Hamish Mitchell', None,
|
||||||
'group-3', ['group-2'], {
|
'group-3', ['group-2'], {
|
||||||
'view': ["group-3", "group-2"],
|
'view': ["group-3", "group-2"],
|
||||||
'edit': ["group-2"],
|
'edit': ["group-2"],
|
||||||
'remove': []
|
'remove': []
|
||||||
}, ['group-2'],
|
}, ['group-2'],
|
||||||
False, ["copy", "download", "print"], descr_user_3, False),
|
False, ["copy", "download", "print"], descr_user_3, False, False),
|
||||||
User('uid-0', None, None,
|
User('uid-0', None, None,
|
||||||
'', None, {}, [],
|
'', None, {}, [],
|
||||||
None, ["protect"], descr_user_0, False)
|
None, ["protect"], descr_user_0, False, False)
|
||||||
]
|
]
|
||||||
|
|
||||||
DEFAULT_USER = USERS[0]
|
DEFAULT_USER = USERS[0]
|
||||||
|
|||||||
@ -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,
|
if meta: # if the document meta data exists,
|
||||||
infObj = { # write author and creation time parameters to the information object
|
infObj = { # write author and creation time parameters to the information object
|
||||||
'owner': meta['uname'],
|
'owner': meta['uname'],
|
||||||
@ -293,7 +303,9 @@ def edit(request):
|
|||||||
'user': { # the user currently viewing or editing the document
|
'user': { # the user currently viewing or editing the document
|
||||||
'id': user.id if user.id != 'uid-0' else None,
|
'id': user.id if user.id != 'uid-0' else None,
|
||||||
'name': user.name,
|
'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
|
'embedded': { # the parameters for the embedded document type
|
||||||
# the absolute URL that will allow the document to be saved onto the user personal computer
|
# 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
|
'dataDocument': dataDocument, # document which will be compared with the current document
|
||||||
'dataSpreadsheet': json.dumps(dataSpreadsheet), # recipient data for mail merging
|
'dataSpreadsheet': json.dumps(dataSpreadsheet), # recipient data for mail merging
|
||||||
'usersForMentions': json.dumps(usersForMentions) if user.id != 'uid-0' else None,
|
'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
|
return render(request, 'editor.html', context) # execute the "editor.html" template with context data
|
||||||
|
|
||||||
|
|||||||
BIN
web/documentserver-example/python/static/images/uid-1.jpg
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
web/documentserver-example/python/static/images/uid-2.jpg
Normal file
|
After Width: | Height: | Size: 76 KiB |
@ -289,6 +289,18 @@
|
|||||||
var c = event.data.c;
|
var c = event.data.c;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case "info":
|
||||||
|
users = [];
|
||||||
|
var allUsers = {{ usersInfo | safe }};
|
||||||
|
for (var i = 0; i < event.data.id.length; i++) {
|
||||||
|
for (var j = 0; j < allUsers.length; j++) {
|
||||||
|
if (allUsers[j].id == event.data.id[i]) {
|
||||||
|
users.push(allUsers[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "protect":
|
case "protect":
|
||||||
var users = {{ usersForProtect | safe }};
|
var users = {{ usersForProtect | safe }};
|
||||||
break;
|
break;
|
||||||
|
|||||||
BIN
web/documentserver-example/ruby/app/assets/images/uid-1.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
web/documentserver-example/ruby/app/assets/images/uid-2.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
@ -88,9 +88,7 @@ class FormatManager
|
|||||||
sig { returns(T::Array[Format]) }
|
sig { returns(T::Array[Format]) }
|
||||||
def convertible
|
def convertible
|
||||||
all.filter do |format|
|
all.filter do |format|
|
||||||
format.type == 'cell' && format.convert.include?('xlsx') ||
|
format.actions.include?('auto-convert')
|
||||||
format.type == 'slide' && format.convert.include?('pptx') ||
|
|
||||||
format.type == 'word' && format.convert.include?('docx')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -158,7 +158,8 @@ class FileModel
|
|||||||
:user => { # the user currently viewing or editing the document
|
:user => { # the user currently viewing or editing the document
|
||||||
:id => !@user.id.eql?("uid-0") ? @user.id : nil,
|
:id => !@user.id.eql?("uid-0") ? @user.id : nil,
|
||||||
:name => @user.name,
|
:name => @user.name,
|
||||||
:group => @user.group
|
:group => @user.group,
|
||||||
|
:image => @user.avatar ? "#{DocumentHelper.get_server_url(true)}/assets/#{@user.id}.png" : nil
|
||||||
},
|
},
|
||||||
:embedded => { # the parameters for the embedded document type
|
:embedded => { # the parameters for the embedded document type
|
||||||
:saveUrl => download_url(false), # the absolute URL that will allow the document to be saved onto the user personal computer
|
:saveUrl => download_url(false), # the absolute URL that will allow the document to be saved onto the user personal computer
|
||||||
@ -350,6 +351,31 @@ class FileModel
|
|||||||
return !@user.id.eql?("uid-0") ? Users.get_users_for_mentions(@user.id) : nil
|
return !@user.id.eql?("uid-0") ? Users.get_users_for_mentions(@user.id) : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_users_info
|
||||||
|
users_info = []
|
||||||
|
if !@user.id.eql?("uid-0")
|
||||||
|
Users.get_all_users().each do |user_info|
|
||||||
|
u = {
|
||||||
|
id: user_info.id,
|
||||||
|
name: user_info.name,
|
||||||
|
email: user_info.email,
|
||||||
|
group: user_info.group,
|
||||||
|
reviewGroups: user_info.reviewGroups,
|
||||||
|
commentGroups: user_info.commentGroups,
|
||||||
|
userInfoGroups: user_info.userInfoGroups,
|
||||||
|
favorite: user_info.favorite,
|
||||||
|
deniedPermissions: user_info.deniedPermissions,
|
||||||
|
descriptions: user_info.descriptions,
|
||||||
|
templates: user_info.templates,
|
||||||
|
avatar: user_info.avatar
|
||||||
|
}
|
||||||
|
u["image"] = user_info.avatar ? "#{DocumentHelper.get_server_url(true)}/assets/#{user_info.id}.png" : nil
|
||||||
|
users_info.push(u)
|
||||||
|
end
|
||||||
|
return users_info
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# get users data for protect
|
# get users data for protect
|
||||||
def get_users_protect
|
def get_users_protect
|
||||||
return !@user.id.eql?("uid-0") ? Users.get_users_for_protect(@user.id) : nil
|
return !@user.id.eql?("uid-0") ? Users.get_users_for_protect(@user.id) : nil
|
||||||
|
|||||||
@ -15,9 +15,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
class User
|
class User
|
||||||
attr_accessor :id, :name, :email, :group, :reviewGroups, :commentGroups, :userInfoGroups, :favorite, :deniedPermissions, :descriptions, :templates
|
attr_accessor :id, :name, :email, :group, :reviewGroups, :commentGroups, :userInfoGroups, :favorite,
|
||||||
|
:deniedPermissions, :descriptions, :templates, :avatar
|
||||||
|
|
||||||
def initialize (id, name, email, group, reviewGroups, commentGroups, userInfoGroups, favorite, deniedPermissions, descriptions, templates)
|
def initialize (id, name, email, group, reviewGroups, commentGroups, userInfoGroups, favorite,
|
||||||
|
deniedPermissions, descriptions, templates, avatar)
|
||||||
@id = id
|
@id = id
|
||||||
@name = name
|
@name = name
|
||||||
@email = email
|
@email = email
|
||||||
@ -29,6 +31,7 @@ class User
|
|||||||
@descriptions = descriptions
|
@descriptions = descriptions
|
||||||
@templates = templates
|
@templates = templates
|
||||||
@userInfoGroups = userInfoGroups
|
@userInfoGroups = userInfoGroups
|
||||||
|
@avatar = avatar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -40,7 +43,8 @@ class Users
|
|||||||
"Can perform all actions with comments",
|
"Can perform all actions with comments",
|
||||||
"The file favorite state is undefined",
|
"The file favorite state is undefined",
|
||||||
"Can create files from templates using data from the editor",
|
"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 = [
|
@@descr_user_2 = [
|
||||||
@ -49,7 +53,8 @@ class Users
|
|||||||
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
|
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
|
||||||
"This file is marked as favorite",
|
"This file is marked as favorite",
|
||||||
"Can create new files from the editor",
|
"Can create new files from the editor",
|
||||||
"Can see the information about users from Group2 and users who don’t belong to any group"
|
"Can see the information about users from Group2 and users who don’t belong to any group",
|
||||||
|
"Has an avatar",
|
||||||
];
|
];
|
||||||
|
|
||||||
@@descr_user_3 = [
|
@@descr_user_3 = [
|
||||||
@ -82,7 +87,7 @@ class Users
|
|||||||
@@users = [
|
@@users = [
|
||||||
User.new("uid-1", "John Smith", "smith@example.com",
|
User.new("uid-1", "John Smith", "smith@example.com",
|
||||||
"", nil, {}, nil,
|
"", nil, {}, nil,
|
||||||
nil, [], @@descr_user_1, true),
|
nil, [], @@descr_user_1, true, true),
|
||||||
User.new("uid-2", "Mark Pottato", "pottato@example.com",
|
User.new("uid-2", "Mark Pottato", "pottato@example.com",
|
||||||
"group-2", ["group-2", ""], {
|
"group-2", ["group-2", ""], {
|
||||||
:view => "",
|
:view => "",
|
||||||
@ -90,7 +95,7 @@ class Users
|
|||||||
:remove => ["group-2"]
|
:remove => ["group-2"]
|
||||||
},
|
},
|
||||||
["group-2", ""],
|
["group-2", ""],
|
||||||
true, [], @@descr_user_2, false),
|
true, [], @@descr_user_2, false, true),
|
||||||
User.new("uid-3", "Hamish Mitchell", nil,
|
User.new("uid-3", "Hamish Mitchell", nil,
|
||||||
"group-3", ["group-2"], {
|
"group-3", ["group-2"], {
|
||||||
:view => ["group-3", "group-2"],
|
:view => ["group-3", "group-2"],
|
||||||
@ -98,10 +103,10 @@ class Users
|
|||||||
:remove => []
|
:remove => []
|
||||||
},
|
},
|
||||||
["group-2"],
|
["group-2"],
|
||||||
false, ["copy", "download", "print"], @@descr_user_3, false),
|
false, ["copy", "download", "print"], @@descr_user_3, false, false),
|
||||||
User.new("uid-0", nil, nil,
|
User.new("uid-0", nil, nil,
|
||||||
"", nil, {}, [],
|
"", nil, {}, [],
|
||||||
nil, ["protect"], @@descr_user_0, false)
|
nil, ["protect"], @@descr_user_0, false, false)
|
||||||
]
|
]
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|||||||
@ -268,6 +268,18 @@
|
|||||||
var c = event.data.c;
|
var c = event.data.c;
|
||||||
}
|
}
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case "info":
|
||||||
|
users = [];
|
||||||
|
var allUsers = <%= raw @file.get_users_info.to_json %>;
|
||||||
|
for (var i = 0; i < event.data.id.length; i++) {
|
||||||
|
for (var j = 0; j < allUsers.length; j++) {
|
||||||
|
if (allUsers[j].id == event.data.id[i]) {
|
||||||
|
users.push(allUsers[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "protect":
|
case "protect":
|
||||||
var users = <%= raw @file.get_users_protect.to_json %>;
|
var users = <%= raw @file.get_users_protect.to_json %>;
|
||||||
break;
|
break;
|
||||||
|
|||||||