3 changed files with 46 additions and 2 deletions
@ -0,0 +1,40 @@ |
|||||||
|
package com.cloud.kicc.workflow.override; |
||||||
|
|
||||||
|
import org.flowable.idm.api.User; |
||||||
|
import org.flowable.ui.common.security.SecurityUtils; |
||||||
|
import org.flowable.ui.common.tenant.TenantProvider; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.context.annotation.Primary; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
/** |
||||||
|
*<p> |
||||||
|
* ui建模租户ID提供 |
||||||
|
*</p> |
||||||
|
* |
||||||
|
* @Author: wangxiang4 |
||||||
|
* @Since: 2023/9/27 |
||||||
|
*/ |
||||||
|
@Primary |
||||||
|
@Component |
||||||
|
public class UiTenantProvider implements TenantProvider { |
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(UiTenantProvider.class); |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getTenantId() { |
||||||
|
User flowableUser = SecurityUtils.getCurrentUserObject(); |
||||||
|
if(flowableUser != null) { |
||||||
|
// quotes can help solve whitespace issues, trimming here would not
|
||||||
|
// help solve the problem at source which is in user database
|
||||||
|
LOGGER.debug("Using user tenantId: '{}'", flowableUser.getTenantId()); |
||||||
|
return flowableUser.getTenantId(); |
||||||
|
} |
||||||
|
|
||||||
|
LOGGER.debug("No tenantId"); |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue