提交 aca19f6d 编写于 作者: S shiziyuan9527

通过ldap登录的用户不能修改密码和邮箱

上级 96e2d4f9
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class User implements Serializable {
......@@ -28,5 +27,7 @@ public class User implements Serializable {
private String phone;
private String source;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -175,72 +175,72 @@ public class UserExample {
}
public Criteria andNameIsNull() {
addCriterion("name is null");
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
......@@ -315,142 +315,142 @@ public class UserExample {
}
public Criteria andPasswordIsNull() {
addCriterion("password is null");
addCriterion("`password` is null");
return (Criteria) this;
}
public Criteria andPasswordIsNotNull() {
addCriterion("password is not null");
addCriterion("`password` is not null");
return (Criteria) this;
}
public Criteria andPasswordEqualTo(String value) {
addCriterion("password =", value, "password");
addCriterion("`password` =", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotEqualTo(String value) {
addCriterion("password <>", value, "password");
addCriterion("`password` <>", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThan(String value) {
addCriterion("password >", value, "password");
addCriterion("`password` >", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThanOrEqualTo(String value) {
addCriterion("password >=", value, "password");
addCriterion("`password` >=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThan(String value) {
addCriterion("password <", value, "password");
addCriterion("`password` <", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThanOrEqualTo(String value) {
addCriterion("password <=", value, "password");
addCriterion("`password` <=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLike(String value) {
addCriterion("password like", value, "password");
addCriterion("`password` like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotLike(String value) {
addCriterion("password not like", value, "password");
addCriterion("`password` not like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordIn(List<String> values) {
addCriterion("password in", values, "password");
addCriterion("`password` in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordNotIn(List<String> values) {
addCriterion("password not in", values, "password");
addCriterion("`password` not in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordBetween(String value1, String value2) {
addCriterion("password between", value1, value2, "password");
addCriterion("`password` between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andPasswordNotBetween(String value1, String value2) {
addCriterion("password not between", value1, value2, "password");
addCriterion("`password` not between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("status =", value, "status");
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("status <>", value, "status");
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("status >", value, "status");
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("status >=", value, "status");
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("status <", value, "status");
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("status <=", value, "status");
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("status like", value, "status");
addCriterion("`status` like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("status not like", value, "status");
addCriterion("`status` not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("status in", values, "status");
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("status not in", values, "status");
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("status between", value1, value2, "status");
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("status not between", value1, value2, "status");
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
......@@ -575,72 +575,72 @@ public class UserExample {
}
public Criteria andLanguageIsNull() {
addCriterion("language is null");
addCriterion("`language` is null");
return (Criteria) this;
}
public Criteria andLanguageIsNotNull() {
addCriterion("language is not null");
addCriterion("`language` is not null");
return (Criteria) this;
}
public Criteria andLanguageEqualTo(String value) {
addCriterion("language =", value, "language");
addCriterion("`language` =", value, "language");
return (Criteria) this;
}
public Criteria andLanguageNotEqualTo(String value) {
addCriterion("language <>", value, "language");
addCriterion("`language` <>", value, "language");
return (Criteria) this;
}
public Criteria andLanguageGreaterThan(String value) {
addCriterion("language >", value, "language");
addCriterion("`language` >", value, "language");
return (Criteria) this;
}
public Criteria andLanguageGreaterThanOrEqualTo(String value) {
addCriterion("language >=", value, "language");
addCriterion("`language` >=", value, "language");
return (Criteria) this;
}
public Criteria andLanguageLessThan(String value) {
addCriterion("language <", value, "language");
addCriterion("`language` <", value, "language");
return (Criteria) this;
}
public Criteria andLanguageLessThanOrEqualTo(String value) {
addCriterion("language <=", value, "language");
addCriterion("`language` <=", value, "language");
return (Criteria) this;
}
public Criteria andLanguageLike(String value) {
addCriterion("language like", value, "language");
addCriterion("`language` like", value, "language");
return (Criteria) this;
}
public Criteria andLanguageNotLike(String value) {
addCriterion("language not like", value, "language");
addCriterion("`language` not like", value, "language");
return (Criteria) this;
}
public Criteria andLanguageIn(List<String> values) {
addCriterion("language in", values, "language");
addCriterion("`language` in", values, "language");
return (Criteria) this;
}
public Criteria andLanguageNotIn(List<String> values) {
addCriterion("language not in", values, "language");
addCriterion("`language` not in", values, "language");
return (Criteria) this;
}
public Criteria andLanguageBetween(String value1, String value2) {
addCriterion("language between", value1, value2, "language");
addCriterion("`language` between", value1, value2, "language");
return (Criteria) this;
}
public Criteria andLanguageNotBetween(String value1, String value2) {
addCriterion("language not between", value1, value2, "language");
addCriterion("`language` not between", value1, value2, "language");
return (Criteria) this;
}
......@@ -853,6 +853,76 @@ public class UserExample {
addCriterion("phone not between", value1, value2, "phone");
return (Criteria) this;
}
public Criteria andSourceIsNull() {
addCriterion("`source` is null");
return (Criteria) this;
}
public Criteria andSourceIsNotNull() {
addCriterion("`source` is not null");
return (Criteria) this;
}
public Criteria andSourceEqualTo(String value) {
addCriterion("`source` =", value, "source");
return (Criteria) this;
}
public Criteria andSourceNotEqualTo(String value) {
addCriterion("`source` <>", value, "source");
return (Criteria) this;
}
public Criteria andSourceGreaterThan(String value) {
addCriterion("`source` >", value, "source");
return (Criteria) this;
}
public Criteria andSourceGreaterThanOrEqualTo(String value) {
addCriterion("`source` >=", value, "source");
return (Criteria) this;
}
public Criteria andSourceLessThan(String value) {
addCriterion("`source` <", value, "source");
return (Criteria) this;
}
public Criteria andSourceLessThanOrEqualTo(String value) {
addCriterion("`source` <=", value, "source");
return (Criteria) this;
}
public Criteria andSourceLike(String value) {
addCriterion("`source` like", value, "source");
return (Criteria) this;
}
public Criteria andSourceNotLike(String value) {
addCriterion("`source` not like", value, "source");
return (Criteria) this;
}
public Criteria andSourceIn(List<String> values) {
addCriterion("`source` in", values, "source");
return (Criteria) this;
}
public Criteria andSourceNotIn(List<String> values) {
addCriterion("`source` not in", values, "source");
return (Criteria) this;
}
public Criteria andSourceBetween(String value1, String value2) {
addCriterion("`source` between", value1, value2, "source");
return (Criteria) this;
}
public Criteria andSourceNotBetween(String value1, String value2) {
addCriterion("`source` not between", value1, value2, "source");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
......@@ -2,9 +2,8 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.User;
import io.metersphere.base.domain.UserExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UserMapper {
long countByExample(UserExample example);
......@@ -28,7 +27,4 @@ public interface UserMapper {
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
}
\ No newline at end of file
......@@ -13,6 +13,7 @@
<result column="last_workspace_id" jdbcType="VARCHAR" property="lastWorkspaceId" />
<result column="last_organization_id" jdbcType="VARCHAR" property="lastOrganizationId" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="source" jdbcType="VARCHAR" property="source" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
......@@ -73,8 +74,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, email, password, status, create_time, update_time, language, last_workspace_id,
last_organization_id, phone
id, `name`, email, `password`, `status`, create_time, update_time, `language`, last_workspace_id,
last_organization_id, phone, `source`
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserExample" resultMap="BaseResultMap">
select
......@@ -107,14 +108,16 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.User">
insert into user (id, name, email,
password, status, create_time,
update_time, language, last_workspace_id,
last_organization_id, phone)
insert into user (id, `name`, email,
`password`, `status`, create_time,
update_time, `language`, last_workspace_id,
last_organization_id, phone, `source`
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{language,jdbcType=VARCHAR}, #{lastWorkspaceId,jdbcType=VARCHAR},
#{lastOrganizationId,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR})
#{lastOrganizationId,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.User">
insert into user
......@@ -123,16 +126,16 @@
id,
</if>
<if test="name != null">
name,
`name`,
</if>
<if test="email != null">
email,
</if>
<if test="password != null">
password,
`password`,
</if>
<if test="status != null">
status,
`status`,
</if>
<if test="createTime != null">
create_time,
......@@ -141,7 +144,7 @@
update_time,
</if>
<if test="language != null">
language,
`language`,
</if>
<if test="lastWorkspaceId != null">
last_workspace_id,
......@@ -152,6 +155,9 @@
<if test="phone != null">
phone,
</if>
<if test="source != null">
`source`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -187,6 +193,9 @@
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.UserExample" resultType="java.lang.Long">
......@@ -202,16 +211,16 @@
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.email != null">
email = #{record.email,jdbcType=VARCHAR},
</if>
<if test="record.password != null">
password = #{record.password,jdbcType=VARCHAR},
`password` = #{record.password,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
......@@ -220,7 +229,7 @@
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.language != null">
language = #{record.language,jdbcType=VARCHAR},
`language` = #{record.language,jdbcType=VARCHAR},
</if>
<if test="record.lastWorkspaceId != null">
last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR},
......@@ -231,6 +240,9 @@
<if test="record.phone != null">
phone = #{record.phone,jdbcType=VARCHAR},
</if>
<if test="record.source != null">
`source` = #{record.source,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -239,16 +251,17 @@
<update id="updateByExample" parameterType="map">
update user
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
email = #{record.email,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
status = #{record.status,jdbcType=VARCHAR},
`password` = #{record.password,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
language = #{record.language,jdbcType=VARCHAR},
`language` = #{record.language,jdbcType=VARCHAR},
last_workspace_id = #{record.lastWorkspaceId,jdbcType=VARCHAR},
last_organization_id = #{record.lastOrganizationId,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR}
phone = #{record.phone,jdbcType=VARCHAR},
`source` = #{record.source,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -257,16 +270,16 @@
update user
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
`password` = #{password,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
......@@ -275,7 +288,7 @@
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="language != null">
language = #{language,jdbcType=VARCHAR},
`language` = #{language,jdbcType=VARCHAR},
</if>
<if test="lastWorkspaceId != null">
last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR},
......@@ -286,22 +299,25 @@
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="source != null">
`source` = #{source,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.User">
update user
set name = #{name,jdbcType=VARCHAR},
set `name` = #{name,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
`password` = #{password,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
language = #{language,jdbcType=VARCHAR},
`language` = #{language,jdbcType=VARCHAR},
last_workspace_id = #{lastWorkspaceId,jdbcType=VARCHAR},
last_organization_id = #{lastOrganizationId,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR}
phone = #{phone,jdbcType=VARCHAR},
`source` = #{source,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
package io.metersphere.commons.constants;
public enum UserSource {
Local, Ldap
}
......@@ -21,6 +21,8 @@ public class UserDTO {
private String status;
private String source;
private Long createTime;
private Long updateTime;
......
......@@ -2,6 +2,7 @@ package io.metersphere.ldap.controller;
import io.metersphere.base.domain.User;
import io.metersphere.commons.constants.ParamConstants;
import io.metersphere.commons.constants.UserSource;
import io.metersphere.commons.exception.MSException;
import io.metersphere.controller.ResultHolder;
import io.metersphere.controller.request.LoginRequest;
......@@ -55,6 +56,7 @@ public class LdapController {
user.setName(username);
user.setEmail(email);
user.setPassword(password);
user.setSource(UserSource.Ldap.name());
userService.createUser(user);
} else {
request.setUsername(u.getId());
......
alter table user add source varchar(50) null;
\ No newline at end of file
......@@ -24,7 +24,7 @@
<template v-slot:default="scope">
<ms-table-operator-button :tip="$t('member.edit_information')" icon="el-icon-edit"
type="primary" @exec="edit(scope.row)"/>
<ms-table-operator-button :tip="$t('member.edit_password')" icon="el-icon-s-tools"
<ms-table-operator-button :tip="$t('member.edit_password')" icon="el-icon-s-tools" v-if="!isLdapUser"
type="success" @exec="editPassword(scope.row)"/>
</template>
</el-table-column>
......@@ -43,7 +43,7 @@
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
<el-form-item :label="$t('commons.email')" prop="email">
<el-input v-model="form.email" autocomplete="off"/>
<el-input v-model="form.email" autocomplete="off" :disabled="isLdapUser"/>
</el-form-item>
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/>
......@@ -89,6 +89,7 @@
data() {
return {
result: {},
isLdapUser: false,
updateVisible: false,
editPasswordVisible: false,
tableData: [],
......@@ -198,6 +199,7 @@
initTableData() {
this.result = this.$get("/user/info/" + this.currentUser().id, response => {
let data = response.data;
this.isLdapUser = response.data.source === 'Ldap' ? true : false;
let dataList = [];
dataList[0] = data;
this.tableData = dataList;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册