diff --git a/build.gradle b/build.gradle index 7e8766c..b374d68 100644 --- a/build.gradle +++ b/build.gradle @@ -19,11 +19,16 @@ jar { dependencies { implementation(project(':front')) + annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'com.h2database:h2:2.1.210' implementation 'org.springframework.boot:spring-boot-starter-validation' implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.5' - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'com.auth0:java-jwt:4.4.0' testImplementation 'org.springframework.boot:spring-boot-starter-test' implementation 'org.hibernate.validator:hibernate-validator' diff --git a/front/src/App.js b/front/src/App.js index 173405f..5c161f9 100644 --- a/front/src/App.js +++ b/front/src/App.js @@ -1,4 +1,4 @@ -import { useRoutes, Outlet, BrowserRouter } from 'react-router-dom' +import {BrowserRouter, Route, Routes} from 'react-router-dom' import Films from './pages/Films' import FilmPage from './pages/FilmPage' import Header from './pages/components/Header' @@ -7,39 +7,40 @@ import SearchSame from './pages/SearchSame' import Registration from './pages/Registration' import Sessions from './pages/Sessions' import Orders from './pages/Orders' - -function Router(props) { - return useRoutes(props.rootRoute); -} +import Users from "./pages/Users"; +import PrivateRoutes from "./pages/components/PrivateRoutes"; export default function App() { - const routes = [ - { index: true, element: }, - { path: '/films', element: , label: 'Главная' }, - { path: '/registration', element: , label: 'Регистрация' }, - { path: '/sessions', element: , label: 'Сеансы' }, - { path: '/orders', element: , label: 'Заказы' }, - { path: '/films/:id', element: }, - { path: '/search-same/:request', element: } - ]; - const links = routes.filter(route => route.hasOwnProperty('label')); - const rootRoute = [ - { path: '/', element: render(links), children: routes } - ]; + const links = [ + {path: 'films', label: 'Главная', userAccess: 'NONE'}, + {path: 'registration', label: 'Регистрация', userAccess: 'NONE'}, + {path: 'entry', label: 'Вход', userAccess: 'NONE'}, + {path: 'users', label: 'Пользователи', userAccess: 'ADMIN'}, + {path: 'sessions', label: 'Сеансы', userAccess: 'NONE'}, + {path: 'orders', label: 'Заказы', userAccess: 'USER'} + ]; - function render(links) { return ( - <> -
- -