java-spring: added Anonymous(uid-4), set default person John, fix favorite

This commit is contained in:
Oleg Sinizin
2021-07-12 11:26:22 +03:00
parent c28ded60a0
commit 38cf6c333d
4 changed files with 18 additions and 6 deletions

View File

@ -97,7 +97,7 @@ public class EditorController {
dataMailMergeRecipients.put("url", documentManager.getServerUrl(true) + "/csv");
List<UserForMention> usersForMentions=new ArrayList<>();
if(uid!=null && !uid.equals("0")) {
if(uid!=null && !uid.equals("4")) {
List<User> list = userService.findAll();
for (User u : list) {
if (u.getName()!=null &&u.getEmail()!=null && u.getId()!=Integer.parseInt(uid)) {

View File

@ -62,6 +62,15 @@ public class IndexController {
@PostConstruct
private void init(){
List<String> description_user_0=List.of(
"The name is requested when the editor is opened",
"Doesnt belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"The file favorite state is undefined",
"Can't mention others in comments",
"Can't create new files from the editor"
);
List<String> description_user_1 = List.of(
"File author by default",
"He doesnt belong to any of the groups",
@ -98,6 +107,8 @@ public class IndexController {
userService.createUser("Hamish Mitchell", "mitchell@mail.ru",
description_user_3, "group-3", List.of("group-2"), List.of("group-2", "group-3"),
List.of("group-2"), new ArrayList<>(),false);
userService.createUser("Anonymous",null,description_user_0,null,
null,null,null,null,null);
}

View File

@ -24,7 +24,7 @@ import org.springframework.stereotype.Component;
@Component
@Scope("prototype")
public class Info {
private Boolean favorite;
private Boolean favorite = null;
public Boolean getFavorite() {
return favorite;

View File

@ -64,17 +64,18 @@ public class Document {
this.info = applicationContext.getBean(Info.class);
this.permissions = permissions;
switch (uid){
case "uid-0":{
this.info.setFavorite(null);
}
case "uid-1":{
case "uid-4":
case "uid-1": {
this.info.setFavorite(null);
break;
}
case "uid-2":{
this.info.setFavorite(true);
break;
}
case "uid-3":{
this.info.setFavorite(false);
break;
}
}
}