ci: 删除部分代码
This commit is contained in:
parent
7adf0a87b9
commit
965364c2fc
|
@ -30,7 +30,7 @@ public class UserKey implements Serializable {
|
|||
private Long createTime;
|
||||
|
||||
@Schema(title = "状态")
|
||||
private String status;
|
||||
private Boolean enable;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -444,73 +444,63 @@ public class UserKeyExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIsNull() {
|
||||
addCriterion("`status` is null");
|
||||
public Criteria andEnableIsNull() {
|
||||
addCriterion("`enable` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIsNotNull() {
|
||||
addCriterion("`status` is not null");
|
||||
public Criteria andEnableIsNotNull() {
|
||||
addCriterion("`enable` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusEqualTo(String value) {
|
||||
addCriterion("`status` =", value, "status");
|
||||
public Criteria andEnableEqualTo(Boolean value) {
|
||||
addCriterion("`enable` =", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotEqualTo(String value) {
|
||||
addCriterion("`status` <>", value, "status");
|
||||
public Criteria andEnableNotEqualTo(Boolean value) {
|
||||
addCriterion("`enable` <>", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusGreaterThan(String value) {
|
||||
addCriterion("`status` >", value, "status");
|
||||
public Criteria andEnableGreaterThan(Boolean value) {
|
||||
addCriterion("`enable` >", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`status` >=", value, "status");
|
||||
public Criteria andEnableGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("`enable` >=", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusLessThan(String value) {
|
||||
addCriterion("`status` <", value, "status");
|
||||
public Criteria andEnableLessThan(Boolean value) {
|
||||
addCriterion("`enable` <", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusLessThanOrEqualTo(String value) {
|
||||
addCriterion("`status` <=", value, "status");
|
||||
public Criteria andEnableLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("`enable` <=", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusLike(String value) {
|
||||
addCriterion("`status` like", value, "status");
|
||||
public Criteria andEnableIn(List<Boolean> values) {
|
||||
addCriterion("`enable` in", values, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotLike(String value) {
|
||||
addCriterion("`status` not like", value, "status");
|
||||
public Criteria andEnableNotIn(List<Boolean> values) {
|
||||
addCriterion("`enable` not in", values, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIn(List<String> values) {
|
||||
addCriterion("`status` in", values, "status");
|
||||
public Criteria andEnableBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("`enable` between", value1, value2, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotIn(List<String> values) {
|
||||
addCriterion("`status` not in", values, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusBetween(String value1, String value2) {
|
||||
addCriterion("`status` between", value1, value2, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotBetween(String value1, String value2) {
|
||||
addCriterion("`status` not between", value1, value2, "status");
|
||||
public Criteria andEnableNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("`enable` not between", value1, value2, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<result column="access_key" jdbcType="VARCHAR" property="accessKey" />
|
||||
<result column="secret_key" jdbcType="VARCHAR" property="secretKey" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="enable" jdbcType="BIT" property="enable" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -68,7 +68,7 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, create_user, access_key, secret_key, create_time, `status`
|
||||
id, create_user, access_key, secret_key, create_time, `enable`
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.UserKeyExample" resultMap="BaseResultMap">
|
||||
select
|
||||
|
@ -102,10 +102,10 @@
|
|||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.system.domain.UserKey">
|
||||
insert into user_key (id, create_user, access_key,
|
||||
secret_key, create_time, `status`
|
||||
secret_key, create_time, `enable`
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{accessKey,jdbcType=VARCHAR},
|
||||
#{secretKey,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR}
|
||||
#{secretKey,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{enable,jdbcType=BIT}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.UserKey">
|
||||
|
@ -126,8 +126,8 @@
|
|||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
<if test="enable != null">
|
||||
`enable`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
|
@ -146,8 +146,8 @@
|
|||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
<if test="enable != null">
|
||||
#{enable,jdbcType=BIT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
@ -175,8 +175,8 @@
|
|||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.status != null">
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
<if test="record.enable != null">
|
||||
`enable` = #{record.enable,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
|
@ -190,7 +190,7 @@
|
|||
access_key = #{record.accessKey,jdbcType=VARCHAR},
|
||||
secret_key = #{record.secretKey,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
`status` = #{record.status,jdbcType=VARCHAR}
|
||||
`enable` = #{record.enable,jdbcType=BIT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -210,8 +210,8 @@
|
|||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
<if test="enable != null">
|
||||
`enable` = #{enable,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -222,7 +222,7 @@
|
|||
access_key = #{accessKey,jdbcType=VARCHAR},
|
||||
secret_key = #{secretKey,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
`status` = #{status,jdbcType=VARCHAR}
|
||||
`enable` = #{enable,jdbcType=BIT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -121,18 +121,19 @@ CREATE TABLE novice_statistics
|
|||
COLLATE = utf8mb4_general_ci COMMENT = '新手村';
|
||||
|
||||
DROP TABLE IF EXISTS operation_log;
|
||||
CREATE TABLE operation_log(
|
||||
`id` VARCHAR(50) NOT NULL COMMENT '主键' ,
|
||||
`project_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '项目id' ,
|
||||
`create_time` BIGINT NOT NULL COMMENT '操作时间' ,
|
||||
`create_user` VARCHAR(50) COMMENT '操作人' ,
|
||||
`source_id` VARCHAR(50) COMMENT '资源id' ,
|
||||
`method` VARCHAR(255) NOT NULL COMMENT '操作方法' ,
|
||||
`type` VARCHAR(20) NOT NULL COMMENT '操作类型/add/update/delete' ,
|
||||
`module` VARCHAR(20) COMMENT '操作模块/api/case/scenario/ui' ,
|
||||
`details` VARCHAR(500) COMMENT '操作详情' ,
|
||||
`path` VARCHAR(255) COMMENT '操作路径' ,
|
||||
PRIMARY KEY (id)
|
||||
CREATE TABLE operation_log
|
||||
(
|
||||
`id` VARCHAR(50) NOT NULL COMMENT '主键',
|
||||
`project_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '项目id',
|
||||
`create_time` BIGINT NOT NULL COMMENT '操作时间',
|
||||
`create_user` VARCHAR(50) COMMENT '操作人',
|
||||
`source_id` VARCHAR(50) COMMENT '资源id',
|
||||
`method` VARCHAR(255) NOT NULL COMMENT '操作方法',
|
||||
`type` VARCHAR(20) NOT NULL COMMENT '操作类型/add/update/delete',
|
||||
`module` VARCHAR(50) COMMENT '操作模块/api/case/scenario/ui',
|
||||
`details` VARCHAR(500) COMMENT '操作详情',
|
||||
`path` VARCHAR(255) COMMENT '操作路径',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT = '操作日志';
|
||||
|
@ -381,7 +382,7 @@ CREATE TABLE user_key
|
|||
`access_key` VARCHAR(50) NOT NULL COMMENT 'access_key',
|
||||
`secret_key` VARCHAR(50) NOT NULL COMMENT 'secret key',
|
||||
`create_time` BIGINT NOT NULL COMMENT '创建时间',
|
||||
`status` VARCHAR(10) COMMENT '状态',
|
||||
`enable` BIT COMMENT '状态',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
|
|
|
@ -11,7 +11,7 @@ insert into user(id, name, email, password, create_time, update_time, language,
|
|||
VALUES ('admin', 'Administrator', 'admin@metersphere.io', MD5('metersphere'), UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, NULL, NUll, '', 'LOCAL', NULL, 'admin', 'admin');
|
||||
|
||||
-- 初始化用户组
|
||||
INSERT INTO user_role (id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUES ('admin', '系统管理员(系统)', '拥有系统全部组织以及项目的操作权限', 1, 'SYSTEM', 1621224000000, 1621224000000, 'admin', 'system');
|
||||
INSERT INTO user_role (id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUES ('admin', '系统管理员(系统)', '拥有系统全部组织以及项目的操作权限', 1, 'SYSTEM', 1621224000000, 1621224000000, 'admin', 'global');
|
||||
INSERT INTO user_role (id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUES ('org_admin', '组织管理员(系统)', '组织管理员', 1, 'ORGANIZATION', 1620674220007, 1620674220000, 'admin', 'global');
|
||||
INSERT INTO user_role (id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUES ('org_member', '组织成员(系统)', '组织成员', 1, 'ORGANIZATION', 1620674220008, 1620674220000, 'admin', 'global');
|
||||
INSERT INTO user_role (id, name, description, internal, type, create_time, update_time, create_user, scope_id) VALUES ('project_admin', '项目管理员(系统)', '项目管理员', 1, 'PROJECT', 1620674220004, 1620674220000, 'admin', 'global');
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package io.metersphere.sdk.constants;
|
||||
|
||||
public enum ApiKeyConstants {
|
||||
ACTIVE, DISABLED
|
||||
}
|
|
@ -11,5 +11,4 @@ public class UserRoleConstants {
|
|||
public static final String WS_MEMBER = "ws_member";
|
||||
public static final String PROJECT_ADMIN = "project_admin";
|
||||
public static final String PROJECT_MEMBER = "project_member";
|
||||
public static final String READ_ONLY = "read_only";
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.sdk.constants;
|
||||
|
||||
public class UserRoleType {
|
||||
public static final String SYSTEM = "SYSTEM";
|
||||
public static final String ORGANIZATION = "ORGANIZATION";
|
||||
public static final String PROJECT = "PROJECT";
|
||||
public enum UserRoleType {
|
||||
SYSTEM,
|
||||
ORGANIZATION,
|
||||
PROJECT,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package io.metersphere.sdk.constants;
|
||||
|
||||
public enum UserSource {
|
||||
LOCAL, LDAP, CAS, OIDC, OAuth2
|
||||
LOCAL, LDAP, CAS, OIDC, OAUTH2
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
package io.metersphere.sdk.constants;
|
||||
|
||||
public class UserStatus {
|
||||
public static final String NORMAL = "1";
|
||||
public static final String DISABLED = "0";
|
||||
}
|
|
@ -123,7 +123,7 @@ public class BaseUserService {
|
|||
private void checkNewOrganizationAndProject(UserDTO user) {
|
||||
List<UserRoleRelation> userRoleRelations = user.getUserRoleRelations();
|
||||
List<String> projectRoleIds = user.getUserRoles()
|
||||
.stream().filter(ug -> StringUtils.equals(ug.getType(), UserRoleType.PROJECT))
|
||||
.stream().filter(ug -> StringUtils.equals(ug.getType(), UserRoleType.PROJECT.name()))
|
||||
.map(UserRole::getId)
|
||||
.toList();
|
||||
List<UserRoleRelation> project = userRoleRelations.stream().filter(ug -> projectRoleIds.contains(ug.getRoleId()))
|
||||
|
@ -131,7 +131,7 @@ public class BaseUserService {
|
|||
if (CollectionUtils.isEmpty(project)) {
|
||||
List<String> organizationIds = user.getUserRoles()
|
||||
.stream()
|
||||
.filter(ug -> StringUtils.equals(ug.getType(), UserRoleType.ORGANIZATION))
|
||||
.filter(ug -> StringUtils.equals(ug.getType(), UserRoleType.ORGANIZATION.name()))
|
||||
.map(UserRole::getId)
|
||||
.toList();
|
||||
List<UserRoleRelation> organizations = userRoleRelations.stream().filter(ug -> organizationIds.contains(ug.getRoleId()))
|
||||
|
@ -211,7 +211,7 @@ public class BaseUserService {
|
|||
|
||||
List<UserRoleRelation> roleRelations = user.getUserRoleRelations();
|
||||
List<String> projectRoleIds = user.getUserRoles()
|
||||
.stream().filter(ug -> StringUtils.equals(ug.getType(), UserRoleType.PROJECT))
|
||||
.stream().filter(ug -> StringUtils.equals(ug.getType(), UserRoleType.PROJECT.name()))
|
||||
.map(UserRole::getId)
|
||||
.toList();
|
||||
List<String> projectIdsWithPermission = roleRelations.stream().filter(ug -> projectRoleIds.contains(ug.getRoleId()))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.sdk.service;
|
||||
|
||||
import io.metersphere.sdk.constants.ApiKeyConstants;
|
||||
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.domain.UserKey;
|
||||
|
@ -47,7 +47,7 @@ public class UserKeyService {
|
|||
UserKey userKeys = new UserKey();
|
||||
userKeys.setId(UUID.randomUUID().toString());
|
||||
userKeys.setCreateUser(userId);
|
||||
userKeys.setStatus(ApiKeyConstants.ACTIVE.name());
|
||||
userKeys.setEnable(true);
|
||||
userKeys.setAccessKey(RandomStringUtils.randomAlphanumeric(16));
|
||||
userKeys.setSecretKey(RandomStringUtils.randomAlphanumeric(16));
|
||||
userKeys.setCreateTime(System.currentTimeMillis());
|
||||
|
@ -62,20 +62,20 @@ public class UserKeyService {
|
|||
public void activeUserKey(String id) {
|
||||
UserKey userKeys = new UserKey();
|
||||
userKeys.setId(id);
|
||||
userKeys.setStatus(ApiKeyConstants.ACTIVE.name());
|
||||
userKeys.setEnable(true);
|
||||
userKeyMapper.updateByPrimaryKeySelective(userKeys);
|
||||
}
|
||||
|
||||
public void disableUserKey(String id) {
|
||||
UserKey userKeys = new UserKey();
|
||||
userKeys.setId(id);
|
||||
userKeys.setStatus(ApiKeyConstants.DISABLED.name());
|
||||
userKeys.setEnable(false);
|
||||
userKeyMapper.updateByPrimaryKeySelective(userKeys);
|
||||
}
|
||||
|
||||
public UserKey getUserKey(String accessKey) {
|
||||
UserKeyExample userKeyExample = new UserKeyExample();
|
||||
userKeyExample.createCriteria().andAccessKeyEqualTo(accessKey).andStatusEqualTo(ApiKeyConstants.ACTIVE.name());
|
||||
userKeyExample.createCriteria().andAccessKeyEqualTo(accessKey).andEnableEqualTo(true);
|
||||
List<UserKey> userKeysList = userKeyMapper.selectByExample(userKeyExample);
|
||||
if (!CollectionUtils.isEmpty(userKeysList)) {
|
||||
return userKeysList.get(0);
|
||||
|
|
Loading…
Reference in New Issue