mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-08 01:48:33 +08:00
combine role group
This commit is contained in:
parent
d51b68ce73
commit
a605bf60be
@ -23,7 +23,7 @@ import java.util.List;
|
||||
|
||||
import org.maxkey.authn.SignPrincipal;
|
||||
import org.maxkey.authn.realm.ldap.LdapAuthenticationRealmService;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.entity.HistoryLogin;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
import org.maxkey.persistence.repository.LoginHistoryRepository;
|
||||
@ -85,8 +85,8 @@ public abstract class AbstractAuthenticationRealm {
|
||||
|
||||
public abstract boolean passwordMatches(UserInfo userInfo, String password);
|
||||
|
||||
public List<Groups> queryGroups(UserInfo userInfo) {
|
||||
return loginRepository.queryGroups(userInfo);
|
||||
public List<Roles> queryGroups(UserInfo userInfo) {
|
||||
return loginRepository.queryRoles(userInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -25,8 +25,6 @@ public class ConstsEntryType {
|
||||
|
||||
public static String APPLICATION = "application";
|
||||
|
||||
public static String GROUP = "group";
|
||||
|
||||
public static String ACCOUNT = "account";
|
||||
|
||||
public static String ROLE = "role";
|
||||
|
||||
@ -1,219 +0,0 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.maxkey.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
|
||||
/*
|
||||
ID varchar(40) not null,
|
||||
APPROLEID varchar(40) null,
|
||||
USERID varchar(40) null
|
||||
constraint PK_ROLES primary key clustered (ID)
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "MXK_GROUP_MEMBER")
|
||||
public class GroupMember extends UserInfo implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8059639972590554760L;
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue(strategy=GenerationType.AUTO,generator="snowflakeid")
|
||||
String id;
|
||||
@Column
|
||||
private String groupId;
|
||||
private String groupName;
|
||||
private String dynamic;
|
||||
@Column
|
||||
private String memberId;
|
||||
private String memberName;
|
||||
@Column
|
||||
private String type;//User or Group
|
||||
|
||||
@Column
|
||||
private String instId;
|
||||
|
||||
private String instName;
|
||||
|
||||
public GroupMember(){
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param groupId
|
||||
* @param memberId
|
||||
* @param type
|
||||
*/
|
||||
public GroupMember(String groupId, String memberId, String type , String instId) {
|
||||
super();
|
||||
this.groupId = groupId;
|
||||
this.memberId = memberId;
|
||||
this.type = type;
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
|
||||
public GroupMember(String groupId, String groupName, String memberId,
|
||||
String memberName, String type , String instId) {
|
||||
super();
|
||||
this.groupId = groupId;
|
||||
this.groupName = groupName;
|
||||
this.memberId = memberId;
|
||||
this.memberName = memberName;
|
||||
this.type = type;
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the groupId
|
||||
*/
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param groupId the groupId to set
|
||||
*/
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the memberId
|
||||
*/
|
||||
public String getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param memberId the memberId to set
|
||||
*/
|
||||
public void setMemberId(String memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the groupName
|
||||
*/
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param groupName the groupName to set
|
||||
*/
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
|
||||
public String getMemberName() {
|
||||
return memberName;
|
||||
}
|
||||
|
||||
public void setMemberName(String memberName) {
|
||||
this.memberName = memberName;
|
||||
}
|
||||
|
||||
public String getDynamic() {
|
||||
return dynamic;
|
||||
}
|
||||
|
||||
public void setDynamic(String dynamic) {
|
||||
this.dynamic = dynamic;
|
||||
}
|
||||
|
||||
public String getInstId() {
|
||||
return instId;
|
||||
}
|
||||
|
||||
|
||||
public void setInstId(String instId) {
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
|
||||
public String getInstName() {
|
||||
return instName;
|
||||
}
|
||||
|
||||
|
||||
public void setInstName(String instName) {
|
||||
this.instName = instName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GroupMember [id=");
|
||||
builder.append(id);
|
||||
builder.append(", groupId=");
|
||||
builder.append(groupId);
|
||||
builder.append(", groupName=");
|
||||
builder.append(groupName);
|
||||
builder.append(", memberId=");
|
||||
builder.append(memberId);
|
||||
builder.append(", memberName=");
|
||||
builder.append(memberName);
|
||||
builder.append(", type=");
|
||||
builder.append(type);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,271 +0,0 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.maxkey.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
@Entity
|
||||
@Table(name = "MXK_GROUPS")
|
||||
public class Groups extends JpaBaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4660258495864814777L;
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid")
|
||||
String id;
|
||||
|
||||
@Length(max = 60)
|
||||
@Column
|
||||
String name;
|
||||
|
||||
@Column
|
||||
String dynamic;
|
||||
|
||||
@Column
|
||||
String filters ;
|
||||
|
||||
@Column
|
||||
String orgIdsList;
|
||||
@Column
|
||||
String resumeTime;
|
||||
@Column
|
||||
String suspendTime;
|
||||
|
||||
@Column
|
||||
int isdefault;
|
||||
@Column
|
||||
String description;
|
||||
@Column
|
||||
String createdBy;
|
||||
@Column
|
||||
String createdDate;
|
||||
@Column
|
||||
String modifiedBy;
|
||||
@Column
|
||||
String modifiedDate;
|
||||
@Column
|
||||
int status;
|
||||
|
||||
@Column
|
||||
private String instId;
|
||||
|
||||
private String instName;
|
||||
|
||||
public Groups() {
|
||||
}
|
||||
|
||||
public Groups(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups.
|
||||
* @param id String
|
||||
* @param name String
|
||||
* @param isdefault int
|
||||
*/
|
||||
public Groups(String id, String name, int isdefault) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.isdefault = isdefault;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getIsdefault() {
|
||||
return isdefault;
|
||||
}
|
||||
|
||||
public void setIsdefault(int isdefault) {
|
||||
this.isdefault = isdefault;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
public void setCreatedDate(String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
public String getModifiedBy() {
|
||||
return modifiedBy;
|
||||
}
|
||||
|
||||
public void setModifiedBy(String modifiedBy) {
|
||||
this.modifiedBy = modifiedBy;
|
||||
}
|
||||
|
||||
public String getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
|
||||
public void setModifiedDate(String modifiedDate) {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ROLE_ALL_USER must be
|
||||
* 1, dynamic
|
||||
* 2, all orgIdsList
|
||||
* 3, not filters
|
||||
*/
|
||||
public void setDefaultAllUser() {
|
||||
this.dynamic = "1";
|
||||
this.orgIdsList ="";
|
||||
this.filters ="";
|
||||
}
|
||||
|
||||
public String getDynamic() {
|
||||
return dynamic;
|
||||
}
|
||||
|
||||
public void setDynamic(String dynamic) {
|
||||
this.dynamic = dynamic;
|
||||
}
|
||||
|
||||
public String getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(String filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public String getOrgIdsList() {
|
||||
return orgIdsList;
|
||||
}
|
||||
|
||||
public void setOrgIdsList(String orgIdsList) {
|
||||
this.orgIdsList = orgIdsList;
|
||||
}
|
||||
|
||||
public String getResumeTime() {
|
||||
return resumeTime;
|
||||
}
|
||||
|
||||
public void setResumeTime(String resumeTime) {
|
||||
this.resumeTime = resumeTime;
|
||||
}
|
||||
|
||||
public String getSuspendTime() {
|
||||
return suspendTime;
|
||||
}
|
||||
|
||||
public void setSuspendTime(String suspendTime) {
|
||||
this.suspendTime = suspendTime;
|
||||
}
|
||||
|
||||
public String getInstId() {
|
||||
return instId;
|
||||
}
|
||||
|
||||
public void setInstId(String instId) {
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
public String getInstName() {
|
||||
return instName;
|
||||
}
|
||||
|
||||
public void setInstName(String instName) {
|
||||
this.instName = instName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Groups [id=");
|
||||
builder.append(id);
|
||||
builder.append(", name=");
|
||||
builder.append(name);
|
||||
builder.append(", dynamic=");
|
||||
builder.append(dynamic);
|
||||
builder.append(", filters=");
|
||||
builder.append(filters);
|
||||
builder.append(", orgIdsList=");
|
||||
builder.append(orgIdsList);
|
||||
builder.append(", resumeTime=");
|
||||
builder.append(resumeTime);
|
||||
builder.append(", suspendTime=");
|
||||
builder.append(suspendTime);
|
||||
builder.append(", isdefault=");
|
||||
builder.append(isdefault);
|
||||
builder.append(", description=");
|
||||
builder.append(description);
|
||||
builder.append(", createdBy=");
|
||||
builder.append(createdBy);
|
||||
builder.append(", createdDate=");
|
||||
builder.append(createdDate);
|
||||
builder.append(", modifiedBy=");
|
||||
builder.append(modifiedBy);
|
||||
builder.append(", modifiedDate=");
|
||||
builder.append(modifiedDate);
|
||||
builder.append(", status=");
|
||||
builder.append(status);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,189 +0,0 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.maxkey.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||
|
||||
@Entity
|
||||
@Table(name = "MXK_NOTICES")
|
||||
public class Notices extends JpaBaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -652272084068874816L;
|
||||
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid")
|
||||
protected String id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Column
|
||||
private String title;
|
||||
|
||||
@Column
|
||||
private String content;
|
||||
|
||||
@Column
|
||||
private int status;
|
||||
|
||||
@Column
|
||||
protected String createdBy;
|
||||
@Column
|
||||
protected String createdDate;
|
||||
@Column
|
||||
protected String modifiedBy;
|
||||
@Column
|
||||
protected String modifiedDate;
|
||||
@Column
|
||||
protected String description;
|
||||
@Column
|
||||
private String instId;
|
||||
|
||||
private String instName;
|
||||
|
||||
public Notices() {
|
||||
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
public void setCreatedDate(String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
public String getModifiedBy() {
|
||||
return modifiedBy;
|
||||
}
|
||||
|
||||
public void setModifiedBy(String modifiedBy) {
|
||||
this.modifiedBy = modifiedBy;
|
||||
}
|
||||
|
||||
public String getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
|
||||
public void setModifiedDate(String modifiedDate) {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getInstId() {
|
||||
return instId;
|
||||
}
|
||||
|
||||
public void setInstId(String instId) {
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
public String getInstName() {
|
||||
return instName;
|
||||
}
|
||||
|
||||
public void setInstName(String instName) {
|
||||
this.instName = instName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Notices [id=");
|
||||
builder.append(id);
|
||||
builder.append(", title=");
|
||||
builder.append(title);
|
||||
builder.append(", content=");
|
||||
builder.append(content);
|
||||
builder.append(", status=");
|
||||
builder.append(status);
|
||||
builder.append(", createdBy=");
|
||||
builder.append(createdBy);
|
||||
builder.append(", createdDate=");
|
||||
builder.append(createdDate);
|
||||
builder.append(", modifiedBy=");
|
||||
builder.append(modifiedBy);
|
||||
builder.append(", modifiedDate=");
|
||||
builder.append(modifiedDate);
|
||||
builder.append(", description=");
|
||||
builder.append(description);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -18,6 +18,7 @@
|
||||
package org.maxkey.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@ -25,6 +26,7 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
|
||||
/*
|
||||
ID varchar(40) not null,
|
||||
APPROLEID varchar(40) null,
|
||||
@ -32,56 +34,133 @@ import javax.persistence.Table;
|
||||
constraint PK_ROLES primary key clustered (ID)
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "MXK_ROLE_MEMBER")
|
||||
public class RoleMember extends UserInfo implements Serializable {
|
||||
private static final long serialVersionUID = -8059639972590554760L;
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid")
|
||||
String id;
|
||||
@Column
|
||||
private String roleId;
|
||||
private String roleName;
|
||||
private String dynamic;
|
||||
@Column
|
||||
private String memberId;
|
||||
private String memberName;
|
||||
@Column
|
||||
private String type;// User or Roles
|
||||
@Table(name = "MXK_ROLE_MEMBER")
|
||||
public class RoleMember extends UserInfo implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8059639972590554760L;
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue(strategy=GenerationType.AUTO,generator="snowflakeid")
|
||||
String id;
|
||||
@Column
|
||||
private String roleId;
|
||||
private String roleName;
|
||||
private String dynamic;
|
||||
@Column
|
||||
private String memberId;
|
||||
private String memberName;
|
||||
@Column
|
||||
private String type;//User or Group
|
||||
|
||||
@Column
|
||||
private String instId;
|
||||
|
||||
private String instName;
|
||||
|
||||
public RoleMember() {
|
||||
super();
|
||||
}
|
||||
public RoleMember(){
|
||||
super();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param groupId
|
||||
* @param memberId
|
||||
* @param type
|
||||
*/
|
||||
public RoleMember(String roleId, String memberId, String type , String instId) {
|
||||
super();
|
||||
this.roleId = roleId;
|
||||
this.memberId = memberId;
|
||||
this.type = type;
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
public RoleMember(String roleId, String roleName, String memberId,
|
||||
String memberName, String type , String instId) {
|
||||
super();
|
||||
this.roleId = roleId;
|
||||
this.roleName = roleName;
|
||||
this.memberId = memberId;
|
||||
this.memberName = memberName;
|
||||
this.type = type;
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getRoleName() {
|
||||
return roleName;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
public String getDynamic() {
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
|
||||
public String getRoleName() {
|
||||
return roleName;
|
||||
}
|
||||
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the memberId
|
||||
*/
|
||||
public String getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param memberId the memberId to set
|
||||
*/
|
||||
public void setMemberId(String memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getMemberName() {
|
||||
return memberName;
|
||||
}
|
||||
|
||||
public void setMemberName(String memberName) {
|
||||
this.memberName = memberName;
|
||||
}
|
||||
|
||||
public String getDynamic() {
|
||||
return dynamic;
|
||||
}
|
||||
|
||||
@ -89,82 +168,50 @@ public class RoleMember extends UserInfo implements Serializable {
|
||||
this.dynamic = dynamic;
|
||||
}
|
||||
|
||||
public String getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(String memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public String getMemberName() {
|
||||
return memberName;
|
||||
}
|
||||
|
||||
public void setMemberName(String memberName) {
|
||||
this.memberName = memberName;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getInstId() {
|
||||
public String getInstId() {
|
||||
return instId;
|
||||
}
|
||||
|
||||
|
||||
public void setInstId(String instId) {
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
|
||||
public String getInstName() {
|
||||
return instName;
|
||||
}
|
||||
|
||||
|
||||
public void setInstName(String instName) {
|
||||
this.instName = instName;
|
||||
}
|
||||
|
||||
public RoleMember(String roleId, String memberId, String type , String instId) {
|
||||
super();
|
||||
this.roleId = roleId;
|
||||
this.memberId = memberId;
|
||||
this.type = type;
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
|
||||
public RoleMember(String roleId, String roleName, String memberId, String memberName, String type ,String instId) {
|
||||
super();
|
||||
this.roleId = roleId;
|
||||
this.roleName = roleName;
|
||||
this.memberId = memberId;
|
||||
this.memberName = memberName;
|
||||
this.type = type;
|
||||
this.instId = instId;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("RoleMember [id=");
|
||||
builder.append(id);
|
||||
builder.append(", roleId=");
|
||||
builder.append(roleId);
|
||||
builder.append(", roleName=");
|
||||
builder.append(roleName);
|
||||
builder.append(", dynamic=");
|
||||
builder.append(dynamic);
|
||||
builder.append(", memberId=");
|
||||
builder.append(memberId);
|
||||
builder.append(", memberName=");
|
||||
builder.append(memberName);
|
||||
builder.append(", type=");
|
||||
builder.append(type);
|
||||
builder.append(", instId=");
|
||||
builder.append(instId);
|
||||
builder.append(", instName=");
|
||||
builder.append(instName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("RoleMember [id=");
|
||||
builder.append(id);
|
||||
builder.append(", roleId=");
|
||||
builder.append(roleId);
|
||||
builder.append(", roleName=");
|
||||
builder.append(roleName);
|
||||
builder.append(", memberId=");
|
||||
builder.append(memberId);
|
||||
builder.append(", memberName=");
|
||||
builder.append(memberName);
|
||||
builder.append(", type=");
|
||||
builder.append(type);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -36,8 +36,8 @@ import org.maxkey.entity.apps.Apps;
|
||||
constraint PK_ROLES primary key clustered (ID)
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "MXK_GROUP_PRIVILEGES")
|
||||
public class GroupPrivileges extends Apps implements Serializable{
|
||||
@Table(name = "MXK_ROLE_PERMISSIONS")
|
||||
public class RolePermissions extends Apps implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
@ -48,9 +48,9 @@ public class GroupPrivileges extends Apps implements Serializable{
|
||||
@GeneratedValue(strategy=GenerationType.AUTO,generator="snowflakeid")
|
||||
String id;
|
||||
@Column
|
||||
private String groupId;
|
||||
private String roleId;
|
||||
|
||||
private String groupName;
|
||||
private String roleName;
|
||||
|
||||
@Column
|
||||
private String appId;
|
||||
@ -62,7 +62,7 @@ public class GroupPrivileges extends Apps implements Serializable{
|
||||
|
||||
private String instName;
|
||||
|
||||
public GroupPrivileges(){
|
||||
public RolePermissions(){
|
||||
super();
|
||||
}
|
||||
|
||||
@ -71,26 +71,34 @@ public class GroupPrivileges extends Apps implements Serializable{
|
||||
* @param groupId
|
||||
* @param appId
|
||||
*/
|
||||
public GroupPrivileges(String groupId, String appId, String instId) {
|
||||
public RolePermissions(String roleId, String appId, String instId) {
|
||||
super();
|
||||
this.groupId = groupId;
|
||||
this.roleId = roleId;
|
||||
this.appId = appId;
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the groupId
|
||||
*/
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
public String getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
/**
|
||||
* @param groupId the groupId to set
|
||||
*/
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
|
||||
|
||||
public void setRoleId(String roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
|
||||
public String getRoleName() {
|
||||
return roleName;
|
||||
}
|
||||
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the appId
|
||||
*/
|
||||
@ -135,15 +143,6 @@ public class GroupPrivileges extends Apps implements Serializable{
|
||||
}
|
||||
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
@ -156,17 +155,25 @@ public class GroupPrivileges extends Apps implements Serializable{
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GroupPrivileges [id=");
|
||||
builder.append(id);
|
||||
builder.append(", groupId=");
|
||||
builder.append(groupId);
|
||||
builder.append(", appId=");
|
||||
builder.append(appId);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("RolePermissions [id=");
|
||||
builder.append(id);
|
||||
builder.append(", roleId=");
|
||||
builder.append(roleId);
|
||||
builder.append(", roleName=");
|
||||
builder.append(roleName);
|
||||
builder.append(", appId=");
|
||||
builder.append(appId);
|
||||
builder.append(", appName=");
|
||||
builder.append(appName);
|
||||
builder.append(", instId=");
|
||||
builder.append(instId);
|
||||
builder.append(", instName=");
|
||||
builder.append(instName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -25,18 +25,21 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
@Entity
|
||||
@Table(name = "MXK_ROLES")
|
||||
public class Roles extends JpaBaseEntity implements Serializable {
|
||||
private static final long serialVersionUID = -7515832728504943821L;
|
||||
|
||||
|
||||
private static final long serialVersionUID = 4660258495864814777L;
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue(strategy = GenerationType.AUTO,generator = "snowflakeid")
|
||||
private String id;
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid")
|
||||
String id;
|
||||
|
||||
@Length(max = 60)
|
||||
@Column
|
||||
private String name;
|
||||
String name;
|
||||
|
||||
@Column
|
||||
String dynamic;
|
||||
|
||||
@ -49,8 +52,9 @@ public class Roles extends JpaBaseEntity implements Serializable {
|
||||
String resumeTime;
|
||||
@Column
|
||||
String suspendTime;
|
||||
|
||||
@Column
|
||||
String status;
|
||||
int isdefault;
|
||||
@Column
|
||||
String description;
|
||||
@Column
|
||||
@ -61,23 +65,34 @@ public class Roles extends JpaBaseEntity implements Serializable {
|
||||
String modifiedBy;
|
||||
@Column
|
||||
String modifiedDate;
|
||||
@Column
|
||||
int status;
|
||||
|
||||
@Column
|
||||
private String instId;
|
||||
|
||||
private String instName;
|
||||
|
||||
|
||||
public Roles() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
public Roles(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups.
|
||||
* @param id String
|
||||
* @param name String
|
||||
* @param isdefault int
|
||||
*/
|
||||
public Roles(String id, String name, int isdefault) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.isdefault = isdefault;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@ -86,12 +101,20 @@ public class Roles extends JpaBaseEntity implements Serializable {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getIsdefault() {
|
||||
return isdefault;
|
||||
}
|
||||
|
||||
public void setIsdefault(int isdefault) {
|
||||
this.isdefault = isdefault;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
@ -134,6 +157,26 @@ public class Roles extends JpaBaseEntity implements Serializable {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ROLE_ALL_USER must be
|
||||
* 1, dynamic
|
||||
* 2, all orgIdsList
|
||||
* 3, not filters
|
||||
*/
|
||||
public void setDefaultAllUser() {
|
||||
this.dynamic = "1";
|
||||
this.orgIdsList ="";
|
||||
this.filters ="";
|
||||
}
|
||||
|
||||
public String getDynamic() {
|
||||
return dynamic;
|
||||
}
|
||||
@ -159,22 +202,22 @@ public class Roles extends JpaBaseEntity implements Serializable {
|
||||
}
|
||||
|
||||
public String getResumeTime() {
|
||||
return resumeTime;
|
||||
}
|
||||
return resumeTime;
|
||||
}
|
||||
|
||||
public void setResumeTime(String resumeTime) {
|
||||
this.resumeTime = resumeTime;
|
||||
}
|
||||
public void setResumeTime(String resumeTime) {
|
||||
this.resumeTime = resumeTime;
|
||||
}
|
||||
|
||||
public String getSuspendTime() {
|
||||
return suspendTime;
|
||||
}
|
||||
public String getSuspendTime() {
|
||||
return suspendTime;
|
||||
}
|
||||
|
||||
public void setSuspendTime(String suspendTime) {
|
||||
this.suspendTime = suspendTime;
|
||||
}
|
||||
public void setSuspendTime(String suspendTime) {
|
||||
this.suspendTime = suspendTime;
|
||||
}
|
||||
|
||||
public String getInstId() {
|
||||
public String getInstId() {
|
||||
return instId;
|
||||
}
|
||||
|
||||
@ -193,7 +236,7 @@ public class Roles extends JpaBaseEntity implements Serializable {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Roles [id=");
|
||||
builder.append("Groups [id=");
|
||||
builder.append(id);
|
||||
builder.append(", name=");
|
||||
builder.append(name);
|
||||
@ -203,8 +246,12 @@ public class Roles extends JpaBaseEntity implements Serializable {
|
||||
builder.append(filters);
|
||||
builder.append(", orgIdsList=");
|
||||
builder.append(orgIdsList);
|
||||
builder.append(", status=");
|
||||
builder.append(status);
|
||||
builder.append(", resumeTime=");
|
||||
builder.append(resumeTime);
|
||||
builder.append(", suspendTime=");
|
||||
builder.append(suspendTime);
|
||||
builder.append(", isdefault=");
|
||||
builder.append(isdefault);
|
||||
builder.append(", description=");
|
||||
builder.append(description);
|
||||
builder.append(", createdBy=");
|
||||
@ -215,10 +262,10 @@ public class Roles extends JpaBaseEntity implements Serializable {
|
||||
builder.append(modifiedBy);
|
||||
builder.append(", modifiedDate=");
|
||||
builder.append(modifiedDate);
|
||||
builder.append(", status=");
|
||||
builder.append(status);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.maxkey.constants.ConstsStatus;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
import org.maxkey.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -51,7 +51,7 @@ public class LoginRepository {
|
||||
|
||||
|
||||
|
||||
private static final String GROUPS_SELECT_STATEMENT = "select distinct g.id,g.name from mxk_userinfo u,mxk_groups g,mxk_group_member gm where u.id = ? and u.id=gm.memberid and gm.groupid=g.id ";
|
||||
private static final String ROLES_SELECT_STATEMENT = "select distinct r.id,r.name from mxk_userinfo u,mxk_roles r,mxk_role_member rm where u.id = ? and u.id=rm.memberid and rm.roleid=r.id ";
|
||||
|
||||
private static final String DEFAULT_USERINFO_SELECT_STATEMENT = "select * from mxk_userinfo where username = ? ";
|
||||
|
||||
@ -59,7 +59,7 @@ public class LoginRepository {
|
||||
|
||||
private static final String DEFAULT_USERINFO_SELECT_STATEMENT_USERNAME_MOBILE_EMAIL = "select * from mxk_userinfo where (username = ? or mobile = ? or email = ?) ";
|
||||
|
||||
private static final String DEFAULT_MYAPPS_SELECT_STATEMENT = "select distinct app.id,app.name from mxk_apps app,mxk_group_privileges gp,mxk_groups g where app.id=gp.appid and gp.groupid=g.id and g.id in(%s)";
|
||||
private static final String DEFAULT_MYAPPS_SELECT_STATEMENT = "select distinct app.id,app.name from mxk_apps app,mxk_role_permissions pm,mxk_roles r where app.id=pm.appid and pm.roleid=r.id and r.id in(%s)";
|
||||
|
||||
protected JdbcTemplate jdbcTemplate;
|
||||
|
||||
@ -211,17 +211,17 @@ public class LoginRepository {
|
||||
return listAuthorizedApps;
|
||||
}
|
||||
|
||||
public List<Groups> queryGroups(UserInfo userInfo) {
|
||||
List<Groups> listGroups = jdbcTemplate.query(GROUPS_SELECT_STATEMENT, new RowMapper<Groups>() {
|
||||
public Groups mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
Groups group = new Groups(rs.getString("id"), rs.getString("name"), 0);
|
||||
public List<Roles> queryRoles(UserInfo userInfo) {
|
||||
List<Roles> listRoles = jdbcTemplate.query(ROLES_SELECT_STATEMENT, new RowMapper<Roles>() {
|
||||
public Roles mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
Roles role = new Roles(rs.getString("id"), rs.getString("name"), 0);
|
||||
|
||||
return group;
|
||||
return role;
|
||||
}
|
||||
}, userInfo.getId());
|
||||
|
||||
_logger.debug("list Groups " + listGroups);
|
||||
return listGroups;
|
||||
_logger.debug("list Roles " + listRoles);
|
||||
return listRoles;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -232,14 +232,14 @@ public class LoginRepository {
|
||||
*/
|
||||
public ArrayList<GrantedAuthority> grantAuthority(UserInfo userInfo) {
|
||||
// query roles for user
|
||||
List<Groups> listGroups = queryGroups(userInfo);
|
||||
List<Roles> listGroups = queryRoles(userInfo);
|
||||
|
||||
//set default roles
|
||||
ArrayList<GrantedAuthority> grantedAuthority = new ArrayList<GrantedAuthority>();
|
||||
grantedAuthority.add(new SimpleGrantedAuthority("ROLE_USER"));
|
||||
grantedAuthority.add(new SimpleGrantedAuthority("ROLE_ORDINARY_USER"));
|
||||
grantedAuthority.add(new SimpleGrantedAuthority("ROLE_ALL_USER"));
|
||||
for (Groups group : listGroups) {
|
||||
for (Roles group : listGroups) {
|
||||
grantedAuthority.add(new SimpleGrantedAuthority(group.getId()));
|
||||
}
|
||||
_logger.debug("Authority : " + grantedAuthority);
|
||||
|
||||
@ -24,15 +24,15 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
import org.maxkey.identity.scim.resources.ScimGroup;
|
||||
import org.maxkey.identity.scim.resources.ScimMemberRef;
|
||||
import org.maxkey.identity.scim.resources.ScimMeta;
|
||||
import org.maxkey.identity.scim.resources.ScimParameters;
|
||||
import org.maxkey.identity.scim.resources.ScimSearchResult;
|
||||
import org.maxkey.persistence.service.GroupMemberService;
|
||||
import org.maxkey.persistence.service.GroupsService;
|
||||
import org.maxkey.persistence.service.RoleMemberService;
|
||||
import org.maxkey.persistence.service.RolesService;
|
||||
import org.maxkey.util.DateUtils;
|
||||
import org.maxkey.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -56,17 +56,17 @@ public class ScimGroupController {
|
||||
final static Logger _logger = LoggerFactory.getLogger(ScimGroupController.class);
|
||||
|
||||
@Autowired
|
||||
GroupsService groupsService;
|
||||
RolesService rolesService;
|
||||
|
||||
@Autowired
|
||||
GroupMemberService groupMemberService;
|
||||
RoleMemberService roleMemberService;
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
public MappingJacksonValue get(@PathVariable String id,
|
||||
@RequestParam(required = false) String attributes) {
|
||||
Groups groups = groupsService.get(id);
|
||||
ScimGroup scimGroup = group2ScimGroup(groups);
|
||||
List<UserInfo> userList = groupMemberService.queryMemberByGroupId(id);
|
||||
Roles role = rolesService.get(id);
|
||||
ScimGroup scimGroup = role2ScimGroup(role);
|
||||
List<UserInfo> userList = roleMemberService.queryMemberByRoleId(id);
|
||||
if(userList != null && userList.size() > 0) {
|
||||
Set<ScimMemberRef> members = new HashSet<ScimMemberRef>();
|
||||
for (UserInfo user : userList) {
|
||||
@ -81,9 +81,9 @@ public class ScimGroupController {
|
||||
public MappingJacksonValue create(@RequestBody ScimGroup scimGroup,
|
||||
@RequestParam(required = false) String attributes,
|
||||
UriComponentsBuilder builder) throws IOException {
|
||||
Groups group =scimGroup2Group(scimGroup);
|
||||
groupsService.insert(group);
|
||||
return get(group.getId(),attributes);
|
||||
Roles role =scimGroup2Role(scimGroup);
|
||||
rolesService.insert(role);
|
||||
return get(role.getId(),attributes);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
|
||||
@ -91,15 +91,15 @@ public class ScimGroupController {
|
||||
@RequestBody ScimGroup scimGroup,
|
||||
@RequestParam(required = false) String attributes)
|
||||
throws IOException {
|
||||
Groups group =scimGroup2Group(scimGroup);
|
||||
groupsService.update(group);
|
||||
return get(group.getId(),attributes);
|
||||
Roles role =scimGroup2Role(scimGroup);
|
||||
rolesService.update(role);
|
||||
return get(role.getId(),attributes);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public void delete(@PathVariable final String id) {
|
||||
groupsService.remove(id);
|
||||
rolesService.remove(id);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ -111,14 +111,14 @@ public class ScimGroupController {
|
||||
public MappingJacksonValue searchWithPost(@ModelAttribute ScimParameters requestParameters) {
|
||||
requestParameters.parse();
|
||||
_logger.debug("requestParameters {} ",requestParameters);
|
||||
Groups queryModel = new Groups();
|
||||
Roles queryModel = new Roles();
|
||||
queryModel.setPageSize(requestParameters.getCount());
|
||||
queryModel.calculate(requestParameters.getStartIndex());
|
||||
|
||||
JpaPageResults<Groups> orgResults = groupsService.queryPageResults(queryModel);
|
||||
JpaPageResults<Roles> orgResults = rolesService.queryPageResults(queryModel);
|
||||
List<ScimGroup> resultList = new ArrayList<ScimGroup>();
|
||||
for(Groups group : orgResults.getRows()) {
|
||||
resultList.add(group2ScimGroup(group));
|
||||
for(Roles group : orgResults.getRows()) {
|
||||
resultList.add(role2ScimGroup(group));
|
||||
}
|
||||
ScimSearchResult<ScimGroup> scimSearchResult =
|
||||
new ScimSearchResult<ScimGroup>(
|
||||
@ -129,7 +129,7 @@ public class ScimGroupController {
|
||||
return new MappingJacksonValue(scimSearchResult);
|
||||
}
|
||||
|
||||
public ScimGroup group2ScimGroup(Groups group) {
|
||||
public ScimGroup role2ScimGroup(Roles group) {
|
||||
ScimGroup scimGroup = new ScimGroup();
|
||||
scimGroup.setId(group.getId());
|
||||
scimGroup.setExternalId(group.getId());
|
||||
@ -149,10 +149,10 @@ public class ScimGroupController {
|
||||
return scimGroup;
|
||||
}
|
||||
|
||||
public Groups scimGroup2Group(ScimGroup scimGroup) {
|
||||
Groups group = new Groups();
|
||||
group.setId(scimGroup.getId());
|
||||
group.setName(scimGroup.getDisplayName());
|
||||
return group;
|
||||
public Roles scimGroup2Role(ScimGroup scimGroup) {
|
||||
Roles role = new Roles();
|
||||
role.setId(scimGroup.getId());
|
||||
role.setName(scimGroup.getDisplayName());
|
||||
return role;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.constants.ConstsStatus;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
import org.maxkey.identity.scim.resources.ScimEnterprise;
|
||||
import org.maxkey.identity.scim.resources.ScimGroupRef;
|
||||
@ -36,7 +36,7 @@ import org.maxkey.identity.scim.resources.ScimUser;
|
||||
import org.maxkey.identity.scim.resources.ScimUserEmail;
|
||||
import org.maxkey.identity.scim.resources.ScimFormattedName;
|
||||
import org.maxkey.identity.scim.resources.ScimUserPhoneNumber;
|
||||
import org.maxkey.persistence.service.GroupsService;
|
||||
import org.maxkey.persistence.service.RolesService;
|
||||
import org.maxkey.persistence.service.UserInfoService;
|
||||
import org.maxkey.util.DateUtils;
|
||||
import org.maxkey.util.StringUtils;
|
||||
@ -72,7 +72,7 @@ public class ScimUserController {
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Autowired
|
||||
GroupsService groupsService;
|
||||
RolesService rolesService;
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
public MappingJacksonValue get(@PathVariable String id,
|
||||
@ -168,9 +168,9 @@ public class ScimUserController {
|
||||
|
||||
List<String> groupsList=new ArrayList<String>();
|
||||
List<ScimGroupRef> groups = new ArrayList<ScimGroupRef>();
|
||||
for(Groups group : groupsService.queryGroupByUserId(userInfo.getId())){
|
||||
groupsList.add(group.getId());
|
||||
groups.add(new ScimGroupRef(group.getId(),group.getName()));
|
||||
for(Roles role : rolesService.queryRolesByUserId(userInfo.getId())){
|
||||
groupsList.add(role.getId());
|
||||
groups.add(new ScimGroupRef(role.getId(),role.getName()));
|
||||
|
||||
}
|
||||
scimUser.setGroup(groupsList);
|
||||
|
||||
@ -24,7 +24,7 @@ import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||
import org.maxkey.entity.AccountsStrategy;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.Roles;
|
||||
|
||||
/**
|
||||
* @author Crystal.sea
|
||||
@ -33,5 +33,5 @@ import org.maxkey.entity.Groups;
|
||||
|
||||
public interface AccountsStrategyMapper extends IJpaBaseMapper<AccountsStrategy> {
|
||||
|
||||
public List<Groups> queryDynamicGroups(Groups groups);
|
||||
public List<Roles> queryDynamicGroups(Roles groups);
|
||||
}
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.maxkey.persistence.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||
import org.maxkey.entity.GroupMember;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
|
||||
/**
|
||||
* @author Crystal.sea
|
||||
*
|
||||
*/
|
||||
|
||||
public interface GroupMemberMapper extends IJpaBaseMapper<GroupMember> {
|
||||
|
||||
public List<GroupMember> memberInGroup(GroupMember entity);
|
||||
public List<GroupMember> memberNotInGroup(GroupMember entity);
|
||||
public List<GroupMember> groupMemberInGroup(GroupMember entity);
|
||||
|
||||
public List<Groups> groupsNoMember(GroupMember entity);
|
||||
|
||||
public int addDynamicGroupMember(Groups dynamicGroup);
|
||||
|
||||
public int deleteDynamicGroupMember(Groups dynamicGroup);
|
||||
|
||||
public int deleteByGroupId(String groupId);
|
||||
|
||||
public List<UserInfo> queryMemberByGroupId(String groupId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.maxkey.persistence.mapper;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||
import org.maxkey.entity.Notices;
|
||||
|
||||
/**
|
||||
* @author Crystal.sea
|
||||
*
|
||||
*/
|
||||
public interface NoticesMapper extends IJpaBaseMapper<Notices> {
|
||||
|
||||
public Notices queryLastedNotices();
|
||||
}
|
||||
@ -25,6 +25,7 @@ import java.util.List;
|
||||
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||
import org.maxkey.entity.RoleMember;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
|
||||
/**
|
||||
* @author Crystal.sea
|
||||
@ -35,13 +36,17 @@ public interface RoleMemberMapper extends IJpaBaseMapper<RoleMember> {
|
||||
|
||||
public List<RoleMember> memberInRole(RoleMember entity);
|
||||
public List<RoleMember> memberNotInRole(RoleMember entity);
|
||||
public List<RoleMember> roleMemberInRole(RoleMember entity);
|
||||
|
||||
public List<Roles> rolesNoMember(RoleMember entity);
|
||||
|
||||
public int addDynamicRoleMember(Roles dynamicRole);
|
||||
|
||||
public int deleteDynamicRoleMember(Roles dynamicRole);
|
||||
|
||||
public int deleteByRoleId(String roleId);
|
||||
public int addDynamicRoleMember(Roles dynamicRole);
|
||||
|
||||
public int deleteDynamicRoleMember(Roles dynamicRole);
|
||||
|
||||
public int deleteByRoleId(String roleId);
|
||||
|
||||
public List<UserInfo> queryMemberByRoleId(String roleId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -23,19 +23,19 @@ package org.maxkey.persistence.mapper;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||
import org.maxkey.entity.GroupPrivileges;
|
||||
import org.maxkey.entity.RolePermissions;
|
||||
|
||||
/**
|
||||
* @author Crystal.sea
|
||||
*
|
||||
*/
|
||||
|
||||
public interface GroupPrivilegesMapper extends IJpaBaseMapper<GroupPrivileges> {
|
||||
public interface RolePermissionsMapper extends IJpaBaseMapper<RolePermissions> {
|
||||
|
||||
public List<GroupPrivileges>appsInGroup(GroupPrivileges entity);
|
||||
public List<RolePermissions>appsInRole(RolePermissions entity);
|
||||
|
||||
|
||||
public List<GroupPrivileges> appsNotInGroup(GroupPrivileges entity);
|
||||
public List<RolePermissions> appsNotInRole(RolePermissions entity);
|
||||
|
||||
|
||||
}
|
||||
@ -23,16 +23,19 @@ package org.maxkey.persistence.mapper;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.RolePrivileges;
|
||||
|
||||
/**
|
||||
* @author Crystal.sea
|
||||
*
|
||||
*/
|
||||
|
||||
public interface GroupsMapper extends IJpaBaseMapper<Groups> {
|
||||
|
||||
public List<Groups> queryDynamicGroups(Groups groups);
|
||||
public interface RolePrivilegesMapper extends IJpaBaseMapper<RolePrivileges> {
|
||||
|
||||
public List<Groups> queryGroupByUserId(String userId);
|
||||
public int insertRolePrivileges(List<RolePrivileges> rolePermissionsList);
|
||||
|
||||
public int deleteRolePrivileges(List<RolePrivileges> rolePermissionsList);
|
||||
|
||||
public List<RolePrivileges> queryRolePrivileges(RolePrivileges rolePermissions);
|
||||
|
||||
}
|
||||
@ -23,7 +23,6 @@ package org.maxkey.persistence.mapper;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.IJpaBaseMapper;
|
||||
import org.maxkey.entity.RolePrivileges;
|
||||
import org.maxkey.entity.Roles;
|
||||
|
||||
/**
|
||||
@ -32,12 +31,8 @@ import org.maxkey.entity.Roles;
|
||||
*/
|
||||
|
||||
public interface RolesMapper extends IJpaBaseMapper<Roles> {
|
||||
|
||||
public int insertRolePrivileges(List<RolePrivileges> rolePermissionsList);
|
||||
|
||||
public int deleteRolePrivileges(List<RolePrivileges> rolePermissionsList);
|
||||
|
||||
public List<RolePrivileges> queryRolePrivileges(RolePrivileges rolePermissions);
|
||||
|
||||
public List<Roles> queryDynamicRoles(Roles role);
|
||||
public List<Roles> queryDynamicRoles(Roles groups);
|
||||
|
||||
public List<Roles> queryRolesByUserId(String userId);
|
||||
}
|
||||
|
||||
@ -25,19 +25,15 @@ public class MqProvisionTopic {
|
||||
|
||||
public final static String ORG_TOPIC = "MXK_IDENTITY_ORG_TOPIC";
|
||||
|
||||
public final static String GROUP_TOPIC = "MXK_IDENTITY_GROUP_TOPIC";
|
||||
|
||||
public final static String GROUP_MEMBER_TOPIC = "MXK_IDENTITY_GROUP_MEMBER_TOPIC";
|
||||
|
||||
public final static String ACCOUNT_TOPIC = "MXK_IDENTITY_ACCOUNT_TOPIC";
|
||||
|
||||
public final static String AUTHORITY_ROLE_TOPIC = "MXK_AUTHORITY_ROLE_TOPIC";
|
||||
public final static String ROLE_TOPIC = "MXK_ROLE_TOPIC";
|
||||
|
||||
public final static String AUTHORITY_ROLE_MEMBER_TOPIC = "MXK_AUTHORITY_ROLE_MEMBER_TOPIC";
|
||||
public final static String ROLE_MEMBER_TOPIC = "MXK_ROLE_MEMBER_TOPIC";
|
||||
|
||||
public final static String AUTHORITY_RESOURCE_TOPIC = "MXK_AUTHORITY_RESOURCE_TOPIC";
|
||||
public final static String ROLE_PRIVILEGES_TOPIC = "MXK_ROLE_PRIVILEGES_TOPIC";
|
||||
|
||||
public final static String AUTHORITY_ROLE_PERMISSION_TOPIC = "MXK_AUTHORITY_ROLE_PERMISSION_TOPIC";
|
||||
public final static String RESOURCE_TOPIC = "MXK_RESOURCE_TOPIC";
|
||||
|
||||
public final static String CONNECTOR_HISTORY_TOPIC = "MXK_CONNECTOR_HISTORY_TOPIC";
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.maxkey.entity.AccountsStrategy;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.persistence.mapper.AccountsStrategyMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -55,7 +55,7 @@ public class AccountsStrategyService extends JpaBaseService<AccountsStrategy> i
|
||||
}
|
||||
|
||||
|
||||
public List<Groups> queryDynamicGroups(Groups groups){
|
||||
public List<Roles> queryDynamicGroups(Roles groups){
|
||||
return this.getMapper().queryDynamicGroups(groups);
|
||||
}
|
||||
|
||||
|
||||
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.maxkey.persistence.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.entity.GroupMember;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
import org.maxkey.persistence.mapper.GroupMemberMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class GroupMemberService extends JpaBaseService<GroupMember>{
|
||||
final static Logger _logger = LoggerFactory.getLogger(GroupMemberService.class);
|
||||
|
||||
public GroupMemberService() {
|
||||
super(GroupMemberMapper.class);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.connsec.db.service.BaseService#getMapper()
|
||||
*/
|
||||
@Override
|
||||
public GroupMemberMapper getMapper() {
|
||||
return (GroupMemberMapper)super.getMapper();
|
||||
}
|
||||
|
||||
public int addDynamicGroupMember(Groups dynamicGroup) {
|
||||
return getMapper().addDynamicGroupMember(dynamicGroup);
|
||||
}
|
||||
|
||||
public int deleteDynamicGroupMember(Groups dynamicGroup) {
|
||||
return getMapper().deleteDynamicGroupMember(dynamicGroup);
|
||||
}
|
||||
|
||||
public int deleteByGroupId(String groupId) {
|
||||
return getMapper().deleteByGroupId(groupId);
|
||||
}
|
||||
|
||||
public List<UserInfo> queryMemberByGroupId(String groupId){
|
||||
return getMapper().queryMemberByGroupId(groupId);
|
||||
}
|
||||
|
||||
|
||||
public JpaPageResults<Groups> groupsNoMember(GroupMember entity) {
|
||||
entity.setPageResultSelectUUID(entity.generateId());
|
||||
entity.setStartRow(calculateStartRow(entity.getPageNumber() ,entity.getPageSize()));
|
||||
|
||||
entity.setPageable(true);
|
||||
List<Groups> resultslist = null;
|
||||
try {
|
||||
resultslist = getMapper().groupsNoMember(entity);
|
||||
} catch (Exception e) {
|
||||
_logger.error("queryPageResults Exception " , e);
|
||||
}
|
||||
entity.setPageable(false);
|
||||
Integer totalPage = resultslist.size();
|
||||
|
||||
Integer totalCount = 0;
|
||||
if(entity.getPageNumber() == 1 && totalPage < entity.getPageSize()) {
|
||||
totalCount = totalPage;
|
||||
}else {
|
||||
totalCount = parseCount(getMapper().queryPageResultsCount(entity));
|
||||
}
|
||||
|
||||
return new JpaPageResults<Groups>(entity.getPageNumber(),entity.getPageSize(),totalPage,totalCount,resultslist);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.maxkey.persistence.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.maxkey.constants.ConstsStatus;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.persistence.mapper.GroupsMapper;
|
||||
import org.maxkey.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
@Repository
|
||||
public class GroupsService extends JpaBaseService<Groups> implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4156671926199393550L;
|
||||
|
||||
final static Logger _logger = LoggerFactory.getLogger(GroupsService.class);
|
||||
@JsonIgnore
|
||||
@Autowired
|
||||
@Qualifier("groupMemberService")
|
||||
GroupMemberService groupMemberService;
|
||||
|
||||
public GroupsService() {
|
||||
super(GroupsMapper.class);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.connsec.db.service.BaseService#getMapper()
|
||||
*/
|
||||
@Override
|
||||
public GroupsMapper getMapper() {
|
||||
return (GroupsMapper)super.getMapper();
|
||||
}
|
||||
|
||||
|
||||
public List<Groups> queryDynamicGroups(Groups groups){
|
||||
return this.getMapper().queryDynamicGroups(groups);
|
||||
}
|
||||
|
||||
public boolean deleteById(String groupId) {
|
||||
this.remove(groupId);
|
||||
groupMemberService.deleteByGroupId(groupId);
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<Groups> queryGroupByUserId(String userId){
|
||||
return this.getMapper().queryGroupByUserId(userId);
|
||||
}
|
||||
|
||||
public void refreshDynamicGroups(Groups dynamicGroup){
|
||||
if(dynamicGroup.getDynamic().equals(ConstsStatus.ACTIVE+"")) {
|
||||
boolean isDynamicTimeSupport = false;
|
||||
boolean isBetweenEffectiveTime = false;
|
||||
if(StringUtils.isNotBlank(dynamicGroup.getResumeTime())
|
||||
&&StringUtils.isNotBlank(dynamicGroup.getSuspendTime())
|
||||
&&!dynamicGroup.getSuspendTime().equals("00:00")) {
|
||||
LocalTime currentTime = LocalDateTime.now().toLocalTime();
|
||||
LocalTime resumeTime = LocalTime.parse(dynamicGroup.getResumeTime());
|
||||
LocalTime suspendTime = LocalTime.parse(dynamicGroup.getSuspendTime());
|
||||
|
||||
_logger.info("currentTime: " + currentTime
|
||||
+ " , resumeTime : " + resumeTime
|
||||
+ " , suspendTime: " + suspendTime);
|
||||
isDynamicTimeSupport = true;
|
||||
|
||||
if(resumeTime.isBefore(currentTime) && currentTime.isBefore(suspendTime)) {
|
||||
isBetweenEffectiveTime = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(dynamicGroup.getOrgIdsList())) {
|
||||
dynamicGroup.setOrgIdsList("'"+dynamicGroup.getOrgIdsList().replace(",", "','")+"'");
|
||||
}
|
||||
String filters = dynamicGroup.getFilters();
|
||||
if(StringUtils.isNotBlank(filters)) {
|
||||
if(StringUtils.filtersSQLInjection(filters.toLowerCase())) {
|
||||
_logger.info("filters include SQL Injection Attack Risk.");
|
||||
return;
|
||||
}
|
||||
filters = filters.replace("&", " AND ");
|
||||
filters = filters.replace("|", " OR ");
|
||||
|
||||
dynamicGroup.setFilters(filters);
|
||||
}
|
||||
|
||||
if(isDynamicTimeSupport) {
|
||||
if(isBetweenEffectiveTime) {
|
||||
groupMemberService.deleteDynamicGroupMember(dynamicGroup);
|
||||
groupMemberService.addDynamicGroupMember(dynamicGroup);
|
||||
}else {
|
||||
groupMemberService.deleteDynamicGroupMember(dynamicGroup);
|
||||
}
|
||||
}else{
|
||||
groupMemberService.deleteDynamicGroupMember(dynamicGroup);
|
||||
groupMemberService.addDynamicGroupMember(dynamicGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshAllDynamicGroups(){
|
||||
List<Groups> groupsList = queryDynamicGroups(null);
|
||||
for(Groups group : groupsList) {
|
||||
_logger.debug("group " + group);
|
||||
refreshDynamicGroups(group);
|
||||
}
|
||||
}
|
||||
|
||||
public GroupMemberService getGroupMemberService() {
|
||||
return groupMemberService;
|
||||
}
|
||||
|
||||
public void setGroupMemberService(GroupMemberService groupMemberService) {
|
||||
this.groupMemberService = groupMemberService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -20,15 +20,13 @@ package org.maxkey.persistence.service;
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.maxkey.entity.Accounts;
|
||||
import org.maxkey.entity.ChangePassword;
|
||||
import org.maxkey.entity.GroupMember;
|
||||
import org.maxkey.entity.GroupPrivileges;
|
||||
import org.maxkey.entity.Groups;
|
||||
import org.maxkey.entity.RoleMember;
|
||||
import org.maxkey.entity.RolePermissions;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.entity.HistorySystemLogs;
|
||||
import org.maxkey.entity.Organizations;
|
||||
import org.maxkey.entity.Resources;
|
||||
import org.maxkey.entity.RoleMember;
|
||||
import org.maxkey.entity.RolePrivileges;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.entity.SocialsProvider;
|
||||
import org.maxkey.entity.Synchronizers;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
@ -66,16 +64,12 @@ public class HistorySystemLogsService extends JpaBaseService<HistorySystemLogs>
|
||||
message = buildMsg((ChangePassword)entity);
|
||||
}else if(entity instanceof Accounts) {
|
||||
message = buildMsg((Accounts)entity);
|
||||
}else if(entity instanceof Groups) {
|
||||
message = buildMsg((Groups)entity);
|
||||
}else if(entity instanceof Roles) {
|
||||
message = buildMsg((Roles)entity);
|
||||
}else if(entity instanceof GroupMember) {
|
||||
message = buildMsg((GroupMember)entity);
|
||||
}else if(entity instanceof RoleMember) {
|
||||
message = buildMsg((RoleMember)entity);
|
||||
}else if(entity instanceof GroupPrivileges) {
|
||||
message = buildMsg((GroupPrivileges)entity);
|
||||
}else if(entity instanceof RolePermissions) {
|
||||
message = buildMsg((RolePermissions)entity);
|
||||
}else if(entity instanceof Resources) {
|
||||
message = buildMsg((Resources)entity);
|
||||
}else if(entity instanceof Synchronizers) {
|
||||
@ -147,18 +141,12 @@ public class HistorySystemLogsService extends JpaBaseService<HistorySystemLogs>
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String buildMsg(Groups g) {
|
||||
public String buildMsg(Roles g) {
|
||||
return new StringBuilder()
|
||||
.append(g.getName())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String buildMsg(Roles r) {
|
||||
return new StringBuilder()
|
||||
.append(r.getName())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String buildMsg(RoleMember rm) {
|
||||
return new StringBuilder()
|
||||
.append(rm.getRoleName())
|
||||
@ -169,21 +157,11 @@ public class HistorySystemLogsService extends JpaBaseService<HistorySystemLogs>
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String buildMsg(GroupMember gm) {
|
||||
public String buildMsg(RolePermissions permission) {
|
||||
return new StringBuilder()
|
||||
.append(gm.getGroupName())
|
||||
.append(permission.getRoleName())
|
||||
.append("[")
|
||||
.append(gm.getUsername()).append(",")
|
||||
.append(gm.getDisplayName())
|
||||
.append("]")
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String buildMsg(GroupPrivileges privilege) {
|
||||
return new StringBuilder()
|
||||
.append(privilege.getGroupName())
|
||||
.append("[")
|
||||
.append(privilege.getAppName())
|
||||
.append(permission.getAppName())
|
||||
.append("]")
|
||||
.toString();
|
||||
}
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.maxkey.persistence.service;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.maxkey.entity.Notices;
|
||||
import org.maxkey.persistence.mapper.NoticesMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class NoticesService extends JpaBaseService<Notices>{
|
||||
|
||||
public NoticesService() {
|
||||
super(NoticesMapper.class);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.connsec.db.service.BaseService#getMapper()
|
||||
*/
|
||||
@Override
|
||||
public NoticesMapper getMapper() {
|
||||
return (NoticesMapper)super.getMapper();
|
||||
}
|
||||
|
||||
|
||||
public Notices queryLastedNotices() {
|
||||
return getMapper().queryLastedNotices();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -23,6 +23,7 @@ import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.entity.RoleMember;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
import org.maxkey.persistence.mapper.RoleMemberMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -30,7 +31,6 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class RoleMemberService extends JpaBaseService<RoleMember>{
|
||||
|
||||
final static Logger _logger = LoggerFactory.getLogger(RoleMemberService.class);
|
||||
|
||||
public RoleMemberService() {
|
||||
@ -45,19 +45,23 @@ public class RoleMemberService extends JpaBaseService<RoleMember>{
|
||||
return (RoleMemberMapper)super.getMapper();
|
||||
}
|
||||
|
||||
public int addDynamicRoleMember(Roles dynamicGroup) {
|
||||
return getMapper().addDynamicRoleMember(dynamicGroup);
|
||||
}
|
||||
|
||||
public int addDynamicRoleMember(Roles dynamicRole) {
|
||||
return getMapper().addDynamicRoleMember(dynamicRole);
|
||||
public int deleteDynamicRoleMember(Roles dynamicGroup) {
|
||||
return getMapper().deleteDynamicRoleMember(dynamicGroup);
|
||||
}
|
||||
|
||||
public int deleteByRoleId(String groupId) {
|
||||
return getMapper().deleteByRoleId(groupId);
|
||||
}
|
||||
|
||||
public int deleteDynamicRoleMember(Roles dynamicRole) {
|
||||
return getMapper().deleteDynamicRoleMember(dynamicRole);
|
||||
}
|
||||
|
||||
public int deleteByRoleId(String roleId) {
|
||||
return getMapper().deleteByRoleId(roleId);
|
||||
}
|
||||
|
||||
|
||||
public List<UserInfo> queryMemberByRoleId(String groupId){
|
||||
return getMapper().queryMemberByRoleId(groupId);
|
||||
}
|
||||
|
||||
|
||||
public JpaPageResults<Roles> rolesNoMember(RoleMember entity) {
|
||||
entity.setPageResultSelectUUID(entity.generateId());
|
||||
entity.setStartRow(calculateStartRow(entity.getPageNumber() ,entity.getPageSize()));
|
||||
@ -81,4 +85,5 @@ public class RoleMemberService extends JpaBaseService<RoleMember>{
|
||||
|
||||
return new JpaPageResults<Roles>(entity.getPageNumber(),entity.getPageSize(),totalPage,totalCount,resultslist);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,15 +18,15 @@
|
||||
package org.maxkey.persistence.service;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.maxkey.entity.GroupPrivileges;
|
||||
import org.maxkey.persistence.mapper.GroupPrivilegesMapper;
|
||||
import org.maxkey.entity.RolePermissions;
|
||||
import org.maxkey.persistence.mapper.RolePermissionsMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class GroupPrivilegesService extends JpaBaseService<GroupPrivileges>{
|
||||
public class RolePermissionssService extends JpaBaseService<RolePermissions>{
|
||||
|
||||
public GroupPrivilegesService() {
|
||||
super(GroupPrivilegesMapper.class);
|
||||
public RolePermissionssService() {
|
||||
super(RolePermissionsMapper.class);
|
||||
}
|
||||
|
||||
|
||||
@ -35,8 +35,8 @@ public class GroupPrivilegesService extends JpaBaseService<GroupPrivileges>{
|
||||
* @see com.connsec.db.service.BaseService#getMapper()
|
||||
*/
|
||||
@Override
|
||||
public GroupPrivilegesMapper getMapper() {
|
||||
return (GroupPrivilegesMapper)super.getMapper();
|
||||
public RolePermissionsMapper getMapper() {
|
||||
return (RolePermissionsMapper)super.getMapper();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.maxkey.persistence.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.maxkey.entity.RolePrivileges;
|
||||
import org.maxkey.persistence.mapper.RolePrivilegesMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class RolePrivilegesService extends JpaBaseService<RolePrivileges>{
|
||||
final static Logger _logger = LoggerFactory.getLogger(RolePrivilegesService.class);
|
||||
|
||||
|
||||
public RolePrivilegesService() {
|
||||
super(RolePrivilegesMapper.class);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.connsec.db.service.BaseService#getMapper()
|
||||
*/
|
||||
@Override
|
||||
public RolePrivilegesMapper getMapper() {
|
||||
return (RolePrivilegesMapper)super.getMapper();
|
||||
}
|
||||
|
||||
public boolean insertRolePrivileges(List<RolePrivileges> rolePermissionsList) {
|
||||
return getMapper().insertRolePrivileges(rolePermissionsList)>0;
|
||||
};
|
||||
|
||||
public boolean deleteRolePrivileges(List<RolePrivileges> rolePermissionsList) {
|
||||
return getMapper().deleteRolePrivileges(rolePermissionsList)>=0;
|
||||
}
|
||||
|
||||
public List<RolePrivileges> queryRolePrivileges(RolePrivileges rolePermissions){
|
||||
return getMapper().queryRolePrivileges(rolePermissions);
|
||||
}
|
||||
|
||||
}
|
||||
@ -17,25 +17,33 @@
|
||||
|
||||
package org.maxkey.persistence.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||
import org.maxkey.entity.RolePrivileges;
|
||||
import org.maxkey.constants.ConstsStatus;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.persistence.mapper.RolesMapper;
|
||||
import org.maxkey.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
@Repository
|
||||
public class RolesService extends JpaBaseService<Roles>{
|
||||
final static Logger _logger = LoggerFactory.getLogger(RolesService.class);
|
||||
public class RolesService extends JpaBaseService<Roles> implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4156671926199393550L;
|
||||
|
||||
final static Logger _logger = LoggerFactory.getLogger(RolesService.class);
|
||||
@JsonIgnore
|
||||
@Autowired
|
||||
@Qualifier("roleMemberService")
|
||||
RoleMemberService roleMemberService;
|
||||
|
||||
public RolesService() {
|
||||
@ -50,47 +58,78 @@ public class RolesService extends JpaBaseService<Roles>{
|
||||
return (RolesMapper)super.getMapper();
|
||||
}
|
||||
|
||||
public boolean insertRolePrivileges(List<RolePrivileges> rolePermissionsList) {
|
||||
return getMapper().insertRolePrivileges(rolePermissionsList)>0;
|
||||
};
|
||||
|
||||
public boolean deleteRolePrivileges(List<RolePrivileges> rolePermissionsList) {
|
||||
return getMapper().deleteRolePrivileges(rolePermissionsList)>=0;
|
||||
}
|
||||
|
||||
public List<RolePrivileges> queryRolePrivileges(RolePrivileges rolePermissions){
|
||||
return getMapper().queryRolePrivileges(rolePermissions);
|
||||
}
|
||||
|
||||
public List<Roles> queryDynamicRoles(Roles dynamicRole){
|
||||
return this.getMapper().queryDynamicRoles(dynamicRole);
|
||||
}
|
||||
|
||||
public boolean deleteById(String roleId) {
|
||||
this.remove(roleId);
|
||||
roleMemberService.deleteByRoleId(roleId);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void refreshDynamicRoles(Roles dynamicRole){
|
||||
if(dynamicRole.getDynamic().equals("1")) {
|
||||
if(dynamicRole.getOrgIdsList()!=null && !dynamicRole.getOrgIdsList().equals("")) {
|
||||
dynamicRole.setOrgIdsList("'"+dynamicRole.getOrgIdsList().replace(",", "','")+"'");
|
||||
public List<Roles> queryDynamicRoles(Roles groups){
|
||||
return this.getMapper().queryDynamicRoles(groups);
|
||||
}
|
||||
|
||||
public boolean deleteById(String groupId) {
|
||||
this.remove(groupId);
|
||||
roleMemberService.deleteByRoleId(groupId);
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<Roles> queryRolesByUserId(String userId){
|
||||
return this.getMapper().queryRolesByUserId(userId);
|
||||
}
|
||||
|
||||
public void refreshDynamicRoles(Roles dynamicRole){
|
||||
if(dynamicRole.getDynamic().equals(ConstsStatus.ACTIVE+"")) {
|
||||
boolean isDynamicTimeSupport = false;
|
||||
boolean isBetweenEffectiveTime = false;
|
||||
if(StringUtils.isNotBlank(dynamicRole.getResumeTime())
|
||||
&&StringUtils.isNotBlank(dynamicRole.getSuspendTime())
|
||||
&&!dynamicRole.getSuspendTime().equals("00:00")) {
|
||||
LocalTime currentTime = LocalDateTime.now().toLocalTime();
|
||||
LocalTime resumeTime = LocalTime.parse(dynamicRole.getResumeTime());
|
||||
LocalTime suspendTime = LocalTime.parse(dynamicRole.getSuspendTime());
|
||||
|
||||
_logger.info("currentTime: " + currentTime
|
||||
+ " , resumeTime : " + resumeTime
|
||||
+ " , suspendTime: " + suspendTime);
|
||||
isDynamicTimeSupport = true;
|
||||
|
||||
if(resumeTime.isBefore(currentTime) && currentTime.isBefore(suspendTime)) {
|
||||
isBetweenEffectiveTime = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(dynamicRole.getOrgIdsList())) {
|
||||
dynamicRole.setOrgIdsList("'"+dynamicRole.getOrgIdsList().replace(",", "','")+"'");
|
||||
}
|
||||
String filters = dynamicRole.getFilters();
|
||||
if(StringUtils.isNotBlank(filters)) {
|
||||
if(StringUtils.filtersSQLInjection(filters.toLowerCase())) {
|
||||
_logger.info("filters include SQL Injection Attack Risk.");
|
||||
return;
|
||||
}
|
||||
filters = filters.replace("&", " AND ");
|
||||
filters = filters.replace("|", " OR ");
|
||||
|
||||
dynamicRole.setFilters(filters);
|
||||
}
|
||||
|
||||
if(isDynamicTimeSupport) {
|
||||
if(isBetweenEffectiveTime) {
|
||||
roleMemberService.deleteDynamicRoleMember(dynamicRole);
|
||||
roleMemberService.addDynamicRoleMember(dynamicRole);
|
||||
}else {
|
||||
roleMemberService.deleteDynamicRoleMember(dynamicRole);
|
||||
}
|
||||
}else{
|
||||
roleMemberService.deleteDynamicRoleMember(dynamicRole);
|
||||
roleMemberService.addDynamicRoleMember(dynamicRole);
|
||||
}
|
||||
|
||||
String filters = dynamicRole.getFilters();
|
||||
if(StringUtils.filtersSQLInjection(filters.toLowerCase())) {
|
||||
_logger.info("filters include SQL Injection Attack Risk.");
|
||||
return;
|
||||
}
|
||||
|
||||
filters = filters.replace("&", " AND ");
|
||||
filters = filters.replace("|", " OR ");
|
||||
|
||||
dynamicRole.setFilters(filters);
|
||||
|
||||
roleMemberService.deleteDynamicRoleMember(dynamicRole);
|
||||
roleMemberService.addDynamicRoleMember(dynamicRole);
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshAllDynamicRoles(){
|
||||
List<Roles> groupsList = queryDynamicRoles(null);
|
||||
for(Roles group : groupsList) {
|
||||
_logger.debug("group " + group);
|
||||
refreshDynamicRoles(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,287 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.maxkey.persistence.mapper.GroupMemberMapper">
|
||||
|
||||
<sql id="where_statement">
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
and name = #{name}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="memberInGroup" parameterType="GroupMember" resultType="GroupMember">
|
||||
select distinct
|
||||
gm.id as id,
|
||||
g.id as groupid,
|
||||
g.name as groupname,
|
||||
g.dynamic dynamic,
|
||||
u.username,
|
||||
u.usertype,
|
||||
u.windowsaccount,
|
||||
|
||||
u.displayname ,
|
||||
u.nickname ,
|
||||
u.namezhspell,
|
||||
u.namezhshortspell,
|
||||
u.givenname ,
|
||||
u.middlename ,
|
||||
u.familyname ,
|
||||
|
||||
u.gender,
|
||||
|
||||
u.authntype,
|
||||
u.mobile,
|
||||
u.email,
|
||||
u.workemail,
|
||||
u.workphonenumber,
|
||||
|
||||
u.employeenumber,
|
||||
u.division,
|
||||
u.costcenter,
|
||||
u.organization,
|
||||
u.departmentid,
|
||||
u.department,
|
||||
u.jobtitle,
|
||||
u.joblevel,
|
||||
|
||||
gm.createddate,
|
||||
|
||||
u.status
|
||||
from
|
||||
mxk_userinfo u,
|
||||
mxk_groups g,
|
||||
mxk_group_member gm
|
||||
where u.instid = #{instId}
|
||||
and g.instid = #{instId}
|
||||
and gm.instid = #{instId}
|
||||
<if test="groupId != null and groupId != ''">
|
||||
and gm.groupid = #{groupId}
|
||||
and g.id = #{groupId}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
and g.name = #{groupName}
|
||||
</if>
|
||||
<if test="username != null and username != ''">
|
||||
and u.username = #{username}
|
||||
</if>
|
||||
<if test="displayName != null and displayName != ''">
|
||||
and u.displayname like '%${displayName}%'
|
||||
</if>
|
||||
and gm.type in( 'USER','USER-DYNAMIC')
|
||||
and gm.groupid = g.id
|
||||
and gm.memberid = u.id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="memberNotInGroup" parameterType="GroupMember" resultType="GroupMember">
|
||||
select distinct
|
||||
u.id,
|
||||
u.username,
|
||||
u.usertype,
|
||||
u.windowsaccount,
|
||||
|
||||
u.displayname ,
|
||||
u.nickname ,
|
||||
u.namezhspell,
|
||||
u.namezhshortspell,
|
||||
u.givenname ,
|
||||
u.middlename ,
|
||||
u.familyname ,
|
||||
|
||||
u.gender,
|
||||
|
||||
u.authntype,
|
||||
u.mobile,
|
||||
u.email,
|
||||
u.workemail,
|
||||
u.workphonenumber,
|
||||
|
||||
u.employeenumber,
|
||||
u.division,
|
||||
u.costcenter,
|
||||
u.organization,
|
||||
u.departmentid,
|
||||
u.department,
|
||||
u.jobtitle,
|
||||
u.joblevel,
|
||||
|
||||
|
||||
u.createdby,
|
||||
u.createddate,
|
||||
u.modifiedby,
|
||||
u.modifieddate,
|
||||
|
||||
u.status
|
||||
from
|
||||
mxk_userinfo u
|
||||
where
|
||||
u.id not in(
|
||||
select gm.memberid
|
||||
from `mxk_groups` g,mxk_group_member gm
|
||||
where 1 = 1
|
||||
<if test="groupId != null and groupId != ''">
|
||||
and gm.groupid = #{groupId}
|
||||
and g.id = #{groupId}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
and g.name = #{groupName}
|
||||
</if>
|
||||
and gm.type in( 'USER','USER-DYNAMIC')
|
||||
and gm.groupid = g.id
|
||||
)
|
||||
<if test="username != null and username != ''">
|
||||
and u.username = #{username}
|
||||
</if>
|
||||
<if test="displayName != null and displayName != ''">
|
||||
and u.displayname like '%${displayName}%'
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="groupsNoMember" parameterType="GroupMember" resultType="Groups">
|
||||
select distinct
|
||||
g.*
|
||||
from
|
||||
mxk_groups g
|
||||
where
|
||||
g.id not in(
|
||||
select
|
||||
gm.groupid
|
||||
from mxk_group_member gm,mxk_userinfo u
|
||||
where gm.memberid = u.id
|
||||
<if test="username != null and username != ''">
|
||||
and u.username = #{username}
|
||||
</if>
|
||||
<if test="memberId != null and memberId != ''">
|
||||
and gm.memberid = #{memberid}
|
||||
</if>
|
||||
)
|
||||
<if test="groupName != null and groupName != ''">
|
||||
and g.name = #{groupName}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- GROUP_MEMBER Group Member-->
|
||||
<select id="groupMemberInGroup" parameterType="GroupMember" resultType="Groups">
|
||||
select distinct
|
||||
ig.*
|
||||
from
|
||||
`mxk_groups` ig,
|
||||
`mxk_groups` g,
|
||||
mxk_group_member gm
|
||||
where
|
||||
1 = 1
|
||||
and gm.groupid = g.id
|
||||
and gm.memberid = ig.id
|
||||
and gm.type = 'GROUP'
|
||||
<if test="groupId != null and groupId != ''">
|
||||
and gm.groupid = #{groupId}
|
||||
and g.id = #{groupId}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
and g.name = #{groupName}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="addDynamicGroupMember" parameterType="Groups" >
|
||||
insert into mxk_group_member(
|
||||
id,
|
||||
groupid,
|
||||
memberid,
|
||||
type,
|
||||
instid
|
||||
)
|
||||
select
|
||||
concat('${id}_',u.id) id,
|
||||
'${id}' groupid,
|
||||
u.id memberid,
|
||||
'USER-DYNAMIC' type,
|
||||
'${instId}' instid
|
||||
from mxk_userinfo u
|
||||
where not exists(
|
||||
select 1 from mxk_group_member gm
|
||||
where gm.groupid=#{id}
|
||||
and gm.memberid=u.id
|
||||
and gm.type='USER-DYNAMIC'
|
||||
)
|
||||
<if test="filters != null and filters != ''">
|
||||
and (${filters})
|
||||
</if>
|
||||
<if test="orgIdsList != null and orgIdsList != ''">
|
||||
and u.departmentid in( ${orgIdsList})
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<delete id="deleteDynamicGroupMember" parameterType="Groups" >
|
||||
delete from mxk_group_member gm
|
||||
where type = 'user-dynamic'
|
||||
and gm.groupid=#{id}
|
||||
and not exists(
|
||||
select 1
|
||||
from mxk_userinfo u
|
||||
where 1 = 1
|
||||
and u.id=gm.memberid
|
||||
<if test="filters != null and filters != ''">
|
||||
and (${filters})
|
||||
</if>
|
||||
<if test="orgIdsList != null and orgIdsList != ''">
|
||||
and u.departmentid in ( ${orgIdsList})
|
||||
</if>
|
||||
)
|
||||
</delete>
|
||||
|
||||
<select id="queryMemberByGroupId" parameterType="string" resultType="UserInfo">
|
||||
select distinct
|
||||
g.groupId,
|
||||
g.groupName,
|
||||
u.id,
|
||||
u.username,
|
||||
u.usertype,
|
||||
u.windowsaccount,
|
||||
|
||||
u.displayname ,
|
||||
u.nickname ,
|
||||
u.namezhspell,
|
||||
u.namezhshortspell,
|
||||
u.givenname ,
|
||||
u.middlename ,
|
||||
u.familyname ,
|
||||
|
||||
u.gender,
|
||||
|
||||
u.authntype,
|
||||
u.mobile,
|
||||
u.email,
|
||||
u.workemail,
|
||||
u.workphonenumber,
|
||||
|
||||
u.employeenumber,
|
||||
u.division,
|
||||
u.costcenter,
|
||||
u.organization,
|
||||
u.departmentid,
|
||||
u.department,
|
||||
u.jobtitle,
|
||||
u.joblevel,
|
||||
gm.createddate,
|
||||
u.status
|
||||
from
|
||||
mxk_userinfo u,
|
||||
mxk_groups g,
|
||||
mxk_group_member gm
|
||||
where 1 = 1
|
||||
and gm.groupid = #{value}
|
||||
and g.id = #{value}
|
||||
and gm.type in( 'USER','USER-DYNAMIC')
|
||||
and gm.groupid = g.id
|
||||
and gm.memberid = u.id
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteByGroupId" parameterType="string" >
|
||||
delete from mxk_group_member gm
|
||||
where gm.groupid = #{value} and groupId != 'ROLE_ALL_USER'
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@ -1,78 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.maxkey.persistence.mapper.GroupsMapper">
|
||||
|
||||
<sql id="where_statement">
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
and name like '%${name}%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="queryPageResults" parameterType="Groups" resultType="Groups">
|
||||
select
|
||||
*
|
||||
from
|
||||
`mxk_groups`
|
||||
where instid = #{instId}
|
||||
<include refid="where_statement"/>
|
||||
</select>
|
||||
|
||||
<select id="queryDynamicGroups" parameterType="Groups" resultType="Groups">
|
||||
select
|
||||
*
|
||||
from
|
||||
`mxk_groups`
|
||||
where instid = #{instId}
|
||||
and dynamic = '1'
|
||||
<include refid="where_statement"/>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="logisticDelete" parameterType="Groups" >
|
||||
update `mxk_groups` set
|
||||
status = '2'
|
||||
where instid = #{instId}
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="name != name">
|
||||
and name = #{name}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
|
||||
<update id="logisticBatchDelete" parameterType="java.util.List">
|
||||
update `mxk_groups`
|
||||
set status='2'
|
||||
where instid = #{instId}
|
||||
and id in
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<select id="queryGroupByUserId" parameterType="string" resultType="Groups">
|
||||
select distinct
|
||||
g.*
|
||||
from
|
||||
mxk_userinfo u,
|
||||
mxk_groups g,
|
||||
mxk_group_member gm
|
||||
where u.instid = #{instId}
|
||||
and g.instid = #{instId}
|
||||
and gm.instid = #{instId}
|
||||
and gm.memberid = #{value}
|
||||
and u.id = #{value}
|
||||
and gm.type in( 'USER','USER-DYNAMIC')
|
||||
and gm.groupid = g.id
|
||||
and gm.memberid = u.id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.maxkey.persistence.mapper.NoticesMapper">
|
||||
|
||||
<sql id="where_statement">
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
and title like '%${title}%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="queryPageResults" parameterType="Notices" resultType="Notices">
|
||||
select
|
||||
*
|
||||
from
|
||||
mxk_notices
|
||||
where
|
||||
instid = #{instId}
|
||||
<include refid="where_statement"/>
|
||||
order by modifieddate desc
|
||||
</select>
|
||||
|
||||
<select id="queryLastedNotices" parameterType="Notices" resultType="Notices">
|
||||
select
|
||||
*
|
||||
from
|
||||
mxk_notices
|
||||
where instid = #{instId}
|
||||
order by modifieddate desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -10,13 +10,13 @@
|
||||
and name = #{name}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="memberInRole" parameterType="RoleMember" resultType="RoleMember">
|
||||
select distinct
|
||||
r.id as roleid,
|
||||
r.name as rolename,
|
||||
r.dynamic dynamic,
|
||||
rm.id as id,
|
||||
r.id as roleid,
|
||||
r.name as rolename,
|
||||
r.dynamic dynamic,
|
||||
u.username,
|
||||
u.usertype,
|
||||
u.windowsaccount,
|
||||
@ -46,23 +46,22 @@
|
||||
u.jobtitle,
|
||||
u.joblevel,
|
||||
|
||||
|
||||
rm.createddate,
|
||||
|
||||
u.status
|
||||
from
|
||||
mxk_userinfo u,
|
||||
mxk_roles r,
|
||||
mxk_roles r,
|
||||
mxk_role_member rm
|
||||
where u.instid = #{instId}
|
||||
and r.instid = #{instId}
|
||||
and rm.instid = #{instId}
|
||||
where u.instid = #{instId}
|
||||
and r.instid = #{instId}
|
||||
and rm.instid = #{instId}
|
||||
<if test="roleId != null and roleId != ''">
|
||||
and rm.roleid = #{roleId}
|
||||
and r.id = #{roleId}
|
||||
</if>
|
||||
<if test="roleName != null and roleName != ''">
|
||||
and r.name = #{roleName}
|
||||
and g.name = #{roleName}
|
||||
</if>
|
||||
<if test="username != null and username != ''">
|
||||
and u.username = #{username}
|
||||
@ -127,9 +126,8 @@
|
||||
and r.id = #{roleId}
|
||||
</if>
|
||||
<if test="roleName != null and roleName != ''">
|
||||
and r.name = #{roleName}
|
||||
and g.name = #{roleName}
|
||||
</if>
|
||||
|
||||
and rm.type in( 'USER','USER-DYNAMIC')
|
||||
and rm.roleid = r.id
|
||||
)
|
||||
@ -141,7 +139,6 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="rolesNoMember" parameterType="RoleMember" resultType="Roles">
|
||||
select distinct
|
||||
r.*
|
||||
@ -154,9 +151,9 @@
|
||||
from mxk_role_member rm,mxk_userinfo u
|
||||
where rm.memberid = u.id
|
||||
<if test="username != null and username != ''">
|
||||
and u.username = #{username}
|
||||
</if>
|
||||
<if test="memberId != null and memberId != ''">
|
||||
and u.username = #{username}
|
||||
</if>
|
||||
<if test="memberId != null and memberId != ''">
|
||||
and rm.memberid = #{memberid}
|
||||
</if>
|
||||
)
|
||||
@ -164,20 +161,20 @@
|
||||
and r.name = #{roleName}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- ROLE_MEMBER Roles Member-->
|
||||
|
||||
<!-- ROLE_MEMBER ROLE Member-->
|
||||
<select id="roleMemberInRole" parameterType="RoleMember" resultType="Roles">
|
||||
select distinct
|
||||
ir.*
|
||||
ig.*
|
||||
from
|
||||
mxk_roles ir,
|
||||
mxk_roles r,
|
||||
mxk_role_member rm
|
||||
where
|
||||
1 = 1
|
||||
and rm.groupid = r.id
|
||||
and rm.memberid = ir.id
|
||||
and rm.type in( 'USER','USER-DYNAMIC')
|
||||
and rm.roleid = g.id
|
||||
and rm.memberid = ig.id
|
||||
and rm.type = 'ROLE'
|
||||
<if test="roleId != null and roleId != ''">
|
||||
and rm.roleid = #{roleId}
|
||||
and r.id = #{roleId}
|
||||
@ -192,13 +189,15 @@
|
||||
id,
|
||||
roleid,
|
||||
memberid,
|
||||
type
|
||||
type,
|
||||
instid
|
||||
)
|
||||
select
|
||||
concat('${id}_',u.id) id,
|
||||
'${id}' ROLEID,
|
||||
'${id}' roleid,
|
||||
u.id memberid,
|
||||
'USER-DYNAMIC' type
|
||||
'USER-DYNAMIC' type,
|
||||
'${instId}' instid
|
||||
from mxk_userinfo u
|
||||
where not exists(
|
||||
select 1 from mxk_role_member rm
|
||||
@ -207,7 +206,7 @@
|
||||
and rm.type='USER-DYNAMIC'
|
||||
)
|
||||
<if test="filters != null and filters != ''">
|
||||
${filters}
|
||||
and (${filters})
|
||||
</if>
|
||||
<if test="orgIdsList != null and orgIdsList != ''">
|
||||
and u.departmentid in( ${orgIdsList})
|
||||
@ -216,25 +215,73 @@
|
||||
|
||||
<delete id="deleteDynamicRoleMember" parameterType="Roles" >
|
||||
delete from mxk_role_member rm
|
||||
where type = 'USER-DYNAMIC'
|
||||
and rm.roleid = #{id}
|
||||
where type = 'user-dynamic'
|
||||
and rm.roleid=#{id}
|
||||
and not exists(
|
||||
select 1
|
||||
from mxk_userinfo u
|
||||
where 1 = 1
|
||||
and u.id=rm.memberid
|
||||
<if test="filters != null and filters != ''">
|
||||
${filters}
|
||||
and (${filters})
|
||||
</if>
|
||||
<if test="orgIdsList != null and orgIdsList != ''">
|
||||
and u.departmentid in( ${orgIdsList})
|
||||
and u.departmentid in ( ${orgIdsList})
|
||||
</if>
|
||||
)
|
||||
</delete>
|
||||
|
||||
<select id="queryMemberByRoleId" parameterType="string" resultType="UserInfo">
|
||||
select distinct
|
||||
r.roleId,
|
||||
r.roleName,
|
||||
u.id,
|
||||
u.username,
|
||||
u.usertype,
|
||||
u.windowsaccount,
|
||||
|
||||
u.displayname ,
|
||||
u.nickname ,
|
||||
u.namezhspell,
|
||||
u.namezhshortspell,
|
||||
u.givenname ,
|
||||
u.middlename ,
|
||||
u.familyname ,
|
||||
|
||||
u.gender,
|
||||
|
||||
u.authntype,
|
||||
u.mobile,
|
||||
u.email,
|
||||
u.workemail,
|
||||
u.workphonenumber,
|
||||
|
||||
u.employeenumber,
|
||||
u.division,
|
||||
u.costcenter,
|
||||
u.organization,
|
||||
u.departmentid,
|
||||
u.department,
|
||||
u.jobtitle,
|
||||
u.joblevel,
|
||||
rm.createddate,
|
||||
u.status
|
||||
from
|
||||
mxk_userinfo u,
|
||||
mxk_roles r,
|
||||
mxk_role_member rm
|
||||
where 1 = 1
|
||||
and rm.roleid = #{value}
|
||||
and g.id = #{value}
|
||||
and rm.type in( 'USER','USER-DYNAMIC')
|
||||
and rm.roleid = r.id
|
||||
and rm.memberid = u.id
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteByRoleId" parameterType="string" >
|
||||
delete from mxk_role_member rm
|
||||
where rm.roleid=#{value}
|
||||
where rm.roleid = #{value} and roleId != 'ROLE_ALL_USER'
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.maxkey.persistence.mapper.GroupPrivilegesMapper" >
|
||||
<mapper namespace="org.maxkey.persistence.mapper.RolePermissionsMapper" >
|
||||
|
||||
<sql id="where_statement">
|
||||
<if test="id != null and id != ''">
|
||||
@ -18,12 +18,12 @@
|
||||
</sql>
|
||||
|
||||
<!-- AppGroup -->
|
||||
<select id="appsInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges">
|
||||
<select id="appsInRole" parameterType="RolePermissions" resultType="RolePermissions">
|
||||
select
|
||||
gp.id,
|
||||
gp.groupid,
|
||||
g.name groupname,
|
||||
gp.appid,
|
||||
p.id,
|
||||
p.roleid,
|
||||
r.name rolename,
|
||||
apps.id appid,
|
||||
apps.name,
|
||||
apps.name appname,
|
||||
apps.icon,
|
||||
@ -35,22 +35,22 @@
|
||||
apps.vendorurl
|
||||
from
|
||||
mxk_apps apps,
|
||||
mxk_group_privileges gp,
|
||||
mxk_groups g
|
||||
mxk_role_permissions p,
|
||||
mxk_roles r
|
||||
where
|
||||
apps.instid = #{instId}
|
||||
and gp.instid = #{instId}
|
||||
and g.instid = #{instId}
|
||||
and gp.appid = apps.id
|
||||
and gp.groupid = g.id
|
||||
<if test="groupId != null and groupId != ''">
|
||||
and gp.groupid = #{groupId}
|
||||
and g.id = #{groupId}
|
||||
apps.instid = #{instId}
|
||||
and p.instid = #{instId}
|
||||
and r.instid = #{instId}
|
||||
and p.appid = apps.id
|
||||
and p.roleid = r.id
|
||||
<if test="roleId != null and roleId != ''">
|
||||
and p.roleid = #{roleId}
|
||||
and r.id = #{roleId}
|
||||
</if>
|
||||
<include refid="where_statement"/>
|
||||
</select>
|
||||
|
||||
<select id="appsNotInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges">
|
||||
<select id="appsNotInRole" parameterType="RolePermissions" resultType="RolePermissions">
|
||||
select
|
||||
*
|
||||
from
|
||||
@ -61,9 +61,9 @@
|
||||
select
|
||||
appid
|
||||
from
|
||||
mxk_group_privileges
|
||||
mxk_role_permissions
|
||||
where
|
||||
groupid = #{groupId}
|
||||
roleid = #{roleId}
|
||||
)
|
||||
<include refid="where_statement"/>
|
||||
</select>
|
||||
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.maxkey.persistence.mapper.RolePrivilegesMapper">
|
||||
|
||||
<sql id="where_statement">
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
and name like '%${name}%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="queryRolePrivileges" parameterType="RolePrivileges" resultType="RolePrivileges">
|
||||
select
|
||||
*
|
||||
from
|
||||
mxk_role_privileges
|
||||
where instid = #{instId}
|
||||
and status = 1
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="roleId != null and roleId != ''">
|
||||
and roleid = #{roleId}
|
||||
</if>
|
||||
<if test="appId != null and appId != ''">
|
||||
and appid = #{appId}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<update id="deleteRolePrivileges" parameterType="java.util.List">
|
||||
update mxk_role_privileges
|
||||
set status = 9
|
||||
where 1 = 1 and
|
||||
<foreach item="item" collection="list" open="(" separator="or" close=")">
|
||||
( id = #{item.id} and instid = #{item.instId} )
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<insert id="insertRolePrivileges" parameterType="java.util.List">
|
||||
insert into mxk_role_privileges ( id,appid,roleid,resourceid,status,instid)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status},#{item.instId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -11,23 +11,24 @@
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="queryDynamicRoles" parameterType="Roles" resultType="Roles">
|
||||
select
|
||||
*
|
||||
from
|
||||
mxk_roles
|
||||
where instid = #{instId}
|
||||
and dynamic = '1'
|
||||
<include refid="where_statement"/>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryPageResults" parameterType="Roles" resultType="Roles">
|
||||
select
|
||||
*
|
||||
from
|
||||
mxk_roles
|
||||
where
|
||||
instid = #{instId}
|
||||
where instid = #{instId}
|
||||
<include refid="where_statement"/>
|
||||
</select>
|
||||
|
||||
<select id="queryDynamicRoles" parameterType="Roles" resultType="Roles">
|
||||
select
|
||||
*
|
||||
from
|
||||
mxk_roles
|
||||
where instid = #{instId}
|
||||
and dynamic = '1'
|
||||
<include refid="where_statement"/>
|
||||
</select>
|
||||
|
||||
@ -46,9 +47,9 @@
|
||||
|
||||
|
||||
<update id="logisticBatchDelete" parameterType="java.util.List">
|
||||
update mxk_roles
|
||||
update mxk_roles
|
||||
set status='2'
|
||||
where instid = #{instId}
|
||||
where instid = #{instId}
|
||||
and id in
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
@ -56,42 +57,22 @@
|
||||
</update>
|
||||
|
||||
|
||||
<select id="queryRolePrivileges" parameterType="RolePrivileges" resultType="RolePrivileges">
|
||||
select
|
||||
*
|
||||
from
|
||||
mxk_role_privileges
|
||||
where instid = #{instId}
|
||||
and status = 1
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="roleId != null and roleId != ''">
|
||||
and roleid = #{roleId}
|
||||
</if>
|
||||
<if test="appId != null and appId != ''">
|
||||
and appid = #{appId}
|
||||
</if>
|
||||
|
||||
<select id="queryRolesByUserId" parameterType="string" resultType="Roles">
|
||||
select distinct
|
||||
r.*
|
||||
from
|
||||
mxk_userinfo u,
|
||||
mxk_roles r,
|
||||
mxk_role_member rm
|
||||
where u.instid = #{instId}
|
||||
and r.instid = #{instId}
|
||||
and rm.instid = #{instId}
|
||||
and rm.memberid = #{value}
|
||||
and u.id = #{value}
|
||||
and rm.type in( 'USER','USER-DYNAMIC')
|
||||
and rm.groupid = r.id
|
||||
and rm.memberid = u.id
|
||||
</select>
|
||||
|
||||
<update id="deleteRolePrivileges" parameterType="java.util.List">
|
||||
update mxk_role_privileges
|
||||
set status = 9
|
||||
where 1 = 1 and
|
||||
<foreach item="item" collection="list" open="(" separator="or" close=")">
|
||||
( id = #{item.id} and instid = #{item.instId} )
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<insert id="insertRolePrivileges" parameterType="java.util.List">
|
||||
insert into mxk_role_privileges ( id,appid,roleid,resourceid,status,instid)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status},#{item.instId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { BaseEntity } from './BaseEntity';
|
||||
|
||||
export class GroupMembers extends BaseEntity { }
|
||||
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import format from 'date-fns/format';
|
||||
|
||||
import { BaseEntity } from './BaseEntity';
|
||||
|
||||
export class Groups extends BaseEntity {
|
||||
name!: String;
|
||||
dynamic!: String;
|
||||
filters!: String;
|
||||
orgIdsList!: String;
|
||||
resumeTime!: String;
|
||||
suspendTime!: String;
|
||||
isdefault!: String;
|
||||
|
||||
switch_dynamic: boolean = false;
|
||||
picker_resumeTime: Date = new Date(format(new Date(), 'yyyy-MM-dd 00:00:00'));
|
||||
picker_suspendTime: Date = new Date(format(new Date(), 'yyyy-MM-dd 00:00:00'));
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
override init(data: any): void {
|
||||
Object.assign(this, data);
|
||||
if (this.status == 1) {
|
||||
this.switch_status = true;
|
||||
}
|
||||
if (this.dynamic == '1') {
|
||||
this.switch_dynamic = true;
|
||||
}
|
||||
if (this.resumeTime != '') {
|
||||
this.picker_resumeTime = new Date(format(new Date(), `yyyy-MM-dd ${this.resumeTime}:00`));
|
||||
}
|
||||
if (this.suspendTime != '') {
|
||||
this.picker_suspendTime = new Date(format(new Date(), `yyyy-MM-dd ${this.suspendTime}:00`));
|
||||
}
|
||||
}
|
||||
override trans(): void {
|
||||
if (this.switch_status) {
|
||||
this.status = 1;
|
||||
} else {
|
||||
this.status = 0;
|
||||
}
|
||||
if (this.switch_dynamic) {
|
||||
this.dynamic = '1';
|
||||
} else {
|
||||
this.dynamic = '0';
|
||||
}
|
||||
|
||||
if (this.picker_resumeTime) {
|
||||
this.resumeTime = format(this.picker_resumeTime, 'HH:mm');
|
||||
}
|
||||
if (this.picker_suspendTime) {
|
||||
this.suspendTime = format(this.picker_suspendTime, 'HH:mm');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,19 +1,18 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { BaseEntity } from './BaseEntity';
|
||||
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import format from 'date-fns/format';
|
||||
|
||||
@ -27,13 +26,13 @@ export class Roles extends BaseEntity {
|
||||
resumeTime!: String;
|
||||
suspendTime!: String;
|
||||
isdefault!: String;
|
||||
|
||||
switch_dynamic: boolean = false;
|
||||
picker_resumeTime: Date = new Date(format(new Date(), 'yyyy-MM-dd 00:00:00'));
|
||||
picker_suspendTime: Date = new Date(format(new Date(), 'yyyy-MM-dd 00:00:00'));
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.status = 1;
|
||||
}
|
||||
|
||||
override init(data: any): void {
|
||||
@ -51,7 +50,6 @@ export class Roles extends BaseEntity {
|
||||
this.picker_suspendTime = new Date(format(new Date(), `yyyy-MM-dd ${this.suspendTime}:00`));
|
||||
}
|
||||
}
|
||||
|
||||
override trans(): void {
|
||||
if (this.switch_status) {
|
||||
this.status = 1;
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
@ -21,15 +20,15 @@ import { RouterModule, Routes } from '@angular/router';
|
||||
import { SharedModule } from '@shared';
|
||||
import { NzIconModule } from 'ng-zorro-antd/icon';
|
||||
|
||||
import { GroupMembersComponent } from './group-members/group-members.component';
|
||||
import { GroupEditerComponent } from './groups/group-editer/group-editer.component';
|
||||
import { GroupsComponent } from './groups/groups.component';
|
||||
import { PrivilegesComponent } from './privileges/privileges.component';
|
||||
import { PermissionsEditerComponent } from './permissions/permissions-editer/permissions-editer.component';
|
||||
import { PermissionsComponent } from './permissions/permissions.component';
|
||||
import { MemberRolesEditerComponent } from './role-members/member-roles-editer/member-roles-editer.component';
|
||||
import { RoleMembersEditerComponent } from './role-members/role-members-editer/role-members-editer.component';
|
||||
import { RoleMembersComponent } from './role-members/role-members.component';
|
||||
import { RoleEditerComponent } from './roles/role-editer/role-editer.component';
|
||||
import { RolesComponent } from './roles/roles.component';
|
||||
import { SelectRolesComponent } from './roles/select-roles/select-roles.component';
|
||||
import { SessionsComponent } from './sessions/sessions.component';
|
||||
import { SelectGroupsComponent } from './groups/select-groups/select-groups.component';
|
||||
import { GroupMembersEditerComponent } from './group-members/group-members-editer/group-members-editer.component';
|
||||
import { PrivilegesEditerComponent } from './privileges/privileges-editer/privileges-editer.component';
|
||||
import { MemberGroupsEditerComponent } from './group-members/member-groups-editer/member-groups-editer.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -37,23 +36,33 @@ const routes: Routes = [
|
||||
component: SessionsComponent
|
||||
},
|
||||
{
|
||||
path: 'groups',
|
||||
component: GroupsComponent
|
||||
path: 'roles',
|
||||
component: RolesComponent
|
||||
},
|
||||
{
|
||||
path: 'groupmembers',
|
||||
component: GroupMembersComponent
|
||||
path: 'rolemembers',
|
||||
component: RoleMembersComponent
|
||||
},
|
||||
{
|
||||
path: 'privileges',
|
||||
component: PrivilegesComponent
|
||||
path: 'permissions',
|
||||
component: PermissionsComponent
|
||||
}
|
||||
];
|
||||
|
||||
const COMPONENTS = [SessionsComponent, GroupsComponent, GroupMembersComponent, PrivilegesComponent, GroupEditerComponent];
|
||||
const COMPONENTS = [
|
||||
RolesComponent,
|
||||
RoleMembersComponent,
|
||||
PermissionsComponent,
|
||||
RoleEditerComponent,
|
||||
SessionsComponent,
|
||||
SelectRolesComponent,
|
||||
RoleMembersEditerComponent,
|
||||
PermissionsEditerComponent,
|
||||
MemberRolesEditerComponent
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
declarations: [...COMPONENTS, PrivilegesComponent, SelectGroupsComponent, GroupMembersEditerComponent, PrivilegesEditerComponent, MemberGroupsEditerComponent],
|
||||
declarations: [...COMPONENTS],
|
||||
imports: [NzIconModule, SharedModule, CommonModule, RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
<div *nzModalTitle> {{ 'mxk.text.add' | i18n }} </div>
|
||||
<nz-card [nzBordered]="false">
|
||||
<form nz-form [nzLayout]="'inline'" (ngSubmit)="onSearch()" class="search__form">
|
||||
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
|
||||
<div nz-col nzMd="14" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="username">{{ 'mxk.users.username' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<input nz-input [(ngModel)]="query.params.username" [ngModelOptions]="{ standalone: true }" name="username"
|
||||
placeholder="" id="username" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
|
||||
<div nz-col [nzSpan]="query.expandForm ? 24 : 10" [class.text-right]="query.expandForm">
|
||||
<button nz-button type="submit" [nzType]="'primary'" [nzLoading]="query.submitLoading">{{ 'mxk.text.query' |
|
||||
i18n }}</button>
|
||||
<button nz-button type="reset" (click)="onReset()" class="mx-sm" style="display: none">{{ 'mxk.text.reset' |
|
||||
i18n }}</button>
|
||||
<button nz-button (click)="query.expandForm = !query.expandForm" class="mx-sm" style="display: none">
|
||||
{{ query.expandForm ? ('mxk.text.collapse' | i18n) : ('mxk.text.expand' | i18n) }}</button>
|
||||
<button nz-button nzType="primary" (click)="onSubmit($event)">{{ 'mxk.text.confirm' | i18n }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<nz-table #dynamicTable nzTableLayout="auto" nzBordered nzShowSizeChanger [nzData]="query.results.rows"
|
||||
[nzFrontPagination]="false" [nzTotal]="query.results.records" [nzPageSizeOptions]="query.params.pageSizeOptions"
|
||||
[nzPageSize]="query.params.pageSize" [nzPageIndex]="query.params.pageNumber" [nzLoading]="this.query.tableLoading"
|
||||
(nzQueryParams)="onQueryParamsChange($event)" nzWidth="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th [nzChecked]="query.checked" [nzIndeterminate]="query.indeterminate"
|
||||
(nzCheckedChange)="onTableAllChecked($event)"></th>
|
||||
<th nzAlign="center" style="display: none">Id</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.username' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.displayName' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.employeeNumber' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.department' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.jobTitle' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.gender' | i18n }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of query.results.rows">
|
||||
<td [nzChecked]="query.tableCheckedId.has(data.id)" [nzDisabled]="data.disabled"
|
||||
(nzCheckedChange)="onTableItemChecked(data.id, $event)"></td>
|
||||
<td nzAlign="left"> {{ data.username }}</td>
|
||||
<td nzAlign="left"> {{ data.displayName }}</td>
|
||||
<td nzAlign="left"> {{ data.employeeNumber }}</td>
|
||||
<td nzAlign="left"> {{ data.department }}</td>
|
||||
<td nzAlign="left"> {{ data.jobTitle }}</td>
|
||||
<td nzAlign="center"> {{ data.gender == 1 ? ('mxk.users.gender.female' | i18n) : ('mxk.users.gender.male' |
|
||||
i18n) }}</td>
|
||||
<td nzAlign="center"> <i *ngIf="data.dynamic == 1" nz-icon nzType="check-circle" nzTheme="fill"
|
||||
style="color: green"></i></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</nz-card>
|
||||
<div *nzModalFooter style="display: none">
|
||||
<button nz-button nzType="default" (click)="onClose($event)">{{ 'mxk.text.close' | i18n }}</button>
|
||||
<button nz-button nzType="primary" (click)="onSubmit($event)">{{ 'mxk.text.submit' | i18n }}</button>
|
||||
</div>
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GroupMembersEditerComponent } from './group-members-editer.component';
|
||||
|
||||
describe('GroupMembersEditerComponent', () => {
|
||||
let component: GroupMembersEditerComponent;
|
||||
let fixture: ComponentFixture<GroupMembersEditerComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GroupMembersEditerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GroupMembersEditerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ChangeDetectionStrategy, ViewContainerRef, Input, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { I18NService } from '@core';
|
||||
import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme';
|
||||
import { format, addDays } from 'date-fns';
|
||||
import { NzSafeAny } from 'ng-zorro-antd/core/types';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
|
||||
import { Groups } from '../../../../entity/Groups';
|
||||
import { GroupMembersService } from '../../../../service/group-members.service';
|
||||
@Component({
|
||||
selector: 'app-group-members-editer',
|
||||
templateUrl: './group-members-editer.component.html',
|
||||
styleUrls: ['./group-members-editer.component.less']
|
||||
})
|
||||
export class GroupMembersEditerComponent implements OnInit {
|
||||
@Input() groupId?: String;
|
||||
@Input() isEdit?: boolean;
|
||||
|
||||
query: {
|
||||
params: {
|
||||
name: String;
|
||||
displayName: String;
|
||||
username: String;
|
||||
groupId: String;
|
||||
startDate: String;
|
||||
endDate: String;
|
||||
startDatePicker: Date;
|
||||
endDatePicker: Date;
|
||||
pageSize: number;
|
||||
pageNumber: number;
|
||||
pageSizeOptions: number[];
|
||||
};
|
||||
results: {
|
||||
records: number;
|
||||
rows: NzSafeAny[];
|
||||
};
|
||||
expandForm: Boolean;
|
||||
submitLoading: boolean;
|
||||
tableLoading: boolean;
|
||||
tableCheckedId: Set<String>;
|
||||
indeterminate: boolean;
|
||||
checked: boolean;
|
||||
} = {
|
||||
params: {
|
||||
name: '',
|
||||
displayName: '',
|
||||
username: '',
|
||||
groupId: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
startDatePicker: addDays(new Date(), -30),
|
||||
endDatePicker: new Date(),
|
||||
pageSize: 5,
|
||||
pageNumber: 1,
|
||||
pageSizeOptions: [5, 15, 50]
|
||||
},
|
||||
results: {
|
||||
records: 0,
|
||||
rows: []
|
||||
},
|
||||
expandForm: false,
|
||||
submitLoading: false,
|
||||
tableLoading: false,
|
||||
tableCheckedId: new Set<String>(),
|
||||
indeterminate: false,
|
||||
checked: false
|
||||
};
|
||||
|
||||
constructor(
|
||||
private modalRef: NzModalRef,
|
||||
private groupMembersService: GroupMembersService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
|
||||
private cdr: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.groupId) {
|
||||
this.query.params.groupId = this.groupId;
|
||||
this.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
onQueryParamsChange(tableQueryParams: NzTableQueryParams): void {
|
||||
this.query.params.pageNumber = tableQueryParams.pageIndex;
|
||||
this.query.params.pageSize = tableQueryParams.pageSize;
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onSearch(): void {
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onReset(): void { }
|
||||
|
||||
fetch(): void {
|
||||
this.query.submitLoading = true;
|
||||
this.query.tableLoading = true;
|
||||
this.query.indeterminate = false;
|
||||
this.query.checked = false;
|
||||
this.query.tableCheckedId.clear();
|
||||
if (this.query.expandForm) {
|
||||
this.query.params.endDate = format(this.query.params.endDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
this.query.params.startDate = format(this.query.params.startDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
} else {
|
||||
this.query.params.endDate = '';
|
||||
this.query.params.startDate = '';
|
||||
}
|
||||
this.groupMembersService.memberOut(this.query.params).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
updateTableCheckedSet(id: String, checked: boolean): void {
|
||||
if (checked) {
|
||||
this.query.tableCheckedId.add(id);
|
||||
} else {
|
||||
this.query.tableCheckedId.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
refreshTableCheckedStatus(): void {
|
||||
const listOfEnabledData = this.query.results.rows.filter(({ disabled }) => !disabled);
|
||||
this.query.checked = listOfEnabledData.every(({ id }) => this.query.tableCheckedId.has(id));
|
||||
this.query.indeterminate = listOfEnabledData.some(({ id }) => this.query.tableCheckedId.has(id)) && !this.query.checked;
|
||||
}
|
||||
|
||||
onTableItemChecked(id: String, checked: boolean): void {
|
||||
//this.onTableAllChecked(false);
|
||||
this.updateTableCheckedSet(id, checked);
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
|
||||
onTableAllChecked(checked: boolean): void {
|
||||
this.query.results.rows.filter(({ disabled }) => !disabled).forEach(({ id }) => this.updateTableCheckedSet(id, checked));
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
|
||||
onSubmit(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
const listOfEnabledData = this.query.results.rows.filter(({ disabled }) => !disabled);
|
||||
let selectedData = listOfEnabledData.filter(({ id, name }) => {
|
||||
return this.query.tableCheckedId.has(id);
|
||||
});
|
||||
let memberIds = '';
|
||||
let memberNames = '';
|
||||
for (let i = 0; i < selectedData.length; i++) {
|
||||
memberIds = `${memberIds},${selectedData[i].id}`;
|
||||
memberNames = `${memberNames},${selectedData[i].username}`;
|
||||
}
|
||||
this.groupMembersService.add({ groupId: this.groupId, memberId: memberIds, memberName: memberNames }).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi('mxk.alert.operate.success'));
|
||||
this.fetch();
|
||||
} else {
|
||||
this.msg.error(this.i18n.fanyi('mxk.alert.operate.error'));
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
onClose(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
@ -1,93 +0,0 @@
|
||||
<page-header> </page-header>
|
||||
|
||||
<nz-card [nzBordered]="false">
|
||||
<form nz-form [nzLayout]="'inline'" (ngSubmit)="onSearch()" class="search__form">
|
||||
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 24, lg: 24, xl: 48, xxl: 48 }">
|
||||
<div nz-col nzMd="8" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="name">{{ 'mxk.groups.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<nz-input-group nzSearch [nzAddOnAfter]="suffixButton">
|
||||
<input nz-input [(ngModel)]="query.params.name" [ngModelOptions]="{ standalone: true }" name="name"
|
||||
readonly placeholder="" id="name" />
|
||||
</nz-input-group>
|
||||
<ng-template #suffixButton>
|
||||
<button nz-button nzType="primary" (click)="onSelect($event)" nzSearch>{{ 'mxk.text.select' | i18n
|
||||
}}</button>
|
||||
</ng-template>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
<div nz-col nzMd="8" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="name">{{ 'mxk.users.username' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<input nz-input [(ngModel)]="query.params.username" [ngModelOptions]="{ standalone: true }" name="username"
|
||||
placeholder="" id="username" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="query.expandForm ? 24 : 8" [class.text-right]="query.expandForm">
|
||||
<button nz-button type="submit" [nzType]="'primary'" [nzLoading]="query.submitLoading">{{ 'mxk.text.query' |
|
||||
i18n }}</button>
|
||||
<button nz-button type="reset" (click)="onReset()" class="mx-sm">{{ 'mxk.text.reset' | i18n }}</button>
|
||||
<button nz-button (click)="query.expandForm = !query.expandForm" class="mx-sm" style="display: none">
|
||||
{{ query.expandForm ? ('mxk.text.collapse' | i18n) : ('mxk.text.expand' | i18n) }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</nz-card>
|
||||
<nz-card [nzBordered]="false">
|
||||
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
|
||||
<div nz-col [nzSpan]="24" class="table-list-toolbar">
|
||||
<button nz-button type="button" [nzType]="'primary'" (click)="onAdd($event)">{{ 'mxk.text.add' | i18n }}</button>
|
||||
<button nz-button type="button" (click)="onBatchDelete($event)" [nzType]="'primary'" nzDanger class="mx-sm">{{
|
||||
'mxk.text.delete' | i18n
|
||||
}}</button>
|
||||
</div>
|
||||
|
||||
<div nz-col nzMd="24" nzSm="24">
|
||||
<nz-table #dynamicTable nzTableLayout="auto" nzBordered nzShowSizeChanger [nzData]="query.results.rows"
|
||||
[nzFrontPagination]="false" [nzTotal]="query.results.records" [nzPageSizeOptions]="query.params.pageSizeOptions"
|
||||
[nzPageSize]="query.params.pageSize" [nzPageIndex]="query.params.pageNumber"
|
||||
[nzLoading]="this.query.tableLoading" (nzQueryParams)="onQueryParamsChange($event)">
|
||||
<thead>
|
||||
<tr>
|
||||
<th [nzChecked]="query.checked" [nzIndeterminate]="query.indeterminate"
|
||||
(nzCheckedChange)="onTableAllChecked($event)"></th>
|
||||
<th nzAlign="center">{{ 'mxk.groups.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.username' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.employeeNumber' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.displayName' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.department' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.jobTitle' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.users.gender' | i18n }}</th>
|
||||
<th nzAlign="center"><a>{{ 'mxk.text.action' | i18n }}</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of query.results.rows">
|
||||
<td [nzChecked]="query.tableCheckedId.has(data.id)" [nzDisabled]="data.disabled"
|
||||
(nzCheckedChange)="onTableItemChecked(data.id, $event)"></td>
|
||||
<td nzAlign="left"> {{ data.groupName }}</td>
|
||||
<td nzAlign="left"> {{ data.username }}</td>
|
||||
<td nzAlign="left"> {{ data.employeeNumber }}</td>
|
||||
<td nzAlign="left"> {{ data.displayName }}</td>
|
||||
<td nzAlign="left"> {{ data.department }}</td>
|
||||
<td nzAlign="left"> {{ data.jobTitle }}</td>
|
||||
<td nzAlign="center"> {{ data.gender == 1 ? ('mxk.users.gender.female' | i18n) : ('mxk.users.gender.male' |
|
||||
i18n) }}</td>
|
||||
<td nzAlign="left" nzBreakWord="false">
|
||||
<div nz-col>
|
||||
<button *ngIf="data.dynamic == '0'" nz-button type="button" (click)="onDelete($event, data.id)"
|
||||
nzDanger>{{
|
||||
'mxk.text.delete' | i18n
|
||||
}}</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</div>
|
||||
</div>
|
||||
</nz-card>
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GroupMembersComponent } from './group-members.component';
|
||||
|
||||
describe('GroupMembersComponent', () => {
|
||||
let component: GroupMembersComponent;
|
||||
let fixture: ComponentFixture<GroupMembersComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GroupMembersComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GroupMembersComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,265 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { I18NService } from '@core';
|
||||
import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme';
|
||||
import { format, addDays } from 'date-fns';
|
||||
import { NzSafeAny } from 'ng-zorro-antd/core/types';
|
||||
import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
import { NzFormatEmitEvent, NzTreeNode, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
|
||||
|
||||
import { GroupMembersService } from '../../../service/group-members.service';
|
||||
import { set2String } from '../../../shared/index';
|
||||
import { SelectGroupsComponent } from '../groups/select-groups/select-groups.component';
|
||||
import { GroupMembersEditerComponent } from './group-members-editer/group-members-editer.component';
|
||||
import { MemberGroupsEditerComponent } from './member-groups-editer/member-groups-editer.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-members',
|
||||
templateUrl: './group-members.component.html',
|
||||
styleUrls: ['./group-members.component.less']
|
||||
})
|
||||
export class GroupMembersComponent implements OnInit {
|
||||
query: {
|
||||
params: {
|
||||
name: String;
|
||||
displayName: String;
|
||||
username: String;
|
||||
groupId: String;
|
||||
appName: String;
|
||||
appId: String;
|
||||
startDate: String;
|
||||
endDate: String;
|
||||
startDatePicker: Date;
|
||||
endDatePicker: Date;
|
||||
pageSize: number;
|
||||
pageNumber: number;
|
||||
pageSizeOptions: number[];
|
||||
};
|
||||
results: {
|
||||
records: number;
|
||||
rows: NzSafeAny[];
|
||||
};
|
||||
expandForm: Boolean;
|
||||
submitLoading: boolean;
|
||||
tableLoading: boolean;
|
||||
tableInitialize: boolean;
|
||||
tableCheckedId: Set<String>;
|
||||
indeterminate: boolean;
|
||||
checked: boolean;
|
||||
} = {
|
||||
params: {
|
||||
name: '',
|
||||
displayName: '',
|
||||
username: '',
|
||||
groupId: '',
|
||||
appName: '',
|
||||
appId: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
startDatePicker: addDays(new Date(), -30),
|
||||
endDatePicker: new Date(),
|
||||
pageSize: 10,
|
||||
pageNumber: 1,
|
||||
pageSizeOptions: [10, 20, 50]
|
||||
},
|
||||
results: {
|
||||
records: 0,
|
||||
rows: []
|
||||
},
|
||||
expandForm: false,
|
||||
submitLoading: false,
|
||||
tableLoading: false,
|
||||
tableInitialize: true,
|
||||
tableCheckedId: new Set<String>(),
|
||||
indeterminate: false,
|
||||
checked: false
|
||||
};
|
||||
|
||||
constructor(
|
||||
private modalService: NzModalService,
|
||||
private groupMembersService: GroupMembersService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
|
||||
private route: ActivatedRoute,
|
||||
private cdr: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.route.snapshot.queryParams['username']) {
|
||||
this.query.params.username = this.route.snapshot.queryParams['username'];
|
||||
}
|
||||
this.query.tableInitialize = false;
|
||||
}
|
||||
|
||||
onQueryParamsChange(tableQueryParams: NzTableQueryParams): void {
|
||||
this.query.params.pageNumber = tableQueryParams.pageIndex;
|
||||
this.query.params.pageSize = tableQueryParams.pageSize;
|
||||
if (!this.query.tableInitialize) {
|
||||
this.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
onSearch(): void {
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onReset(): void {
|
||||
this.query.params.username = '';
|
||||
this.query.params.groupId = '';
|
||||
this.query.params.name = '';
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onBatchDelete(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
this.groupMembersService.delete(set2String(this.query.tableCheckedId)).subscribe(res => {
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi('mxk.alert.delete.success'));
|
||||
this.fetch();
|
||||
} else {
|
||||
this.msg.error(this.i18n.fanyi('mxk.alert.delete.error'));
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
onAdd(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
if (this.query.params.username != '') {
|
||||
const modal = this.modalService.create({
|
||||
nzContent: MemberGroupsEditerComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
nzComponentParams: {
|
||||
username: this.query.params.username
|
||||
},
|
||||
nzWidth: 700,
|
||||
nzOnOk: () => new Promise(resolve => setTimeout(resolve, 1000))
|
||||
});
|
||||
// Return a result when closed
|
||||
modal.afterClose.subscribe(result => {
|
||||
if (result.refresh) {
|
||||
this.fetch();
|
||||
}
|
||||
});
|
||||
} else if (this.query.params.groupId != '') {
|
||||
const modal = this.modalService.create({
|
||||
nzContent: GroupMembersEditerComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
nzComponentParams: {
|
||||
isEdit: false,
|
||||
groupId: this.query.params.groupId
|
||||
},
|
||||
nzWidth: 700,
|
||||
nzOnOk: () => new Promise(resolve => setTimeout(resolve, 1000))
|
||||
});
|
||||
// Return a result when closed
|
||||
modal.afterClose.subscribe(result => {
|
||||
if (result.refresh) {
|
||||
this.fetch();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onSelect(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
|
||||
const modal = this.modalService.create({
|
||||
nzContent: SelectGroupsComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
nzComponentParams: {},
|
||||
nzWidth: 700,
|
||||
nzOnOk: () => new Promise(resolve => setTimeout(resolve, 1000))
|
||||
});
|
||||
// Return a result when closed
|
||||
modal.afterClose.subscribe(result => {
|
||||
if (result.refresh) {
|
||||
this.query.params.name = result.data.name;
|
||||
this.query.params.groupId = result.data.id;
|
||||
console.log(result);
|
||||
this.fetch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onDelete(e: MouseEvent, deleteId: String): void {
|
||||
e.preventDefault();
|
||||
this.groupMembersService.delete(deleteId).subscribe(res => {
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi('mxk.alert.delete.success'));
|
||||
this.fetch();
|
||||
} else {
|
||||
this.msg.error(this.i18n.fanyi('mxk.alert.delete.error'));
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
fetch(): void {
|
||||
this.query.submitLoading = true;
|
||||
this.query.tableLoading = true;
|
||||
this.query.indeterminate = false;
|
||||
this.query.checked = false;
|
||||
this.query.tableCheckedId.clear();
|
||||
if (this.query.expandForm) {
|
||||
this.query.params.endDate = format(this.query.params.endDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
this.query.params.startDate = format(this.query.params.startDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
} else {
|
||||
this.query.params.endDate = '';
|
||||
this.query.params.startDate = '';
|
||||
}
|
||||
this.groupMembersService.member(this.query.params).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
console.log(res.data);
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
updateTableCheckedSet(id: String, checked: boolean): void {
|
||||
if (checked) {
|
||||
this.query.tableCheckedId.add(id);
|
||||
} else {
|
||||
this.query.tableCheckedId.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
refreshTableCheckedStatus(): void {
|
||||
const listOfEnabledData = this.query.results.rows.filter(({ disabled }) => !disabled);
|
||||
this.query.checked = listOfEnabledData.every(({ id }) => this.query.tableCheckedId.has(id));
|
||||
this.query.indeterminate = listOfEnabledData.some(({ id }) => this.query.tableCheckedId.has(id)) && !this.query.checked;
|
||||
}
|
||||
|
||||
onTableItemChecked(id: String, checked: boolean): void {
|
||||
this.updateTableCheckedSet(id, checked);
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
|
||||
onTableAllChecked(checked: boolean): void {
|
||||
this.query.results.rows.filter(({ disabled }) => !disabled).forEach(({ id }) => this.updateTableCheckedSet(id, checked));
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
}
|
||||
@ -1,188 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Input, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { I18NService } from '@core';
|
||||
import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme';
|
||||
import { format, addDays } from 'date-fns';
|
||||
import { NzSafeAny } from 'ng-zorro-antd/core/types';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
|
||||
import { GroupMembersService } from '../../../../service/group-members.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-member-groups-editer',
|
||||
templateUrl: './member-groups-editer.component.html',
|
||||
styleUrls: ['./member-groups-editer.component.less']
|
||||
})
|
||||
export class MemberGroupsEditerComponent implements OnInit {
|
||||
@Input() username?: String;
|
||||
query: {
|
||||
params: {
|
||||
groupName: String;
|
||||
username: String;
|
||||
protocol: String;
|
||||
startDate: String;
|
||||
endDate: String;
|
||||
startDatePicker: Date;
|
||||
endDatePicker: Date;
|
||||
pageSize: number;
|
||||
pageNumber: number;
|
||||
pageSizeOptions: number[];
|
||||
};
|
||||
results: {
|
||||
records: number;
|
||||
rows: NzSafeAny[];
|
||||
};
|
||||
expandForm: Boolean;
|
||||
submitLoading: boolean;
|
||||
tableLoading: boolean;
|
||||
tableCheckedId: Set<String>;
|
||||
indeterminate: boolean;
|
||||
checked: boolean;
|
||||
} = {
|
||||
params: {
|
||||
groupName: '',
|
||||
username: '',
|
||||
protocol: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
startDatePicker: addDays(new Date(), -30),
|
||||
endDatePicker: new Date(),
|
||||
pageSize: 5,
|
||||
pageNumber: 1,
|
||||
pageSizeOptions: [5, 15, 50]
|
||||
},
|
||||
results: {
|
||||
records: 0,
|
||||
rows: []
|
||||
},
|
||||
expandForm: false,
|
||||
submitLoading: false,
|
||||
tableLoading: false,
|
||||
tableCheckedId: new Set<String>(),
|
||||
indeterminate: false,
|
||||
checked: false
|
||||
};
|
||||
|
||||
constructor(
|
||||
private modalRef: NzModalRef,
|
||||
private groupMembersService: GroupMembersService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
|
||||
private cdr: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.username) {
|
||||
this.query.params.username = this.username;
|
||||
}
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onQueryParamsChange(tableQueryParams: NzTableQueryParams): void {
|
||||
this.query.params.pageNumber = tableQueryParams.pageIndex;
|
||||
this.query.params.pageSize = tableQueryParams.pageSize;
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onSearch(): void {
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onReset(): void { }
|
||||
|
||||
fetch(): void {
|
||||
this.query.submitLoading = true;
|
||||
this.query.tableLoading = true;
|
||||
this.query.indeterminate = false;
|
||||
this.query.checked = true;
|
||||
this.query.tableCheckedId.clear();
|
||||
if (this.query.expandForm) {
|
||||
this.query.params.endDate = format(this.query.params.endDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
this.query.params.startDate = format(this.query.params.startDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
} else {
|
||||
this.query.params.endDate = '';
|
||||
this.query.params.startDate = '';
|
||||
}
|
||||
this.groupMembersService.groupsNoMember(this.query.params).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
updateTableCheckedSet(id: String, checked: boolean): void {
|
||||
if (checked) {
|
||||
this.query.tableCheckedId.add(id);
|
||||
} else {
|
||||
this.query.tableCheckedId.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
refreshTableCheckedStatus(): void {
|
||||
const listOfEnabledData = this.query.results.rows.filter(({ disabled }) => !disabled);
|
||||
this.query.checked = listOfEnabledData.every(({ id }) => this.query.tableCheckedId.has(id));
|
||||
this.query.indeterminate = listOfEnabledData.some(({ id }) => this.query.tableCheckedId.has(id)) && !this.query.checked;
|
||||
}
|
||||
|
||||
onTableItemChecked(id: String, checked: boolean): void {
|
||||
//this.onTableAllChecked(false);
|
||||
this.updateTableCheckedSet(id, checked);
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
|
||||
onTableAllChecked(checked: boolean): void {
|
||||
this.query.results.rows.filter(({ disabled }) => !disabled).forEach(({ id }) => this.updateTableCheckedSet(id, checked));
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
|
||||
onSubmit(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
const listOfEnabledData = this.query.results.rows.filter(({ disabled }) => !disabled);
|
||||
let selectedData = listOfEnabledData.filter(({ id, name }) => {
|
||||
return this.query.tableCheckedId.has(id);
|
||||
});
|
||||
let groupIds = '';
|
||||
let groupNames = '';
|
||||
for (let i = 0; i < selectedData.length; i++) {
|
||||
groupIds = `${groupIds},${selectedData[i].id}`;
|
||||
groupNames = `${groupNames},${selectedData[i].name}`;
|
||||
}
|
||||
this.groupMembersService.addMember2Groups({ username: this.username, groupId: groupIds, groupName: groupNames }).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi('mxk.alert.operate.success'));
|
||||
this.fetch();
|
||||
} else {
|
||||
this.msg.error(this.i18n.fanyi('mxk.alert.operate.error'));
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
onClose(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
<div *nzModalTitle> {{ isEdit ? ('mxk.text.edit' | i18n) : ('mxk.text.add' | i18n) }} </div>
|
||||
<div>
|
||||
<form nz-form [formGroup]="formGroup" (ngSubmit)="onSubmit($event)" se-container="1">
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzMd]="6" nzRequired nzFor="id">{{ 'mxk.text.id' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzMd]="18" nzErrorTip="The input is not valid id!">
|
||||
<input [(ngModel)]="form.model.id" disabled="{{ isEdit }}" [ngModelOptions]="{ standalone: true }" nz-input
|
||||
name="id" id="id" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="name">{{ 'mxk.groups.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzMd]="18" [nzXs]="36" [nzXl]="48" nzErrorTip="The input is not validminLength!">
|
||||
<input [(ngModel)]="form.model.name" [ngModelOptions]="{ standalone: true }" nz-input name="name" id="name" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="dynamic">{{ 'mxk.groups.dynamic' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="The input is not valid status!">
|
||||
<nz-switch [(ngModel)]="form.model.switch_dynamic" [ngModelOptions]="{ standalone: true }" name="dynamic"
|
||||
[nzCheckedChildren]="checkedTemplate" [nzUnCheckedChildren]="unCheckedTemplate"></nz-switch>
|
||||
<ng-template #checkedTemplate><i nz-icon nzType="check"></i></ng-template>
|
||||
<ng-template #unCheckedTemplate><i nz-icon nzType="close"></i></ng-template>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="form.model.switch_dynamic">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="resumeTime">{{ 'mxk.groups.resumeTime' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid port!">
|
||||
<nz-time-picker [(ngModel)]="form.model.picker_resumeTime" [ngModelOptions]="{ standalone: true }"
|
||||
nzFormat="HH:mm" name="picker_resumeTime" id="picker_resumeTime"></nz-time-picker>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="form.model.switch_dynamic">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="suspendTime">{{ 'mxk.groups.suspendTime' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid suspendTime!">
|
||||
<nz-time-picker [(ngModel)]="form.model.picker_suspendTime" [ngModelOptions]="{ standalone: true }"
|
||||
nzFormat="HH:mm" name="picker_suspendTime" id="picker_suspendTime"></nz-time-picker>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="form.model.switch_dynamic">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="orgIdsList">{{ 'mxk.groups.orgIdsList' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid upperCase!">
|
||||
<input type="hidden" [(ngModel)]="form.model.orgIdsList" [ngModelOptions]="{ standalone: true }" nz-input
|
||||
name="orgIdsList" id="orgIdsList" />
|
||||
<nz-tree-select nzVirtualHeight="300px" [nzMaxTagCount]="3" [(ngModel)]="selectValues"
|
||||
[ngModelOptions]="{ standalone: true }" [nzNodes]="treeNodes.nodes" nzCheckable nzPlaceHolder="Please select"
|
||||
[nzCheckStrictly]="true">
|
||||
</nz-tree-select>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="form.model.switch_dynamic">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="filters">{{ 'mxk.groups.filters' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid filters!">
|
||||
<textarea rows="4" nz-input [(ngModel)]="form.model.filters" [ngModelOptions]="{ standalone: true }" nz-input
|
||||
name="filters" id="filters"></textarea>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="description">{{ 'mxk.text.description' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid encoding!">
|
||||
<textarea rows="4" nz-input [(ngModel)]="form.model.description" [ngModelOptions]="{ standalone: true }"
|
||||
nz-input name="description" id="description"></textarea>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div *nzModalFooter>
|
||||
<button nz-button nzType="default" (click)="onClose($event)">{{ 'mxk.text.close' | i18n }}</button>
|
||||
<button nz-button nzType="primary" (click)="onSubmit($event)">{{ 'mxk.text.submit' | i18n }}</button>
|
||||
</div>
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GroupEditerComponent } from './group-editer.component';
|
||||
|
||||
describe('GroupEditerComponent', () => {
|
||||
let component: GroupEditerComponent;
|
||||
let fixture: ComponentFixture<GroupEditerComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GroupEditerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GroupEditerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ChangeDetectorRef, Input, OnInit, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { I18NService } from '@core';
|
||||
import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme';
|
||||
import format from 'date-fns/format';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
|
||||
import { Groups } from '../../../../entity/Groups';
|
||||
import { TreeNodes } from '../../../../entity/TreeNodes';
|
||||
import { GroupsService } from '../../../../service/groups.service';
|
||||
import { OrganizationsService } from '../../../../service/organizations.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-editer',
|
||||
templateUrl: './group-editer.component.html',
|
||||
styles: [
|
||||
`
|
||||
nz-form-item {
|
||||
width: 100%;
|
||||
}
|
||||
`
|
||||
],
|
||||
styleUrls: ['./group-editer.component.less']
|
||||
})
|
||||
export class GroupEditerComponent implements OnInit {
|
||||
@Input() id?: String;
|
||||
@Input() isEdit?: boolean;
|
||||
|
||||
form: {
|
||||
submitting: boolean;
|
||||
model: Groups;
|
||||
} = {
|
||||
submitting: false,
|
||||
model: new Groups()
|
||||
};
|
||||
|
||||
// TreeNodes
|
||||
treeNodes = new TreeNodes(false);
|
||||
|
||||
selectValues: string[] = [];
|
||||
|
||||
formGroup: FormGroup = new FormGroup({});
|
||||
|
||||
constructor(
|
||||
private modalRef: NzModalRef,
|
||||
private groupsService: GroupsService,
|
||||
private orgsService: OrganizationsService,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
|
||||
private cdr: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.tree();
|
||||
if (this.isEdit) {
|
||||
this.groupsService.get(`${this.id}`).subscribe(res => {
|
||||
this.form.model.init(res.data);
|
||||
this.selectValues = this.form.model.orgIdsList.split(',');
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
tree(): void {
|
||||
this.orgsService.tree({}).subscribe(res => {
|
||||
this.treeNodes.init(res.data);
|
||||
this.treeNodes.nodes = this.treeNodes.build();
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
onClose(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
this.modalRef.destroy({ refresh: false });
|
||||
}
|
||||
|
||||
onSubmit(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
this.form.submitting = true;
|
||||
this.form.model.trans();
|
||||
this.form.model.orgIdsList = '';
|
||||
this.selectValues.forEach(value => {
|
||||
this.form.model.orgIdsList = `${this.form.model.orgIdsList + value},`;
|
||||
});
|
||||
|
||||
(this.isEdit ? this.groupsService.update(this.form.model) : this.groupsService.add(this.form.model)).subscribe(res => {
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success'));
|
||||
} else {
|
||||
this.msg.error(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.error' : 'mxk.alert.add.error'));
|
||||
}
|
||||
this.form.submitting = false;
|
||||
this.modalRef.destroy({ refresh: true });
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GroupsComponent } from './groups.component';
|
||||
|
||||
describe('GroupsComponent', () => {
|
||||
let component: GroupsComponent;
|
||||
let fixture: ComponentFixture<GroupsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GroupsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GroupsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,220 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { I18NService } from '@core';
|
||||
import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme';
|
||||
import { format, addDays } from 'date-fns';
|
||||
import { NzSafeAny } from 'ng-zorro-antd/core/types';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
|
||||
import { GroupsService } from '../../../service/groups.service';
|
||||
import { set2String } from '../../../shared/index';
|
||||
import { GroupEditerComponent } from './group-editer/group-editer.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-groups',
|
||||
templateUrl: './groups.component.html',
|
||||
styleUrls: ['./groups.component.less']
|
||||
})
|
||||
export class GroupsComponent implements OnInit {
|
||||
query: {
|
||||
params: {
|
||||
name: String;
|
||||
displayName: String;
|
||||
employeeNumber: String;
|
||||
startDate: String;
|
||||
endDate: String;
|
||||
startDatePicker: Date;
|
||||
endDatePicker: Date;
|
||||
pageSize: number;
|
||||
pageNumber: number;
|
||||
pageSizeOptions: number[];
|
||||
};
|
||||
results: {
|
||||
records: number;
|
||||
rows: NzSafeAny[];
|
||||
};
|
||||
expandForm: Boolean;
|
||||
submitLoading: boolean;
|
||||
tableLoading: boolean;
|
||||
tableCheckedId: Set<String>;
|
||||
indeterminate: boolean;
|
||||
checked: boolean;
|
||||
} = {
|
||||
params: {
|
||||
name: '',
|
||||
displayName: '',
|
||||
employeeNumber: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
startDatePicker: addDays(new Date(), -30),
|
||||
endDatePicker: new Date(),
|
||||
pageSize: 10,
|
||||
pageNumber: 1,
|
||||
pageSizeOptions: [10, 20, 50]
|
||||
},
|
||||
results: {
|
||||
records: 0,
|
||||
rows: []
|
||||
},
|
||||
expandForm: false,
|
||||
submitLoading: false,
|
||||
tableLoading: false,
|
||||
tableCheckedId: new Set<String>(),
|
||||
indeterminate: false,
|
||||
checked: false
|
||||
};
|
||||
|
||||
constructor(
|
||||
private modalService: NzModalService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private groupsService: GroupsService,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
@Inject(ALAIN_I18N_TOKEN) private i18n: I18NService,
|
||||
private cdr: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onQueryParamsChange(tableQueryParams: NzTableQueryParams): void {
|
||||
this.query.params.pageNumber = tableQueryParams.pageIndex;
|
||||
this.query.params.pageSize = tableQueryParams.pageSize;
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onSearch(): void {
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onReset(): void { }
|
||||
|
||||
onBatchDelete(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
this.groupsService.delete(set2String(this.query.tableCheckedId)).subscribe(res => {
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi('mxk.alert.delete.success'));
|
||||
this.fetch();
|
||||
} else {
|
||||
this.msg.error(this.i18n.fanyi('mxk.alert.delete.error'));
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
onAdd(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
const modal = this.modalService.create({
|
||||
nzContent: GroupEditerComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
nzComponentParams: {
|
||||
isEdit: false,
|
||||
id: ''
|
||||
},
|
||||
nzOnOk: () => new Promise(resolve => setTimeout(resolve, 1000))
|
||||
});
|
||||
// Return a result when closed
|
||||
modal.afterClose.subscribe(result => {
|
||||
if (result.refresh) {
|
||||
this.fetch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onEdit(e: MouseEvent, editiId: String): void {
|
||||
e.preventDefault();
|
||||
|
||||
const modal = this.modalService.create({
|
||||
nzContent: GroupEditerComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
nzComponentParams: {
|
||||
isEdit: true,
|
||||
id: editiId
|
||||
},
|
||||
nzOnOk: () => new Promise(resolve => setTimeout(resolve, 1000))
|
||||
});
|
||||
// Return a result when closed
|
||||
modal.afterClose.subscribe(result => {
|
||||
if (result.refresh) {
|
||||
this.fetch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onDelete(e: MouseEvent, deleteId: String): void {
|
||||
e.preventDefault();
|
||||
this.groupsService.delete(deleteId).subscribe(res => {
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi('mxk.alert.delete.success'));
|
||||
this.fetch();
|
||||
} else {
|
||||
this.msg.error(this.i18n.fanyi('mxk.alert.delete.error'));
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
fetch(): void {
|
||||
this.query.submitLoading = true;
|
||||
this.query.tableLoading = true;
|
||||
this.query.indeterminate = false;
|
||||
this.query.checked = false;
|
||||
this.query.tableCheckedId.clear();
|
||||
if (this.query.expandForm) {
|
||||
this.query.params.endDate = format(this.query.params.endDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
this.query.params.startDate = format(this.query.params.startDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
} else {
|
||||
this.query.params.endDate = '';
|
||||
this.query.params.startDate = '';
|
||||
}
|
||||
this.groupsService.fetch(this.query.params).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
updateTableCheckedSet(id: String, checked: boolean): void {
|
||||
if (checked) {
|
||||
this.query.tableCheckedId.add(id);
|
||||
} else {
|
||||
this.query.tableCheckedId.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
refreshTableCheckedStatus(): void {
|
||||
const listOfEnabledData = this.query.results.rows.filter(({ disabled }) => !disabled);
|
||||
this.query.checked = listOfEnabledData.every(({ id }) => this.query.tableCheckedId.has(id));
|
||||
this.query.indeterminate = listOfEnabledData.some(({ id }) => this.query.tableCheckedId.has(id)) && !this.query.checked;
|
||||
}
|
||||
|
||||
onTableItemChecked(id: String, checked: boolean): void {
|
||||
this.updateTableCheckedSet(id, checked);
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
|
||||
onTableAllChecked(checked: boolean): void {
|
||||
this.query.results.rows.filter(({ disabled }) => !disabled).forEach(({ id }) => this.updateTableCheckedSet(id, checked));
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SelectGroupsComponent } from './select-groups.component';
|
||||
|
||||
describe('SelectGroupsComponent', () => {
|
||||
let component: SelectGroupsComponent;
|
||||
let fixture: ComponentFixture<SelectGroupsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ SelectGroupsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SelectGroupsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,166 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
import { format, addDays } from 'date-fns';
|
||||
import { NzSafeAny } from 'ng-zorro-antd/core/types';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
|
||||
import { GroupsService } from '../../../../service/groups.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-select-groups',
|
||||
templateUrl: './select-groups.component.html',
|
||||
styleUrls: ['./select-groups.component.less']
|
||||
})
|
||||
export class SelectGroupsComponent implements OnInit {
|
||||
query: {
|
||||
params: {
|
||||
name: String;
|
||||
displayName: String;
|
||||
protocol: String;
|
||||
startDate: String;
|
||||
endDate: String;
|
||||
startDatePicker: Date;
|
||||
endDatePicker: Date;
|
||||
pageSize: number;
|
||||
pageNumber: number;
|
||||
pageSizeOptions: number[];
|
||||
};
|
||||
results: {
|
||||
records: number;
|
||||
rows: NzSafeAny[];
|
||||
};
|
||||
expandForm: Boolean;
|
||||
submitLoading: boolean;
|
||||
tableLoading: boolean;
|
||||
tableCheckedId: Set<String>;
|
||||
indeterminate: boolean;
|
||||
checked: boolean;
|
||||
} = {
|
||||
params: {
|
||||
name: '',
|
||||
displayName: '',
|
||||
protocol: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
startDatePicker: addDays(new Date(), -30),
|
||||
endDatePicker: new Date(),
|
||||
pageSize: 5,
|
||||
pageNumber: 1,
|
||||
pageSizeOptions: [5, 15, 50]
|
||||
},
|
||||
results: {
|
||||
records: 0,
|
||||
rows: []
|
||||
},
|
||||
expandForm: false,
|
||||
submitLoading: false,
|
||||
tableLoading: false,
|
||||
tableCheckedId: new Set<String>(),
|
||||
indeterminate: false,
|
||||
checked: false
|
||||
};
|
||||
|
||||
constructor(
|
||||
private modalRef: NzModalRef,
|
||||
private groupsService: GroupsService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
private cdr: ChangeDetectorRef
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onQueryParamsChange(tableQueryParams: NzTableQueryParams): void {
|
||||
this.query.params.pageNumber = tableQueryParams.pageIndex;
|
||||
this.query.params.pageSize = tableQueryParams.pageSize;
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onSearch(): void {
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
onReset(): void { }
|
||||
|
||||
fetch(): void {
|
||||
this.query.submitLoading = true;
|
||||
this.query.tableLoading = true;
|
||||
this.query.indeterminate = false;
|
||||
this.query.checked = false;
|
||||
this.query.tableCheckedId.clear();
|
||||
if (this.query.expandForm) {
|
||||
this.query.params.endDate = format(this.query.params.endDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
this.query.params.startDate = format(this.query.params.startDatePicker, 'yyyy-MM-dd HH:mm:ss');
|
||||
} else {
|
||||
this.query.params.endDate = '';
|
||||
this.query.params.startDate = '';
|
||||
}
|
||||
this.groupsService.fetch(this.query.params).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
updateTableCheckedSet(id: String, checked: boolean): void {
|
||||
if (checked) {
|
||||
this.query.tableCheckedId.add(id);
|
||||
} else {
|
||||
this.query.tableCheckedId.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
refreshTableCheckedStatus(): void {
|
||||
const listOfEnabledData = this.query.results.rows.filter(({ disabled }) => !disabled);
|
||||
this.query.checked = listOfEnabledData.every(({ id }) => this.query.tableCheckedId.has(id));
|
||||
this.query.indeterminate = listOfEnabledData.some(({ id }) => this.query.tableCheckedId.has(id)) && !this.query.checked;
|
||||
}
|
||||
|
||||
onTableItemChecked(id: String, checked: boolean): void {
|
||||
this.onTableAllChecked(false);
|
||||
this.updateTableCheckedSet(id, checked);
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
|
||||
onTableAllChecked(checked: boolean): void {
|
||||
this.query.results.rows.filter(({ disabled }) => !disabled).forEach(({ id }) => this.updateTableCheckedSet(id, checked));
|
||||
this.refreshTableCheckedStatus();
|
||||
}
|
||||
|
||||
onSubmit(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
const listOfEnabledData = this.query.results.rows.filter(({ disabled }) => !disabled);
|
||||
let selectedData = listOfEnabledData.filter(({ id, name }) => {
|
||||
return this.query.tableCheckedId.has(id);
|
||||
});
|
||||
this.modalRef.destroy({ refresh: true, data: selectedData[0] });
|
||||
}
|
||||
|
||||
onClose(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
@ -24,14 +24,14 @@ import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
|
||||
import { GroupPrivilegesService } from '../../../../service/group-privileges.service';
|
||||
import { RolePermissionsService } from '../../../../service/role-permissions.service';
|
||||
@Component({
|
||||
selector: 'app-privileges-editer',
|
||||
templateUrl: './privileges-editer.component.html',
|
||||
styleUrls: ['./privileges-editer.component.less']
|
||||
selector: 'app-permissions-editer',
|
||||
templateUrl: './permissions-editer.component.html',
|
||||
styleUrls: ['./permissions-editer.component.less']
|
||||
})
|
||||
export class PrivilegesEditerComponent implements OnInit {
|
||||
@Input() groupId?: String;
|
||||
export class PermissionsEditerComponent implements OnInit {
|
||||
@Input() roleId?: String;
|
||||
@Input() isEdit?: boolean;
|
||||
|
||||
query: {
|
||||
@ -39,7 +39,7 @@ export class PrivilegesEditerComponent implements OnInit {
|
||||
name: String;
|
||||
displayName: String;
|
||||
username: String;
|
||||
groupId: String;
|
||||
roleId: String;
|
||||
startDate: String;
|
||||
endDate: String;
|
||||
startDatePicker: Date;
|
||||
@ -63,7 +63,7 @@ export class PrivilegesEditerComponent implements OnInit {
|
||||
name: '',
|
||||
displayName: '',
|
||||
username: '',
|
||||
groupId: '',
|
||||
roleId: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
startDatePicker: addDays(new Date(), -30),
|
||||
@ -86,7 +86,7 @@ export class PrivilegesEditerComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private modalRef: NzModalRef,
|
||||
private groupPrivilegesService: GroupPrivilegesService,
|
||||
private rolePermissionsService: RolePermissionsService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
@ -95,8 +95,8 @@ export class PrivilegesEditerComponent implements OnInit {
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.groupId) {
|
||||
this.query.params.groupId = this.groupId;
|
||||
if (this.roleId) {
|
||||
this.query.params.roleId = this.roleId;
|
||||
this.fetch();
|
||||
}
|
||||
}
|
||||
@ -126,7 +126,7 @@ export class PrivilegesEditerComponent implements OnInit {
|
||||
this.query.params.endDate = '';
|
||||
this.query.params.startDate = '';
|
||||
}
|
||||
this.groupPrivilegesService.memberOut(this.query.params).subscribe(res => {
|
||||
this.rolePermissionsService.memberOut(this.query.params).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
@ -171,7 +171,7 @@ export class PrivilegesEditerComponent implements OnInit {
|
||||
memberIds = `${memberIds},${selectedData[i].id}`;
|
||||
memberNames = `${memberNames},${selectedData[i].username}`;
|
||||
}
|
||||
this.groupPrivilegesService.add({ groupId: this.groupId, appId: memberIds, appName: memberNames }).subscribe(res => {
|
||||
this.rolePermissionsService.add({ roleId: this.roleId, appId: memberIds, appName: memberNames }).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
@ -5,11 +5,11 @@
|
||||
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 24, lg: 24, xl: 48, xxl: 48 }">
|
||||
<div nz-col nzMd="10" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="groupName">{{ 'mxk.groups.name' | i18n }}</nz-form-label>
|
||||
<nz-form-label nzFor="roleName">{{ 'mxk.roles.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<nz-input-group nzSearch [nzAddOnAfter]="suffixButton">
|
||||
<input nz-input [(ngModel)]="query.params.groupName" [ngModelOptions]="{ standalone: true }"
|
||||
name="groupName" readonly placeholder="" id="groupName" />
|
||||
<input nz-input [(ngModel)]="query.params.roleName" [ngModelOptions]="{ standalone: true }"
|
||||
name="roleName" readonly placeholder="" id="roleName" />
|
||||
</nz-input-group>
|
||||
<ng-template #suffixButton>
|
||||
<button nz-button nzType="primary" (click)="onSelect($event)" nzSearch>{{ 'mxk.text.select' | i18n
|
||||
@ -57,7 +57,7 @@
|
||||
<th [nzChecked]="query.checked" [nzIndeterminate]="query.indeterminate"
|
||||
(nzCheckedChange)="onTableAllChecked($event)"></th>
|
||||
<th nzAlign="center" style="display: none">Id</th>
|
||||
<th nzAlign="center">{{ 'mxk.groups.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.apps.icon' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.apps.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.apps.protocol' | i18n }}</th>
|
||||
@ -69,7 +69,7 @@
|
||||
<tr *ngFor="let data of query.results.rows">
|
||||
<td [nzChecked]="query.tableCheckedId.has(data.id)" [nzDisabled]="data.disabled"
|
||||
(nzCheckedChange)="onTableItemChecked(data.id, $event)"></td>
|
||||
<td nzAlign="left"> {{ data.groupName }}</td>
|
||||
<td nzAlign="left"> {{ data.roleName }}</td>
|
||||
<td nzAlign="center"><img height="30" border="0px" src="{{ data.iconBase64 }}" /></td>
|
||||
<td nzAlign="left"> {{ data.name }}</td>
|
||||
<td nzAlign="left"> {{ data.protocol }}</td>
|
||||
@ -26,24 +26,24 @@ import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
import { NzFormatEmitEvent, NzTreeNode, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
|
||||
|
||||
import { GroupPrivilegesService } from '../../../service/group-privileges.service';
|
||||
import { RolePermissionsService } from '../../../service/role-permissions.service';
|
||||
import { set2String } from '../../../shared/index';
|
||||
import { SelectGroupsComponent } from '../groups/select-groups/select-groups.component';
|
||||
import { PrivilegesEditerComponent } from './privileges-editer/privileges-editer.component';
|
||||
import { SelectRolesComponent } from '../roles/select-roles/select-roles.component';
|
||||
import { PermissionsEditerComponent } from './permissions-editer/permissions-editer.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-privileges',
|
||||
templateUrl: './privileges.component.html',
|
||||
styleUrls: ['./privileges.component.less']
|
||||
selector: 'app-permissions',
|
||||
templateUrl: './permissions.component.html',
|
||||
styleUrls: ['./permissions.component.less']
|
||||
})
|
||||
export class PrivilegesComponent implements OnInit {
|
||||
export class PermissionsComponent implements OnInit {
|
||||
query: {
|
||||
params: {
|
||||
name: String;
|
||||
displayName: String;
|
||||
username: String;
|
||||
groupId: String;
|
||||
groupName: String;
|
||||
roleId: String;
|
||||
roleName: String;
|
||||
appName: String;
|
||||
appId: String;
|
||||
startDate: String;
|
||||
@ -70,8 +70,8 @@ export class PrivilegesComponent implements OnInit {
|
||||
name: '',
|
||||
displayName: '',
|
||||
username: '',
|
||||
groupId: '',
|
||||
groupName: '',
|
||||
roleId: '',
|
||||
roleName: '',
|
||||
appName: '',
|
||||
appId: '',
|
||||
startDate: '',
|
||||
@ -97,7 +97,7 @@ export class PrivilegesComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private modalService: NzModalService,
|
||||
private groupPrivilegesService: GroupPrivilegesService,
|
||||
private rolePermissionsService: RolePermissionsService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
@ -126,7 +126,7 @@ export class PrivilegesComponent implements OnInit {
|
||||
|
||||
onBatchDelete(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
this.groupPrivilegesService.delete(set2String(this.query.tableCheckedId)).subscribe(res => {
|
||||
this.rolePermissionsService.delete(set2String(this.query.tableCheckedId)).subscribe(res => {
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi('mxk.alert.delete.success'));
|
||||
this.fetch();
|
||||
@ -140,11 +140,11 @@ export class PrivilegesComponent implements OnInit {
|
||||
onAdd(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
const modal = this.modalService.create({
|
||||
nzContent: PrivilegesEditerComponent,
|
||||
nzContent: PermissionsEditerComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
nzComponentParams: {
|
||||
isEdit: false,
|
||||
groupId: this.query.params.groupId
|
||||
roleId: this.query.params.roleId
|
||||
},
|
||||
nzWidth: 700,
|
||||
nzOnOk: () => new Promise(resolve => setTimeout(resolve, 1000))
|
||||
@ -160,7 +160,7 @@ export class PrivilegesComponent implements OnInit {
|
||||
onSelect(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
const modal = this.modalService.create({
|
||||
nzContent: SelectGroupsComponent,
|
||||
nzContent: SelectRolesComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
nzComponentParams: {},
|
||||
nzWidth: 700,
|
||||
@ -169,8 +169,8 @@ export class PrivilegesComponent implements OnInit {
|
||||
// Return a result when closed
|
||||
modal.afterClose.subscribe(result => {
|
||||
if (result.refresh) {
|
||||
this.query.params.groupName = result.data.name;
|
||||
this.query.params.groupId = result.data.id;
|
||||
this.query.params.roleName = result.data.name;
|
||||
this.query.params.roleId = result.data.id;
|
||||
console.log(result);
|
||||
this.fetch();
|
||||
}
|
||||
@ -179,7 +179,7 @@ export class PrivilegesComponent implements OnInit {
|
||||
|
||||
onDelete(e: MouseEvent, deleteId: String): void {
|
||||
e.preventDefault();
|
||||
this.groupPrivilegesService.delete(deleteId).subscribe(res => {
|
||||
this.rolePermissionsService.delete(deleteId).subscribe(res => {
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi('mxk.alert.delete.success'));
|
||||
this.fetch();
|
||||
@ -203,7 +203,7 @@ export class PrivilegesComponent implements OnInit {
|
||||
this.query.params.endDate = '';
|
||||
this.query.params.startDate = '';
|
||||
}
|
||||
this.groupPrivilegesService.member(this.query.params).subscribe(res => {
|
||||
this.rolePermissionsService.member(this.query.params).subscribe(res => {
|
||||
this.query.results = res.data;
|
||||
this.query.submitLoading = false;
|
||||
this.query.tableLoading = false;
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PrivilegesEditerComponent } from './privileges-editer.component';
|
||||
|
||||
describe('PrivilegesEditerComponent', () => {
|
||||
let component: PrivilegesEditerComponent;
|
||||
let fixture: ComponentFixture<PrivilegesEditerComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PrivilegesEditerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PrivilegesEditerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PrivilegesComponent } from './privileges.component';
|
||||
|
||||
describe('PrivilegesComponent', () => {
|
||||
let component: PrivilegesComponent;
|
||||
let fixture: ComponentFixture<PrivilegesComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PrivilegesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PrivilegesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -25,6 +25,7 @@ import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
|
||||
import { RoleMembersService } from '../../../../service/role-members.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-member-roles-editer',
|
||||
templateUrl: './member-roles-editer.component.html',
|
||||
@ -34,7 +35,7 @@ export class MemberRolesEditerComponent implements OnInit {
|
||||
@Input() username?: String;
|
||||
query: {
|
||||
params: {
|
||||
roleName: String;
|
||||
groupName: String;
|
||||
username: String;
|
||||
protocol: String;
|
||||
startDate: String;
|
||||
@ -57,7 +58,7 @@ export class MemberRolesEditerComponent implements OnInit {
|
||||
checked: boolean;
|
||||
} = {
|
||||
params: {
|
||||
roleName: '',
|
||||
groupName: '',
|
||||
username: '',
|
||||
protocol: '',
|
||||
startDate: '',
|
||||
@ -1,37 +1,35 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RoleMembersEditerComponent } from './role-members-editer.component';
|
||||
|
||||
describe('RoleMembersEditerComponent', () => {
|
||||
let component: RoleMembersEditerComponent;
|
||||
let fixture: ComponentFixture<RoleMembersEditerComponent>;
|
||||
describe('GroupMembersEditerComponent', () => {
|
||||
let component: GroupMembersEditerComponent;
|
||||
let fixture: ComponentFixture<GroupMembersEditerComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ RoleMembersEditerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [GroupMembersEditerComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RoleMembersEditerComponent);
|
||||
fixture = TestBed.createComponent(GroupMembersEditerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
@ -24,8 +24,8 @@ import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
||||
|
||||
import { Roles } from '../../../../entity/Roles';
|
||||
import { RoleMembersService } from '../../../../service/role-members.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-role-members-editer',
|
||||
templateUrl: './role-members-editer.component.html',
|
||||
@ -8,8 +8,8 @@
|
||||
<nz-form-label nzFor="name">{{ 'mxk.roles.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<nz-input-group nzSearch [nzAddOnAfter]="suffixButton">
|
||||
<input nz-input [(ngModel)]="query.params.roleName" [ngModelOptions]="{ standalone: true }"
|
||||
name="roleName" readonly placeholder="" id="roleName" />
|
||||
<input nz-input [(ngModel)]="query.params.name" [ngModelOptions]="{ standalone: true }" name="name"
|
||||
readonly placeholder="" id="name" />
|
||||
</nz-input-group>
|
||||
<ng-template #suffixButton>
|
||||
<button nz-button nzType="primary" (click)="onSelect($event)" nzSearch>{{ 'mxk.text.select' | i18n
|
||||
@ -45,7 +45,6 @@ export class RoleMembersComponent implements OnInit {
|
||||
displayName: String;
|
||||
username: String;
|
||||
roleId: String;
|
||||
roleName: String;
|
||||
appName: String;
|
||||
appId: String;
|
||||
startDate: String;
|
||||
@ -73,7 +72,6 @@ export class RoleMembersComponent implements OnInit {
|
||||
displayName: '',
|
||||
username: '',
|
||||
roleId: '',
|
||||
roleName: '',
|
||||
appName: '',
|
||||
appId: '',
|
||||
startDate: '',
|
||||
@ -129,9 +127,8 @@ export class RoleMembersComponent implements OnInit {
|
||||
|
||||
onReset(): void {
|
||||
this.query.params.username = '';
|
||||
this.query.params.name = '';
|
||||
this.query.params.roleId = '';
|
||||
this.query.params.roleName = '';
|
||||
this.query.params.name = '';
|
||||
this.fetch();
|
||||
}
|
||||
|
||||
@ -188,6 +185,7 @@ export class RoleMembersComponent implements OnInit {
|
||||
|
||||
onSelect(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
|
||||
const modal = this.modalService.create({
|
||||
nzContent: SelectRolesComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
@ -198,7 +196,7 @@ export class RoleMembersComponent implements OnInit {
|
||||
// Return a result when closed
|
||||
modal.afterClose.subscribe(result => {
|
||||
if (result.refresh) {
|
||||
this.query.params.roleName = result.data.name;
|
||||
this.query.params.name = result.data.name;
|
||||
this.query.params.roleId = result.data.id;
|
||||
console.log(result);
|
||||
this.fetch();
|
||||
@ -39,7 +39,7 @@
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="form.model.switch_dynamic">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="orgIdsList">{{ 'mxk.roles.orgIdsList' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid orgIdsList!">
|
||||
<nz-form-control [nzSm]="18" [nzXs]="24" nzErrorTip="The input is not valid upperCase!">
|
||||
<input type="hidden" [(ngModel)]="form.model.orgIdsList" [ngModelOptions]="{ standalone: true }" nz-input
|
||||
name="orgIdsList" id="orgIdsList" />
|
||||
<nz-tree-select nzVirtualHeight="300px" [nzMaxTagCount]="3" [(ngModel)]="selectValues"
|
||||
@ -21,8 +21,8 @@ import { _HttpClient, ALAIN_I18N_TOKEN, SettingsService } from '@delon/theme';
|
||||
import format from 'date-fns/format';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { Roles } from 'src/app/entity/Roles';
|
||||
|
||||
import { Roles } from '../../../../entity/Roles';
|
||||
import { TreeNodes } from '../../../../entity/TreeNodes';
|
||||
import { OrganizationsService } from '../../../../service/organizations.service';
|
||||
import { RolesService } from '../../../../service/roles.service';
|
||||
@ -50,6 +50,7 @@ export class RoleEditerComponent implements OnInit {
|
||||
submitting: false,
|
||||
model: new Roles()
|
||||
};
|
||||
|
||||
// TreeNodes
|
||||
treeNodes = new TreeNodes(false);
|
||||
|
||||
@ -99,6 +100,7 @@ export class RoleEditerComponent implements OnInit {
|
||||
this.selectValues.forEach(value => {
|
||||
this.form.model.orgIdsList = `${this.form.model.orgIdsList + value},`;
|
||||
});
|
||||
|
||||
(this.isEdit ? this.rolesService.update(this.form.model) : this.rolesService.add(this.form.model)).subscribe(res => {
|
||||
if (res.code == 0) {
|
||||
this.msg.success(this.i18n.fanyi(this.isEdit ? 'mxk.alert.update.success' : 'mxk.alert.add.success'));
|
||||
@ -1,19 +1,18 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
@ -82,8 +81,8 @@ export class SelectRolesComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private modalRef: NzModalRef,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private rolesService: RolesService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
private fb: FormBuilder,
|
||||
private msg: NzMessageService,
|
||||
private cdr: ChangeDetectorRef
|
||||
@ -49,29 +49,6 @@
|
||||
name="username" id="username" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item style="display: none">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="strategyId">{{ 'mxk.accountsstrategy.id' | i18n }}
|
||||
</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzMd]="18" [nzXs]="36" [nzXl]="48" nzErrorTip="The input is not valid strategyId!">
|
||||
<input [(ngModel)]="form.model.strategyId" readonly [ngModelOptions]="{ standalone: true }" nz-input
|
||||
name="strategyId" id="strategyId" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="strategyName">{{ 'mxk.accountsstrategy.name' | i18n }}
|
||||
</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzMd]="18" [nzXs]="36" [nzXl]="48"
|
||||
nzErrorTip="The input is not valid strategyName!">
|
||||
<nz-input-group nzSearch [nzAddOnAfter]="suffixStrategyButton">
|
||||
<input [(ngModel)]="form.model.strategyName" [ngModelOptions]="{ standalone: true }" nz-input readonly
|
||||
name="strategyName" id="strategyName" />
|
||||
</nz-input-group>
|
||||
<ng-template #suffixStrategyButton>
|
||||
<button nz-button nzType="primary" nzSearch (click)="onSelectStrategy($event)">{{ 'mxk.text.select' | i18n
|
||||
}}</button>
|
||||
</ng-template>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item style="display: none">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="appId">{{ 'mxk.apps.id' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzMd]="18" [nzXs]="36" [nzXl]="48" nzErrorTip="The input is not valid appId!">
|
||||
@ -79,26 +56,35 @@
|
||||
id="appId" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="appName">{{ 'mxk.apps.name' | i18n }}</nz-form-label>
|
||||
<nz-form-item *ngIf="isEdit">
|
||||
<nz-form-label nzRequired [nzSm]="6" [nzXs]="24" nzFor="appName">{{ 'mxk.apps.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzMd]="18" [nzXs]="36" [nzXl]="48" nzErrorTip="The input is not valid appName!">
|
||||
<input [(ngModel)]="form.model.appName" disabled="true" [ngModelOptions]="{ standalone: true }" nz-input
|
||||
name="appName" id="appName" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item *ngIf="!isEdit && username == ''">
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="appName">{{ 'mxk.apps.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzMd]="18" [nzXs]="36" [nzXl]="48" nzErrorTip="The input is not valid appName!">
|
||||
<nz-input-group nzSearch [nzAddOnAfter]="suffixStrategyButton">
|
||||
<input [(ngModel)]="form.model.appName" [ngModelOptions]="{ standalone: true }" nz-input name="appName"
|
||||
id="appName" />
|
||||
</nz-input-group>
|
||||
<ng-template #suffixStrategyButton>
|
||||
<button nz-button nzType="primary" nzSearch (click)="onSelectApp($event)">{{ 'mxk.text.select' | i18n
|
||||
}}</button>
|
||||
</ng-template>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="relatedUsername">{{ 'mxk.accounts.relatedUsername' | i18n
|
||||
}}</nz-form-label>
|
||||
<nz-form-control [nzSm]="18" [nzMd]="18" [nzXs]="36" [nzXl]="48"
|
||||
nzErrorTip="The input is not valid relatedUsername!">
|
||||
<nz-input-group nzSearch [nzAddOnAfter]="suffixUserButton">
|
||||
<nz-input-group nzSearch>
|
||||
<input [(ngModel)]="form.model.relatedUsername" [ngModelOptions]="{ standalone: true }" nz-input
|
||||
disabled="{{ isEdit }}" name="relatedUsername" id="relatedUsername" />
|
||||
</nz-input-group>
|
||||
<ng-template #suffixUserButton>
|
||||
<button nz-button nzType="primary" style="{{ isEdit ? 'display:none' : 'display:block' }}" nzSearch
|
||||
(click)="onGenerate($event)">{{ 'mxk.text.generate' | i18n }}</button>
|
||||
</ng-template>
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
|
||||
@ -25,7 +25,7 @@ import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { Accounts } from '../../../entity/Accounts';
|
||||
import { AccountsService } from '../../../service/accounts.service';
|
||||
import { UsersService } from '../../../service/users.service';
|
||||
import { SelectAccountsStrategyComponent } from '../../config/accounts-strategy/select-accounts-strategy/select-accounts-strategy.component';
|
||||
import { SelectAppsComponent } from '../../apps/select-apps/select-apps.component';
|
||||
import { SelectUserComponent } from '../../users/select-user/select-user.component';
|
||||
|
||||
@Component({
|
||||
@ -107,10 +107,10 @@ export class AccountEditerComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onSelectStrategy(e: MouseEvent): void {
|
||||
onSelectApp(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
const modal = this.modalService.create({
|
||||
nzContent: SelectAccountsStrategyComponent,
|
||||
nzContent: SelectAppsComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
nzComponentParams: {},
|
||||
nzWidth: 600,
|
||||
@ -119,10 +119,8 @@ export class AccountEditerComponent implements OnInit {
|
||||
// Return a result when closed
|
||||
modal.afterClose.subscribe(result => {
|
||||
if (result.refresh) {
|
||||
this.form.model.appId = result.data.appId;
|
||||
this.form.model.appName = result.data.appName;
|
||||
this.form.model.strategyName = result.data.name;
|
||||
this.form.model.strategyId = result.data.id;
|
||||
this.form.model.appId = result.data.id;
|
||||
this.form.model.appName = result.data.name;
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
});
|
||||
|
||||
@ -58,7 +58,6 @@
|
||||
<th nzAlign="center">{{ 'mxk.accounts.displayName' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.accounts.appName' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.accounts.relatedUsername' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.text.status' | i18n }}</th>
|
||||
<th nzAlign="center"><a>{{ 'mxk.text.action' | i18n }}</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -73,27 +72,9 @@
|
||||
<td nzAlign="left" nzBreakWord="false">{{ data.displayName }}</td>
|
||||
<td nzAlign="left" nzBreakWord="false">{{ data.appName }}</td>
|
||||
<td nzAlign="left" nzBreakWord="false">{{ data.relatedUsername }}</td>
|
||||
<td nzAlign="center">
|
||||
<i *ngIf="data.status == 1" nz-icon nzType="check-circle" nzTheme="fill" style="color: green"></i>
|
||||
<i *ngIf="data.status == 2" nz-icon nzType="warning" nzTheme="fill" style="color: gray"></i>
|
||||
<i *ngIf="data.status == 4" nz-icon nzType="stop" nzTheme="fill" style="color: gray"></i>
|
||||
</td>
|
||||
|
||||
<td nzAlign="left" nzBreakWord="false">
|
||||
<div nz-col>
|
||||
<button *ngIf="data.status == 2" nz-button type="button" (click)="onUpdateStatus($event, data.id, 1)"
|
||||
style="float: left">{{
|
||||
'mxk.text.enable' | i18n
|
||||
}}</button>
|
||||
<button *ngIf="data.status == 4" nz-button type="button" (click)="onUpdateStatus($event, data.id, 1)"
|
||||
style="float: left">{{
|
||||
'mxk.text.enable' | i18n
|
||||
}}</button>
|
||||
<button *ngIf="data.status == 1" nz-button type="button" (click)="onUpdateStatus($event, data.id, 4)"
|
||||
style="float: left">{{
|
||||
'mxk.text.disable' | i18n
|
||||
}}</button>
|
||||
<button nz-button type="button" (click)="onEdit($event, data.id)" style="float: left">{{ 'mxk.text.edit' |
|
||||
i18n }}</button>
|
||||
<button nz-button type="button" (click)="onDelete($event, data.id)" nzDanger>{{ 'mxk.text.delete' | i18n
|
||||
}}</button>
|
||||
</div>
|
||||
|
||||
@ -174,26 +174,6 @@ export class AccountsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onEdit(e: MouseEvent, editiId: String): void {
|
||||
e.preventDefault();
|
||||
|
||||
const modal = this.modalService.create({
|
||||
nzContent: AccountEditerComponent,
|
||||
nzViewContainerRef: this.viewContainerRef,
|
||||
nzComponentParams: {
|
||||
isEdit: true,
|
||||
id: editiId
|
||||
},
|
||||
nzOnOk: () => new Promise(resolve => setTimeout(resolve, 1000))
|
||||
});
|
||||
// Return a result when closed
|
||||
modal.afterClose.subscribe(result => {
|
||||
if (result.refresh) {
|
||||
this.fetch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onDelete(e: MouseEvent, deleteId: String): void {
|
||||
e.preventDefault();
|
||||
this.accountsService.delete(deleteId).subscribe(res => {
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
@ -21,38 +20,26 @@ import { RouterModule, Routes } from '@angular/router';
|
||||
import { SharedModule } from '@shared';
|
||||
import { NzIconModule } from 'ng-zorro-antd/icon';
|
||||
|
||||
import { RolesComponent } from '../access/roles/roles.component';
|
||||
import { SelectRolesComponent } from '../access/roles/select-roles/select-roles.component';
|
||||
import { PrivilegesComponent } from './privileges/privileges.component';
|
||||
import { ResourcesComponent } from './resources/resources.component';
|
||||
import { RoleMembersComponent } from './role-members/role-members.component';
|
||||
import { RoleEditerComponent } from './roles/role-editer/role-editer.component';
|
||||
import { RolesComponent } from './roles/roles.component';
|
||||
import { ResourceEditerComponent } from './resources/resource-editer/resource-editer.component';
|
||||
import { SelectRolesComponent } from './roles/select-roles/select-roles.component';
|
||||
import { RoleMembersEditerComponent } from './role-members/role-members-editer/role-members-editer.component';
|
||||
import { MemberRolesEditerComponent } from './role-members/member-roles-editer/member-roles-editer.component';
|
||||
import { ResourcesComponent } from './resources/resources.component';
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'roles',
|
||||
component: RolesComponent
|
||||
},
|
||||
{
|
||||
path: 'resources',
|
||||
component: ResourcesComponent
|
||||
},
|
||||
{
|
||||
path: 'rolemembers',
|
||||
component: RoleMembersComponent
|
||||
},
|
||||
{
|
||||
path: 'privileges',
|
||||
component: PrivilegesComponent
|
||||
}
|
||||
];
|
||||
|
||||
const COMPONENTS = [RolesComponent];
|
||||
const COMPONENTS = [ResourcesComponent, PrivilegesComponent, ResourceEditerComponent];
|
||||
|
||||
@NgModule({
|
||||
declarations: [...COMPONENTS, RoleEditerComponent, RoleMembersComponent, ResourcesComponent, PrivilegesComponent, ResourceEditerComponent, SelectRolesComponent, RoleMembersEditerComponent, MemberRolesEditerComponent],
|
||||
declarations: [...COMPONENTS],
|
||||
imports: [NzIconModule, SharedModule, CommonModule, RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
<div *nzModalTitle> {{ 'mxk.text.add' | i18n }} </div>
|
||||
<nz-card [nzBordered]="false">
|
||||
<form nz-form [nzLayout]="'inline'" (ngSubmit)="onSearch()" class="search__form">
|
||||
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
|
||||
<div nz-col nzMd="14" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="name">{{ 'mxk.roles.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<input nz-input [(ngModel)]="query.params.roleName" [ngModelOptions]="{ standalone: true }"
|
||||
name="roleName" placeholder="" id="roleName" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
|
||||
<div nz-col [nzSpan]="query.expandForm ? 24 : 10" [class.text-right]="query.expandForm">
|
||||
<button nz-button type="submit" [nzType]="'primary'" [nzLoading]="query.submitLoading">{{
|
||||
'mxk.text.query' | i18n }}</button>
|
||||
<button nz-button type="reset" (click)="onReset()" class="mx-sm" style="display: none">{{
|
||||
'mxk.text.reset' | i18n }}</button>
|
||||
<button nz-button (click)="query.expandForm = !query.expandForm" class="mx-sm" style="display: none">
|
||||
{{ query.expandForm ? ('mxk.text.collapse' | i18n) : ('mxk.text.expand' | i18n) }}</button>
|
||||
<button nz-button nzType="primary" (click)="onSubmit($event)">{{ 'mxk.text.confirm' | i18n }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<nz-table #dynamicTable nzTableLayout="auto" nzBordered nzShowSizeChanger [nzData]="query.results.rows"
|
||||
[nzFrontPagination]="false" [nzTotal]="query.results.records" [nzPageSizeOptions]="query.params.pageSizeOptions"
|
||||
[nzPageSize]="query.params.pageSize" [nzPageIndex]="query.params.pageNumber"
|
||||
[nzLoading]="this.query.tableLoading" (nzQueryParams)="onQueryParamsChange($event)" nzWidth="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th nzAlign="center" style="display: none">Id</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.dynamic' | i18n }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of query.results.rows">
|
||||
<td [nzChecked]="query.tableCheckedId.has(data.id)" [nzDisabled]="data.disabled"
|
||||
(nzCheckedChange)="onTableItemChecked(data.id, $event)"></td>
|
||||
<td nzAlign="left" style="display: none">
|
||||
<span>{{ data.id }}</span>
|
||||
</td>
|
||||
<td nzAlign="left"> {{ data.name }}</td>
|
||||
<td nzAlign="center"> <i *ngIf="data.dynamic == 1" nz-icon nzType="check-circle" nzTheme="fill"
|
||||
style="color: green"></i></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</nz-card>
|
||||
<div *nzModalFooter style="display: none">
|
||||
<button nz-button nzType="default" (click)="onClose($event)">{{ 'mxk.text.close' | i18n }}</button>
|
||||
<button nz-button nzType="primary" (click)="onSubmit($event)">{{ 'mxk.text.submit' | i18n }}</button>
|
||||
</div>
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MemberRolesEditerComponent } from './member-roles-editer.component';
|
||||
|
||||
describe('MemberRolesEditerComponent', () => {
|
||||
let component: MemberRolesEditerComponent;
|
||||
let fixture: ComponentFixture<MemberRolesEditerComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ MemberRolesEditerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MemberRolesEditerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RoleMembersComponent } from './role-members.component';
|
||||
|
||||
describe('RoleMembersComponent', () => {
|
||||
let component: RoleMembersComponent;
|
||||
let fixture: ComponentFixture<RoleMembersComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ RoleMembersComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RoleMembersComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RoleEditerComponent } from './role-editer.component';
|
||||
|
||||
describe('RoleEditerComponent', () => {
|
||||
let component: RoleEditerComponent;
|
||||
let fixture: ComponentFixture<RoleEditerComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ RoleEditerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RoleEditerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,71 +0,0 @@
|
||||
<page-header> </page-header>
|
||||
|
||||
<nz-card [nzBordered]="false">
|
||||
<form nz-form [nzLayout]="'inline'" (ngSubmit)="onSearch()" class="search__form">
|
||||
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
|
||||
<div nz-col nzMd="16" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="name">{{ 'mxk.roles.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<input nz-input [(ngModel)]="query.params.name" [ngModelOptions]="{ standalone: true }" name="name"
|
||||
placeholder="" id="name" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
|
||||
<div nz-col [nzSpan]="query.expandForm ? 24 : 8" [class.text-right]="query.expandForm">
|
||||
<button nz-button type="submit" [nzType]="'primary'" [nzLoading]="query.submitLoading">{{ 'mxk.text.query' |
|
||||
i18n }}</button>
|
||||
<button nz-button type="reset" (click)="onReset()" class="mx-sm" style="display: none">{{ 'mxk.text.reset' |
|
||||
i18n }}</button>
|
||||
<button nz-button (click)="query.expandForm = !query.expandForm" class="mx-sm" style="display: none">
|
||||
{{ query.expandForm ? ('mxk.text.collapse' | i18n) : ('mxk.text.expand' | i18n) }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</nz-card>
|
||||
<nz-card>
|
||||
<div nz-col [nzSpan]="24" class="table-list-toolbar">
|
||||
<button nz-button type="button" [nzType]="'primary'" (click)="onAdd($event)">{{ 'mxk.text.add' | i18n }}</button>
|
||||
<button nz-button type="button" (click)="onBatchDelete($event)" [nzType]="'primary'" nzDanger class="mx-sm">{{
|
||||
'mxk.text.delete' | i18n
|
||||
}}</button>
|
||||
</div>
|
||||
<nz-table #dynamicTable nzTableLayout="auto" nzSize="small" nzBordered nzShowSizeChanger [nzData]="query.results.rows"
|
||||
[nzFrontPagination]="false" [nzTotal]="query.results.records" [nzPageSizeOptions]="query.params.pageSizeOptions"
|
||||
[nzPageSize]="query.params.pageSize" [nzPageIndex]="query.params.pageNumber" [nzLoading]="this.query.tableLoading"
|
||||
(nzQueryParams)="onQueryParamsChange($event)" nzWidth="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th [nzChecked]="query.checked" [nzIndeterminate]="query.indeterminate"
|
||||
(nzCheckedChange)="onTableAllChecked($event)"></th>
|
||||
<th nzAlign="center" style="display: none">Id</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.dynamic' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.text.description' | i18n }}</th>
|
||||
<th nzAlign="center"><a>{{ 'mxk.text.action' | i18n }}</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of query.results.rows">
|
||||
<td [nzChecked]="query.tableCheckedId.has(data.id)" [nzDisabled]="data.disabled"
|
||||
(nzCheckedChange)="onTableItemChecked(data.id, $event)"></td>
|
||||
<td nzAlign="left" style="display: none">
|
||||
<span>{{ data.id }}</span>
|
||||
</td>
|
||||
<td nzAlign="left" nzBreakWord="false">{{ data.name }}</td>
|
||||
<td nzAlign="center"> <i *ngIf="data.dynamic == 1" nz-icon nzType="check-circle" nzTheme="fill"
|
||||
style="color: green"></i></td>
|
||||
<td nzAlign="left">{{ data.description }}</td>
|
||||
<td nzAlign="left" nzBreakWord="false">
|
||||
<div nz-col>
|
||||
<button nz-button type="button" (click)="onEdit($event, data.id)" style="float: left">{{ 'mxk.text.edit' |
|
||||
i18n }}</button>
|
||||
<button nz-button type="button" (click)="onDelete($event, data.id)" nzDanger>{{ 'mxk.text.delete' | i18n
|
||||
}}</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</nz-card>
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RolesComponent } from './roles.component';
|
||||
|
||||
describe('RolesComponent', () => {
|
||||
let component: RolesComponent;
|
||||
let fixture: ComponentFixture<RolesComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ RolesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RolesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,67 +0,0 @@
|
||||
<div *nzModalTitle> {{ 'mxk.text.select' | i18n }} </div>
|
||||
<nz-card [nzBordered]="false">
|
||||
<form nz-form [nzLayout]="'inline'" (ngSubmit)="onSearch()" class="search__form">
|
||||
<div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
|
||||
<div nz-col nzMd="14" nzSm="24">
|
||||
<nz-form-item>
|
||||
<nz-form-label nzFor="name">{{ 'mxk.roles.name' | i18n }}</nz-form-label>
|
||||
<nz-form-control>
|
||||
<input nz-input [(ngModel)]="query.params.name" [ngModelOptions]="{ standalone: true }" name="name" placeholder="" id="name" />
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</div>
|
||||
|
||||
<div nz-col [nzSpan]="query.expandForm ? 24 : 10" [class.text-right]="query.expandForm">
|
||||
<button nz-button type="submit" [nzType]="'primary'" [nzLoading]="query.submitLoading">{{ 'mxk.text.query' | i18n }}</button>
|
||||
<button nz-button type="reset" (click)="onReset()" class="mx-sm" style="display: none">{{ 'mxk.text.reset' | i18n }}</button>
|
||||
<button nz-button (click)="query.expandForm = !query.expandForm" class="mx-sm" style="display: none">
|
||||
{{ query.expandForm ? ('mxk.text.collapse' | i18n) : ('mxk.text.expand' | i18n) }}</button
|
||||
>
|
||||
<button nz-button nzType="primary" (click)="onSubmit($event)">{{ 'mxk.text.confirm' | i18n }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<nz-table
|
||||
#dynamicTable
|
||||
nzTableLayout="auto"
|
||||
nzBordered
|
||||
nzShowSizeChanger
|
||||
[nzData]="query.results.rows"
|
||||
[nzFrontPagination]="false"
|
||||
[nzTotal]="query.results.records"
|
||||
[nzPageSizeOptions]="query.params.pageSizeOptions"
|
||||
[nzPageSize]="query.params.pageSize"
|
||||
[nzPageIndex]="query.params.pageNumber"
|
||||
[nzLoading]="this.query.tableLoading"
|
||||
(nzQueryParams)="onQueryParamsChange($event)"
|
||||
nzWidth="100%"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th nzAlign="center" style="display: none">Id</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.name' | i18n }}</th>
|
||||
<th nzAlign="center">{{ 'mxk.roles.dynamic' | i18n }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let data of query.results.rows">
|
||||
<td
|
||||
[nzChecked]="query.tableCheckedId.has(data.id)"
|
||||
[nzDisabled]="data.disabled"
|
||||
(nzCheckedChange)="onTableItemChecked(data.id, $event)"
|
||||
></td>
|
||||
<td nzAlign="left" style="display: none">
|
||||
<span>{{ data.id }}</span>
|
||||
</td>
|
||||
<td nzAlign="center"> {{ data.name }}</td>
|
||||
<td nzAlign="center"> <i *ngIf="data.dynamic == 1" nz-icon nzType="check-circle" nzTheme="fill" style="color: green"></i></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
</nz-card>
|
||||
<div *nzModalFooter style="display: none">
|
||||
<button nz-button nzType="default" (click)="onClose($event)">{{ 'mxk.text.close' | i18n }}</button>
|
||||
<button nz-button nzType="primary" (click)="onSubmit($event)">{{ 'mxk.text.submit' | i18n }}</button>
|
||||
</div>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user