combine role group
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user