diff --git a/src/main/java/ru/ulstu/configuration/MvcConfiguration.java b/src/main/java/ru/ulstu/configuration/MvcConfiguration.java index 7bca53d..7d2ab4c 100644 --- a/src/main/java/ru/ulstu/configuration/MvcConfiguration.java +++ b/src/main/java/ru/ulstu/configuration/MvcConfiguration.java @@ -1,6 +1,10 @@ package ru.ulstu.configuration; +import org.springframework.boot.web.server.ErrorPage; +import org.springframework.boot.web.server.ErrorPageRegistrar; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatus; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -10,4 +14,12 @@ public class MvcConfiguration implements WebMvcConfigurer { public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("/", "/index.xhtml"); } + + @Bean + public ErrorPageRegistrar errorPageRegistrar() { + return registry -> { + registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error/404.xhtml")); + registry.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500.xhtml")); + }; + } } diff --git a/src/main/java/ru/ulstu/core/navigation/Page.java b/src/main/java/ru/ulstu/core/navigation/Page.java index 754ab8d..b78a144 100644 --- a/src/main/java/ru/ulstu/core/navigation/Page.java +++ b/src/main/java/ru/ulstu/core/navigation/Page.java @@ -7,6 +7,7 @@ public class Page { public static final String INDEX = "/index.xhtml"; public static final String PAPER_LIST = "/paper/papers.xhtml"; public static final String DASHBOARD = "/paper/dashboard.xhtml"; + public static final String USER_LIST = "/admin/users.xhtml"; public static final String LOGOUT = "/logout"; public String getPAPER_LIST() { @@ -21,6 +22,10 @@ public class Page { return DASHBOARD; } + public String getUSER_LIST() { + return USER_LIST; + } + public String getLOGOUT() { return LOGOUT; } diff --git a/src/main/java/ru/ulstu/user/component/UserView.java b/src/main/java/ru/ulstu/user/component/UserView.java new file mode 100644 index 0000000..90e234a --- /dev/null +++ b/src/main/java/ru/ulstu/user/component/UserView.java @@ -0,0 +1,29 @@ +package ru.ulstu.user.component; + +import ru.ulstu.user.model.User; +import ru.ulstu.user.service.UserService; + +import javax.annotation.PostConstruct; +import javax.faces.view.ViewScoped; +import javax.inject.Inject; +import javax.inject.Named; +import java.io.Serializable; +import java.util.List; + +@Named +@ViewScoped +public class UserView implements Serializable { + @Inject + private UserService userService; + + private List users; + + @PostConstruct + public void init() { + users = userService.findAll(); + } + + public List getUsers() { + return users; + } +} diff --git a/src/main/resources/META-INF/resources/admin/users.xhtml b/src/main/resources/META-INF/resources/admin/users.xhtml new file mode 100644 index 0000000..1b03dfc --- /dev/null +++ b/src/main/resources/META-INF/resources/admin/users.xhtml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + #{user.userAbbreviate} + + + + + + + + + + diff --git a/src/main/resources/META-INF/resources/basicTemplate.xhtml b/src/main/resources/META-INF/resources/basicTemplate.xhtml index f9f14cd..94df42c 100644 --- a/src/main/resources/META-INF/resources/basicTemplate.xhtml +++ b/src/main/resources/META-INF/resources/basicTemplate.xhtml @@ -32,6 +32,7 @@ + diff --git a/src/main/resources/META-INF/resources/error/403.xhtml b/src/main/resources/META-INF/resources/error/403.xhtml new file mode 100644 index 0000000..8d25bc6 --- /dev/null +++ b/src/main/resources/META-INF/resources/error/403.xhtml @@ -0,0 +1,27 @@ + + + + + + Доступ запрещен + + + + + +
+
+
+
+

Доступ запрещен

+ + Вернуться на главную + +
+
+
+
+
+ diff --git a/src/main/resources/META-INF/resources/error/404.xhtml b/src/main/resources/META-INF/resources/error/404.xhtml new file mode 100644 index 0000000..cd6856d --- /dev/null +++ b/src/main/resources/META-INF/resources/error/404.xhtml @@ -0,0 +1,23 @@ + + + + + + Страница не найдена + + + +
+
+
+ + + Вернуться на главную + + +
+
+
+ \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/error/500.xhtml b/src/main/resources/META-INF/resources/error/500.xhtml new file mode 100644 index 0000000..4a15647 --- /dev/null +++ b/src/main/resources/META-INF/resources/error/500.xhtml @@ -0,0 +1,42 @@ + + + + + + Ошибка сервера + + +
+
+
+ + + Вернуться на главную + + + + + + + + + + +
+                                #{requestScope['javax.servlet.error.exception']}
+                            
+
+
+
+ +
+
+
+
+ diff --git a/src/main/resources/templates/oauth_login.html b/src/main/resources/templates/oauth_login.html deleted file mode 100644 index 6e77ab3..0000000 --- a/src/main/resources/templates/oauth_login.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Oauth2 Login - - - - -
-
-

Login with:

-
-

- Client -

-
-
-
- -