mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-29 18:48:13 +08:00
feat: 添加组织成员角色
This commit is contained in:
parent
2c47bcc073
commit
acaddcbe7a
1
.gitignore
vendored
1
.gitignore
vendored
@ -31,3 +31,4 @@ target
|
||||
.project
|
||||
.classpath
|
||||
.jython_cache
|
||||
qywx.json
|
@ -49,8 +49,16 @@
|
||||
|
||||
<select id="getOrgMemberList" resultType="io.metersphere.base.domain.User">
|
||||
SELECT DISTINCT * FROM (
|
||||
SELECT `user`.* FROM user_role JOIN `user` ON user_role.user_id = `user`.id
|
||||
WHERE user_role.source_id = #{orgMember.organizationId}
|
||||
SELECT `user`.*
|
||||
FROM user_role JOIN `user`
|
||||
ON user_role.user_id = `user`.id
|
||||
WHERE user_role.source_id in
|
||||
(
|
||||
SELECT id FROM workspace w
|
||||
WHERE w.organization_id = #{orgMember.organizationId}
|
||||
UNION
|
||||
SELECT #{orgMember.organizationId} AS id FROM dual
|
||||
)
|
||||
<if test="orgMember.name != null">
|
||||
AND `user`.name like CONCAT('%', #{orgMember.name},'%')
|
||||
</if>
|
||||
|
@ -3,6 +3,7 @@ package io.metersphere.commons.constants;
|
||||
public class RoleConstants {
|
||||
public final static String ADMIN = "admin";
|
||||
public final static String ORG_ADMIN = "org_admin";
|
||||
public final static String ORG_MEMBER = "org_member";
|
||||
public final static String TEST_VIEWER = "test_viewer";
|
||||
public final static String TEST_MANAGER = "test_manager";
|
||||
public final static String TEST_USER = "test_user";
|
||||
|
@ -171,12 +171,11 @@ public class OrganizationService {
|
||||
SessionUser sessionUser = SessionUtils.getUser();
|
||||
UserDTO user = userService.getUserDTO(sessionUser.getId());
|
||||
List<String> collect = user.getUserRoles().stream()
|
||||
.filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId()))
|
||||
.filter(ur -> RoleConstants.ORG_ADMIN.equals(ur.getRoleId()) || RoleConstants.ORG_MEMBER.equals(ur.getRoleId()))
|
||||
.map(UserRole::getSourceId)
|
||||
.collect(Collectors.toList());
|
||||
if (!collect.contains(organizationId)) {
|
||||
MSException.throwException(Translator.get("organization_does_not_belong_to_user"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,2 @@
|
||||
INSERT INTO role (id, name, description, type, create_time, update_time)
|
||||
VALUES ('org_member', '组织成员', NULL, NULL, unix_timestamp() * 1000, unix_timestamp() * 1000);
|
@ -165,6 +165,11 @@
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
this.$get(url + "/" + encodeURIComponent(this.tableData[i].id), response => {
|
||||
let roles = response.data;
|
||||
if (roles.length < 1) {
|
||||
roles.push({
|
||||
id : "org_member",
|
||||
});
|
||||
}
|
||||
this.$set(this.tableData[i], "roles", roles);
|
||||
})
|
||||
}
|
||||
|
@ -103,6 +103,21 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div v-if="role.id === 'org_member'">
|
||||
<el-form-item :label="$t('organization.select_organization')"
|
||||
:prop="'roles.' + index + '.ids'"
|
||||
:rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"
|
||||
>
|
||||
<el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>
|
||||
<el-option
|
||||
v-for="item in form.orgList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div v-if="role.id === 'test_manager'">
|
||||
<el-form-item :label="$t('workspace.select')"
|
||||
:prop="'roles.' + index + '.ids'"
|
||||
@ -214,6 +229,21 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div v-if="role.id === 'org_member'">
|
||||
<el-form-item :label="$t('organization.select_organization')"
|
||||
:prop="'roles.' + index + '.ids'"
|
||||
:rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"
|
||||
>
|
||||
<el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>
|
||||
<el-option
|
||||
v-for="item in form.orgList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div v-if="role.id === 'test_manager'">
|
||||
<el-form-item :label="$t('workspace.select')"
|
||||
:prop="'roles.' + index + '.ids'"
|
||||
|
@ -336,6 +336,7 @@ export default {
|
||||
please_choose_role: 'Please Choose Role',
|
||||
admin: 'Admin',
|
||||
org_admin: 'Org_Admin',
|
||||
org_member: 'Org Member',
|
||||
test_manager: 'Test Manager',
|
||||
test_user: 'Test User',
|
||||
test_viewer: 'Read-only User',
|
||||
|
@ -335,6 +335,7 @@ export default {
|
||||
please_choose_role: '请选择角色',
|
||||
admin: '系统管理员',
|
||||
org_admin: '组织管理员',
|
||||
org_member: '组织成员',
|
||||
test_manager: '测试经理',
|
||||
test_user: '测试人员',
|
||||
test_viewer: '只读用户',
|
||||
|
@ -337,6 +337,7 @@ export default {
|
||||
please_choose_role: '請選擇角色',
|
||||
admin: '系統管理員',
|
||||
org_admin: '組織管理員',
|
||||
org_member: '組織成員',
|
||||
test_manager: '測試經理',
|
||||
test_user: '測試人員',
|
||||
test_viewer: '只讀用戶',
|
||||
|
Loading…
Reference in New Issue
Block a user