mirror of https://gitee.com/topiam/eiam
✨ 优化
parent
4f82b72b53
commit
cf101c8e4c
|
@ -1,3 +1,21 @@
|
|||
#
|
||||
# TopIAM Employee - Employee Identity and Access Management
|
||||
# Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import cn.topiam.employee.support.security.util.SecurityUtils;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
@ -55,6 +54,7 @@ import cn.topiam.employee.support.context.ApplicationContextHelp;
|
|||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
import cn.topiam.employee.support.security.userdetails.UserType;
|
||||
import cn.topiam.employee.support.security.util.SecurityUtils;
|
||||
|
||||
/**
|
||||
* 审计数据转换
|
||||
|
@ -159,7 +159,7 @@ public interface AuditDataConverter {
|
|||
String actorId = "";
|
||||
if (UserType.USER.getType().equals(query.getUserType())) {
|
||||
UserRepository userRepository = ApplicationContextHelp
|
||||
.getBean(UserRepository.class);
|
||||
.getBean(UserRepository.class);
|
||||
UserEntity user = userRepository.findByUsername(query.getUsername());
|
||||
if (!Objects.isNull(user)) {
|
||||
actorId = user.getId().toString();
|
||||
|
@ -167,9 +167,9 @@ public interface AuditDataConverter {
|
|||
}
|
||||
if (UserType.ADMIN.getType().equals(query.getUserType())) {
|
||||
AdministratorRepository administratorRepository = ApplicationContextHelp
|
||||
.getBean(AdministratorRepository.class);
|
||||
.getBean(AdministratorRepository.class);
|
||||
Optional<AdministratorEntity> optional = administratorRepository
|
||||
.findByUsername(query.getUsername());
|
||||
.findByUsername(query.getUsername());
|
||||
if (optional.isPresent()) {
|
||||
actorId = optional.get().getId().toString();
|
||||
}
|
||||
|
@ -182,12 +182,13 @@ public interface AuditDataConverter {
|
|||
}
|
||||
if (UserType.ADMIN.getType().equals(query.getUserType())) {
|
||||
predicate = ExpressionUtils.and(predicate,
|
||||
auditEntity.actorType.eq(UserType.ADMIN));
|
||||
auditEntity.actorType.eq(UserType.ADMIN));
|
||||
}
|
||||
}
|
||||
// 登录角色 管理员
|
||||
if (UserType.USER.equals(userType)) {
|
||||
predicate = ExpressionUtils.and(predicate, auditEntity.actorId.eq(SecurityUtils.getCurrentUser().getId()));
|
||||
predicate = ExpressionUtils.and(predicate,
|
||||
auditEntity.actorId.eq(SecurityUtils.getCurrentUser().getId()));
|
||||
// 用户类型
|
||||
predicate = ExpressionUtils.and(predicate, auditEntity.actorType.eq(UserType.USER));
|
||||
}
|
||||
|
|
|
@ -140,9 +140,13 @@ const AppBasic = (props: { app: GetApp }) => {
|
|||
label={intl.formatMessage({ id: 'pages.app.config.detail.config.icon' })}
|
||||
extra={
|
||||
<div style={{ color: 'rgba(0, 0, 0, 0.45)' }}>
|
||||
<span>{intl.formatMessage({ id: 'pages.app.config.detail.config.icon.desc.1' })}</span>
|
||||
<span>
|
||||
{intl.formatMessage({ id: 'pages.app.config.detail.config.icon.desc.1' })}
|
||||
</span>
|
||||
<br />
|
||||
<span>{intl.formatMessage({ id: 'pages.app.config.detail.config.icon.desc.2' })}</span>
|
||||
<span>
|
||||
{intl.formatMessage({ id: 'pages.app.config.detail.config.icon.desc.2' })}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import cn.topiam.employee.authentication.wechat.WeChatIdpScanCodeConfig;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
@ -44,6 +43,7 @@ import cn.topiam.employee.authentication.feishu.FeiShuIdpScanCodeConfig;
|
|||
import cn.topiam.employee.authentication.gitee.GiteeIdpOAuth2Config;
|
||||
import cn.topiam.employee.authentication.github.GithubIdpOauthConfig;
|
||||
import cn.topiam.employee.authentication.qq.QqIdpOauthConfig;
|
||||
import cn.topiam.employee.authentication.wechat.WeChatIdpScanCodeConfig;
|
||||
import cn.topiam.employee.authentication.wechatwork.WeChatWorkIdpScanCodeConfig;
|
||||
import cn.topiam.employee.common.entity.authn.IdentityProviderEntity;
|
||||
import cn.topiam.employee.common.entity.authn.QIdentityProviderEntity;
|
||||
|
|
|
@ -20,7 +20,6 @@ package cn.topiam.employee.console.synchronizer.configuration;
|
|||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cn.topiam.employee.support.context.ApplicationContextHelp;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
|
@ -66,11 +65,11 @@ import cn.topiam.employee.identitysource.feishu.client.FeiShuClient;
|
|||
import cn.topiam.employee.identitysource.wechatwork.WeChatWorkConfig;
|
||||
import cn.topiam.employee.identitysource.wechatwork.WeChatWorkIdentitySource;
|
||||
import cn.topiam.employee.identitysource.wechatwork.client.WeChatWorkClient;
|
||||
import cn.topiam.employee.support.context.ApplicationContextHelp;
|
||||
import cn.topiam.employee.support.scheduler.SpringSchedulerRegister;
|
||||
import cn.topiam.employee.support.trace.TraceUtils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static cn.topiam.employee.common.enums.identitysource.IdentitySourceProvider.DINGTALK;
|
||||
import static cn.topiam.employee.support.lock.LockAspect.getTopiamLockKeyPrefix;
|
||||
|
||||
|
|
|
@ -122,9 +122,9 @@ public class ClusterSessionRegistryImpl<T extends org.springframework.session.Se
|
|||
}
|
||||
|
||||
@NotNull
|
||||
private static Session getSession(MapSession session, UserDetails userDetails, Authentication authentication) {
|
||||
WebAuthenticationDetails details = (WebAuthenticationDetails) authentication
|
||||
.getDetails();
|
||||
private static Session getSession(MapSession session, UserDetails userDetails,
|
||||
Authentication authentication) {
|
||||
WebAuthenticationDetails details = (WebAuthenticationDetails) authentication.getDetails();
|
||||
Session sessionDetails = new Session(userDetails.getId(), userDetails.getUsername());
|
||||
//last request
|
||||
Instant instant = session.getLastAccessedTime();
|
||||
|
@ -135,8 +135,7 @@ public class ClusterSessionRegistryImpl<T extends org.springframework.session.Se
|
|||
//登录时间
|
||||
sessionDetails.setAuthenticationTime(details.getAuthenticationTime());
|
||||
//登录时间
|
||||
sessionDetails
|
||||
.setAuthenticationProvider(details.getAuthenticationProvider().getType());
|
||||
sessionDetails.setAuthenticationProvider(details.getAuthenticationProvider().getType());
|
||||
//用户类型
|
||||
sessionDetails.setUserType(userDetails.getUserType());
|
||||
//地理位置
|
||||
|
|
|
@ -61,5 +61,5 @@ public class OpenApiV1Constants {
|
|||
/**
|
||||
* 组织
|
||||
*/
|
||||
public final static String APP_ACCOUNT_PATH = ACCOUNT_PATH + "/app/account";
|
||||
public final static String APP_ACCOUNT_PATH = ACCOUNT_PATH + "/app/account";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.endpoint.app;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.topiam.employee.audit.annotation.Audit;
|
||||
import cn.topiam.employee.audit.event.type.EventType;
|
||||
import cn.topiam.employee.common.entity.app.query.AppAccountQuery;
|
||||
|
@ -11,13 +32,11 @@ import cn.topiam.employee.support.lock.Lock;
|
|||
import cn.topiam.employee.support.preview.Preview;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.topiam.employee.openapi.constant.OpenApiV1Constants.APP_ACCOUNT_PATH;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue