Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Rubén Ramírez
/
MangAffinity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9fbf5a40
authored
Feb 23, 2025
by
Rubén Ramírez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat: [RecursosController]: Implementado la función de listar recurso en el controlador
parent
c058bec8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
src/main/java/com/ujaen/tfg/mangaffinity/rest/RecursosController.java
src/main/java/com/ujaen/tfg/mangaffinity/seguridad/ServicioSeguridad.java
src/main/java/com/ujaen/tfg/mangaffinity/rest/RecursosController.java
View file @
9fbf5a40
...
@@ -137,7 +137,15 @@ public class RecursosController {
...
@@ -137,7 +137,15 @@ public class RecursosController {
}
}
}
}
@GetMapping
public
ResponseEntity
<
List
<
DTORecurso
>>
obtenerRecursos
()
{
try
{
List
<
Recurso
>
recursos
=
servicioRecursos
.
obtenerListadoRecursos
();
List
<
DTORecurso
>
dtoRecursos
=
recursos
.
stream
().
map
(
mapper:
:
dto
).
toList
();
return
ResponseEntity
.
ok
(
dtoRecursos
);
}
catch
(
Exception
e
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
build
();
}
}
}
}
\ No newline at end of file
src/main/java/com/ujaen/tfg/mangaffinity/seguridad/ServicioSeguridad.java
View file @
9fbf5a40
...
@@ -35,16 +35,17 @@ public class ServicioSeguridad {
...
@@ -35,16 +35,17 @@ public class ServicioSeguridad {
.
requestMatchers
(
HttpMethod
.
GET
,
"/recursos/genero/**"
).
permitAll
()
.
requestMatchers
(
HttpMethod
.
GET
,
"/recursos/genero/**"
).
permitAll
()
.
requestMatchers
(
HttpMethod
.
GET
,
"/recursos/fecha"
).
permitAll
()
.
requestMatchers
(
HttpMethod
.
GET
,
"/recursos/fecha"
).
permitAll
()
.
requestMatchers
(
HttpMethod
.
GET
,
"/recursos/{id}"
).
permitAll
()
.
requestMatchers
(
HttpMethod
.
GET
,
"/recursos/{id}"
).
permitAll
()
.
requestMatchers
(
HttpMethod
.
GET
,
"/recursos"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
requestMatchers
(
HttpMethod
.
POST
,
"/recursos/"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
requestMatchers
(
HttpMethod
.
POST
,
"/recursos/"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
requestMatchers
(
HttpMethod
.
PUT
,
"/recursos/{id}"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
requestMatchers
(
HttpMethod
.
PUT
,
"/recursos/{id}"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
requestMatchers
(
HttpMethod
.
DELETE
,
"/recursos/{id}"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
requestMatchers
(
HttpMethod
.
DELETE
,
"/recursos/{id}"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
anyRequest
().
authenticated
()
.
anyRequest
().
authenticated
()
)
)
.
addFilterBefore
(
new
JwtFilter
(
jwtUtil
),
UsernamePasswordAuthenticationFilter
.
class
)
.
addFilterBefore
(
new
JwtFilter
(
jwtUtil
),
UsernamePasswordAuthenticationFilter
.
class
)
.
build
();
.
build
();
}
}
@Bean
@Bean
public
PasswordEncoder
passwordEncoder
()
{
public
PasswordEncoder
passwordEncoder
()
{
return
new
BCryptPasswordEncoder
();
return
new
BCryptPasswordEncoder
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment