1 |
26600
|
sandro.lab
|
package eu.dnetlib.functionality.modular.ui;
|
2 |
|
|
|
3 |
|
|
import java.util.List;
|
4 |
|
|
import java.util.Map;
|
5 |
|
|
|
6 |
|
|
import javax.servlet.http.HttpServletRequest;
|
7 |
|
|
import javax.servlet.http.HttpServletResponse;
|
8 |
|
|
|
9 |
|
|
import org.springframework.ui.ModelMap;
|
10 |
|
|
|
11 |
|
|
import com.google.common.collect.Lists;
|
12 |
|
|
import com.google.common.collect.Maps;
|
13 |
|
|
|
14 |
|
|
import eu.dnetlib.functionality.modular.ui.users.PermissionLevel;
|
15 |
|
|
|
16 |
|
|
public class UsersController extends ModuleEntryPoint {
|
17 |
|
|
|
18 |
|
|
private List<Map<String, String>> listAvailableLevels = Lists.newArrayList();;
|
19 |
|
|
|
20 |
|
|
@Override
|
21 |
|
|
protected void initialize(ModelMap map, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
22 |
|
|
map.addAttribute("availableLevels", listPermissionLevels());
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
private List<Map<String, String>> listPermissionLevels() {
|
26 |
|
|
if (listAvailableLevels.isEmpty()) {
|
27 |
|
|
for (PermissionLevel level : PermissionLevel.values()) {
|
28 |
|
|
final Map<String, String> map = Maps.newHashMap();
|
29 |
|
|
map.put("level", level.toString());
|
30 |
|
|
map.put("label", level.getLabel());
|
31 |
|
|
map.put("details", level.getDetails());
|
32 |
|
|
listAvailableLevels.add(map);
|
33 |
|
|
}
|
34 |
|
|
}
|
35 |
|
|
return listAvailableLevels;
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
}
|