Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
templateService
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bazarbay Tulenov
templateService
Commits
9506b3c3
Commit
9506b3c3
authored
Jan 24, 2024
by
Denis
Committed by
Denis Ligin
Jan 24, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed filtering in /api/documents/*
parent
f78e1cd5
Pipeline
#373
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
6 deletions
+5
-6
src/main/java/kz/project/printedFormsService/config/SecurityContextUtils.java
...ject/printedFormsService/config/SecurityContextUtils.java
+1
-0
src/main/java/kz/project/printedFormsService/converter/JwtAuthConverter.java
...oject/printedFormsService/converter/JwtAuthConverter.java
+1
-3
src/main/java/kz/project/printedFormsService/data/repository/DocumentJdbcRepository.java
...dFormsService/data/repository/DocumentJdbcRepository.java
+3
-3
No files found.
src/main/java/kz/project/printedFormsService/config/SecurityContextUtils.java
View file @
9506b3c3
...
@@ -36,6 +36,7 @@ public class SecurityContextUtils {
...
@@ -36,6 +36,7 @@ public class SecurityContextUtils {
.
map
(
GrantedAuthority:
:
getAuthority
)
.
map
(
GrantedAuthority:
:
getAuthority
)
.
map
(
role
->
role
.
replace
(
"ROLE_"
,
""
))
.
map
(
role
->
role
.
replace
(
"ROLE_"
,
""
))
.
filter
(
role
->
role
.
contains
(
PROJECT_ROLE_SPLITTER
))
.
filter
(
role
->
role
.
contains
(
PROJECT_ROLE_SPLITTER
))
.
filter
(
role
->
!
role
.
contains
(
"gitlab_"
))
.
collect
(
Collectors
.
toMap
(
.
collect
(
Collectors
.
toMap
(
role
->
role
.
split
(
PROJECT_ROLE_SPLITTER
)[
0
],
role
->
role
.
split
(
PROJECT_ROLE_SPLITTER
)[
0
],
role
->
new
ArrayList
<>(
List
.
of
(
role
.
split
(
PROJECT_ROLE_SPLITTER
)[
1
])),
role
->
new
ArrayList
<>(
List
.
of
(
role
.
split
(
PROJECT_ROLE_SPLITTER
)[
1
])),
...
...
src/main/java/kz/project/printedFormsService/converter/JwtAuthConverter.java
View file @
9506b3c3
...
@@ -5,8 +5,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
...
@@ -5,8 +5,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.jayway.jsonpath.JsonPath
;
import
com.jayway.jsonpath.JsonPath
;
import
com.nimbusds.jwt.JWT
;
import
com.nimbusds.jwt.JWT
;
import
com.nimbusds.jwt.JWTParser
;
import
com.nimbusds.jwt.JWTParser
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.core.convert.converter.Converter
;
import
org.springframework.core.convert.converter.Converter
;
import
org.springframework.security.authentication.AbstractAuthenticationToken
;
import
org.springframework.security.authentication.AbstractAuthenticationToken
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.GrantedAuthority
;
...
@@ -17,7 +15,6 @@ import org.springframework.stereotype.Component;
...
@@ -17,7 +15,6 @@ import org.springframework.stereotype.Component;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Component
@Component
public
class
JwtAuthConverter
implements
Converter
<
Jwt
,
AbstractAuthenticationToken
>
{
public
class
JwtAuthConverter
implements
Converter
<
Jwt
,
AbstractAuthenticationToken
>
{
...
@@ -53,6 +50,7 @@ public class JwtAuthConverter implements Converter<Jwt, AbstractAuthenticationTo
...
@@ -53,6 +50,7 @@ public class JwtAuthConverter implements Converter<Jwt, AbstractAuthenticationTo
if
(
role
.
contains
(
"gitlab"
))
{
if
(
role
.
contains
(
"gitlab"
))
{
authorities
.
add
(
new
SimpleGrantedAuthority
(
"ROLE_"
+
role
));
authorities
.
add
(
new
SimpleGrantedAuthority
(
"ROLE_"
+
role
));
}
else
{
}
else
{
authorities
.
add
(
new
SimpleGrantedAuthority
(
"ROLE_"
+
role
));
authorities
.
add
(
new
SimpleGrantedAuthority
(
"ROLE_"
+
role
.
substring
(
role
.
lastIndexOf
(
'_'
)
+
1
)));
authorities
.
add
(
new
SimpleGrantedAuthority
(
"ROLE_"
+
role
.
substring
(
role
.
lastIndexOf
(
'_'
)
+
1
)));
}
}
}
}
...
...
src/main/java/kz/project/printedFormsService/data/repository/DocumentJdbcRepository.java
View file @
9506b3c3
...
@@ -33,7 +33,7 @@ public class DocumentJdbcRepository {
...
@@ -33,7 +33,7 @@ public class DocumentJdbcRepository {
WHERE
WHERE
DATE_TRUNC('day',created_at) >= :startDate
DATE_TRUNC('day',created_at) >= :startDate
AND DATE_TRUNC('day',created_at) <= :endDate
AND DATE_TRUNC('day',created_at) <= :endDate
--
AND project in(:projects)
AND project in(:projects)
GROUP BY
GROUP BY
date
date
ORDER BY
ORDER BY
...
@@ -61,11 +61,11 @@ public class DocumentJdbcRepository {
...
@@ -61,11 +61,11 @@ public class DocumentJdbcRepository {
COUNT(1) as count
COUNT(1) as count
FROM
FROM
template_schema.document d
template_schema.document d
inner join template_schema.template t on t.
template_
id = d.template_id
inner join template_schema.template t on t.id = d.template_id
WHERE
WHERE
DATE_TRUNC('day',created_at) >= :startDate
DATE_TRUNC('day',created_at) >= :startDate
AND DATE_TRUNC('day',created_at) <= :endDate
AND DATE_TRUNC('day',created_at) <= :endDate
--
AND d.project in(:projects)
AND d.project in(:projects)
GROUP BY
GROUP BY
d.template_id, t.name
d.template_id, t.name
ORDER BY
ORDER BY
...
...
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