Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CDEK Development
cdek-warehouse
Commits
033c551e
Commit
033c551e
authored
8 years ago
by
njrfhtd
Browse files
Options
Download
Email Patches
Plain Diff
some fixings CDEK-1722
1) Нет сообщения об отсутствии привязки сотрудника к пользователю.
parent
bc6f9947
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
front/cdek_front/src/main/java/ru/cdek/web/mvc/BaseMVCController.java
+25
-0
...ront/src/main/java/ru/cdek/web/mvc/BaseMVCController.java
front/cdek_front/webapp/menu/menu.ftl
+1
-0
front/cdek_front/webapp/menu/menu.ftl
warehouse-common/warehouse-web/src/main/java/ru/cdek/warehouse/web/auth/impl/UserApiAuthServiceImpl.java
+0
-2
.../cdek/warehouse/web/auth/impl/UserApiAuthServiceImpl.java
with
26 additions
and
2 deletions
+26
-2
front/cdek_front/src/main/java/ru/cdek/web/mvc/BaseMVCController.java
View file @
033c551e
package
ru.cdek.web.mvc
;
import
com.cdek.catalog.common.entity.Employee
;
import
com.cdek.commons.js.JSUser
;
import
com.cdek.transport.ek4.user.FrontUser
;
import
com.cdek.warehouse.client.WarehouseClient
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.i18n.LocaleContextHolder
;
...
...
@@ -29,6 +35,10 @@ public class BaseMVCController {
@Autowired
protected
FrontMessageService
frontMessageService
;
@Autowired
@Qualifier
(
"warehouseClient"
)
protected
WarehouseClient
warehouseClient
;
@ModelAttribute
(
"lang3"
)
public
String
getIso3Lang
()
{
return
UserAuthUtils
.
getLocale3sign
();
...
...
@@ -39,6 +49,21 @@ public class BaseMVCController {
return
LocaleContextHolder
.
getLocale
().
getLanguage
();
}
@ModelAttribute
(
"noEmployee"
)
public
String
getNoEmployee
()
{
JSUser
jsUser
=
UserAuthUtils
.
getCurrentUser
();
if
(
null
==
jsUser
.
token
)
{
return
""
;
}
Employee
employee
=
warehouseClient
.
findEmployeeByUserCode
(
jsUser
.
getCode
(),
jsUser
.
getLang
());
if
(
null
==
employee
)
{
return
frontMessageService
.
getMsg
(
"error.user.without.employee"
);
}
return
""
;
}
public
void
setContext
(
ApplicationContext
context
)
{
this
.
context
=
context
;
}
...
...
This diff is collapsed.
Click to expand it.
front/cdek_front/webapp/menu/menu.ftl
View file @
033c551e
...
...
@@ -85,6 +85,7 @@
<@security.authorize access="isAuthenticated()">
<p class="navbar-text">
<@security.authentication property="principal.login"> </@security.authentication>
- <span class="" style="color: red;">${noEmployee}</span>
</p>
</@security.authorize>
<li class="divider-vertical"></li>
...
...
This diff is collapsed.
Click to expand it.
warehouse-common/warehouse-web/src/main/java/ru/cdek/warehouse/web/auth/impl/UserApiAuthServiceImpl.java
View file @
033c551e
...
...
@@ -26,8 +26,6 @@ import java.util.Date;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.cdek.transport.auth.Roles
;
/**
* Аутентификация пользователя при помощи UserApi
*/
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help