This commit is contained in:
chenjianxing 2020-06-08 16:34:23 +08:00
commit 8333367ca0
5 changed files with 35 additions and 8 deletions

View File

@ -123,6 +123,10 @@ public class OrganizationService {
list.add(r.getParentId());
}
});
// ignore list size is 0
list.add("no_such_id");
OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andIdIn(list);
return organizationMapper.selectByExample(organizationExample);

View File

@ -195,6 +195,17 @@ public class UserService {
String userId = user.getId();
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andUserIdEqualTo(userId);
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
List<String> list = userRoles.stream().map(UserRole::getSourceId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(list)) {
if (list.contains(user.getLastWorkspaceId()) || list.contains(user.getLastOrganizationId())) {
user.setLastOrganizationId("");
user.setLastWorkspaceId("");
userMapper.updateByPrimaryKeySelective(user);
}
}
userRoleMapper.deleteByExample(userRoleExample);
List<Map<String, Object>> roles = user.getRoles();
if (!roles.isEmpty()) {
@ -275,6 +286,14 @@ public class UserService {
UserRoleExample example = new UserRoleExample();
example.createCriteria().andRoleIdLike("%test%")
.andUserIdEqualTo(userId).andSourceIdEqualTo(workspaceId);
User user = userMapper.selectByPrimaryKey(userId);
if (StringUtils.equals(workspaceId, user.getLastWorkspaceId())) {
user.setLastWorkspaceId("");
user.setLastOrganizationId("");
userMapper.updateByPrimaryKeySelective(user);
}
userRoleMapper.deleteByExample(example);
}
@ -305,6 +324,14 @@ public class UserService {
public void delOrganizationMember(String organizationId, String userId) {
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andRoleIdLike("%org%").andUserIdEqualTo(userId).andSourceIdEqualTo(organizationId);
User user = userMapper.selectByPrimaryKey(userId);
if (StringUtils.equals(organizationId, user.getLastOrganizationId())) {
user.setLastWorkspaceId("");
user.setLastOrganizationId("");
userMapper.updateByPrimaryKeySelective(user);
}
userRoleMapper.deleteByExample(userRoleExample);
}

View File

@ -301,9 +301,6 @@
});
},
createTestResourcePool(createTestResourcePoolForm) {
if (this.result.loading) {
return;
}
this.$refs[createTestResourcePoolForm].validate(valid => {
if (valid) {
let vri = this.validateResourceInfo();
@ -340,9 +337,6 @@
this.form.resources = resources;
},
updateTestResourcePool(updateTestResourcePoolForm) {
if (this.result.loading) {
return;
}
this.$refs[updateTestResourcePoolForm].validate(valid => {
if (valid) {
let vri = this.validateResourceInfo();

View File

@ -336,11 +336,11 @@
rule: {
id: [
{required: true, message: this.$t('user.input_id'), trigger: 'blur'},
{min: 2, max: 20, message: this.$t('commons.input_limit', [2, 20]), trigger: 'blur'}
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}
],
name: [
{required: true, message: this.$t('user.input_name'), trigger: 'blur'},
{min: 2, max: 20, message: this.$t('commons.input_limit', [2, 20]), trigger: 'blur'},
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'},
{
required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,

View File

@ -18,6 +18,8 @@ export default {
let login = function () {
MessageBox.alert(i18n.t('commons.tips'), i18n.t('commons.prompt'), {
callback: () => {
axios.get("/signout");
localStorage.setItem('Admin-Token', "{}");
window.location.href = "/login"
}
});