From ddf99aa011d5134c9183a0ac91a1256d87d8032a Mon Sep 17 00:00:00 2001 From: shimingxy Date: Wed, 29 Apr 2020 21:34:35 +0800 Subject: [PATCH] role manage --- .../main/java/org/maxkey/domain/Accounts.java | 247 ++++++------- .../main/java/org/maxkey/domain/Groups.java | 217 ++++++------ .../java/org/maxkey/domain/Resources.java | 164 +++++++++ .../org/maxkey/domain/RolePermissions.java | 95 +++++ .../main/java/org/maxkey/domain/Roles.java | 105 ++++++ .../org/maxkey/domain/Saml20Metadata.java | 200 ++++++----- .../org/maxkey/web/component/TreeNode.java | 133 ++++--- .../dao/persistence/ResourcesMapper.java | 16 + .../maxkey/dao/persistence/RolesMapper.java | 24 ++ .../maxkey/dao/service/ResourcesService.java | 23 ++ .../org/maxkey/dao/service/RolesService.java | 37 ++ .../persistence/xml/mysql/ResourcesMapper.xml | 54 +++ .../dao/persistence/xml/mysql/RolesMapper.xml | 84 +++++ .../web/contorller/PermissionsController.java | 104 ++++++ .../web/contorller/ResourcesController.java | 163 +++++++++ .../web/contorller/RolesController.java | 130 +++++++ .../resources/messages/message.properties | 12 +- .../resources/messages/message_en.properties | 14 +- .../views/groupapp/groupAppsList.ftl | 18 +- .../templates/views/layout/common.cssjs.ftl | 8 + .../templates/views/layout/sidenav.ftl | 61 ++-- .../views/permissions/permissionsList.ftl | 331 ++++++++++++++++++ .../templates/views/resources/resourceAdd.ftl | 85 +++++ .../views/resources/resourceUpdate.ftl | 83 +++++ .../views/resources/resourcesList.ftl | 268 ++++++++++++++ .../views/resources/selectResourcesList.ftl | 79 +++++ .../templates/views/roles/roleAdd.ftl | 42 +++ .../templates/views/roles/roleUpdate.ftl | 47 +++ .../templates/views/roles/rolesList.ftl | 124 +++++++ .../templates/views/roles/selectRolesList.ftl | 79 +++++ .../src/main/webapp/WEB-INF/web.xml | 14 +- 31 files changed, 2602 insertions(+), 459 deletions(-) create mode 100644 maxkey-core/src/main/java/org/maxkey/domain/Resources.java create mode 100644 maxkey-core/src/main/java/org/maxkey/domain/RolePermissions.java create mode 100644 maxkey-core/src/main/java/org/maxkey/domain/Roles.java create mode 100644 maxkey-dao/src/main/java/org/maxkey/dao/persistence/ResourcesMapper.java create mode 100644 maxkey-dao/src/main/java/org/maxkey/dao/persistence/RolesMapper.java create mode 100644 maxkey-dao/src/main/java/org/maxkey/dao/service/ResourcesService.java create mode 100644 maxkey-dao/src/main/java/org/maxkey/dao/service/RolesService.java create mode 100644 maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ResourcesMapper.xml create mode 100644 maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RolesMapper.xml create mode 100644 maxkey-web-manage/src/main/java/org/maxkey/web/contorller/PermissionsController.java create mode 100644 maxkey-web-manage/src/main/java/org/maxkey/web/contorller/ResourcesController.java create mode 100644 maxkey-web-manage/src/main/java/org/maxkey/web/contorller/RolesController.java create mode 100644 maxkey-web-manage/src/main/resources/templates/views/permissions/permissionsList.ftl create mode 100644 maxkey-web-manage/src/main/resources/templates/views/resources/resourceAdd.ftl create mode 100644 maxkey-web-manage/src/main/resources/templates/views/resources/resourceUpdate.ftl create mode 100644 maxkey-web-manage/src/main/resources/templates/views/resources/resourcesList.ftl create mode 100644 maxkey-web-manage/src/main/resources/templates/views/resources/selectResourcesList.ftl create mode 100644 maxkey-web-manage/src/main/resources/templates/views/roles/roleAdd.ftl create mode 100644 maxkey-web-manage/src/main/resources/templates/views/roles/roleUpdate.ftl create mode 100644 maxkey-web-manage/src/main/resources/templates/views/roles/rolesList.ftl create mode 100644 maxkey-web-manage/src/main/resources/templates/views/roles/selectRolesList.ftl diff --git a/maxkey-core/src/main/java/org/maxkey/domain/Accounts.java b/maxkey-core/src/main/java/org/maxkey/domain/Accounts.java index 41c36d5ac..812e9f000 100644 --- a/maxkey-core/src/main/java/org/maxkey/domain/Accounts.java +++ b/maxkey-core/src/main/java/org/maxkey/domain/Accounts.java @@ -1,17 +1,14 @@ package org.maxkey.domain; import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; - import org.apache.mybatis.jpa.persistence.JpaBaseDomain; import org.hibernate.validator.constraints.Length; - /* ID varchar(40) not null, UID varchar(40) null, @@ -22,150 +19,120 @@ import org.hibernate.validator.constraints.Length; constraint PK_ROLES primary key clustered (ID) */ -@Table(name = "ACCOUNTS") -public class Accounts extends JpaBaseDomain implements Serializable{ +@Table(name = "ACCOUNTS") +public class Accounts extends JpaBaseDomain implements Serializable { + private static final long serialVersionUID = 6829592256223630307L; + @Id + @Column + @GeneratedValue(strategy = GenerationType.AUTO, generator = "uuid") + private String id; + @Column + private String uid; + @Column + private String username; + @Column + private String displayName; + @Column + private String appId; + @Column + private String appName; - /** - * - */ - private static final long serialVersionUID = 6829592256223630307L; - @Id - @Column - @GeneratedValue(strategy=GenerationType.AUTO,generator="uuid") - private String id; - @Column - private String uid; - @Column - private String username; - @Column - private String displayName; - @Column - private String appId; - @Column - private String appName; - - @Length(max=60) - @Column - private String relatedUsername; - @Column - private String relatedPassword; - - public Accounts(){ - super(); - } + @Length(max = 60) + @Column + private String relatedUsername; + @Column + private String relatedPassword; - - public Accounts(String id) { - this.id = id; - } - - public Accounts(String uid,String appId){ - this.uid = uid; - this.appId = appId; - } + public Accounts() { + super(); + } - - public Accounts(String uid,String appId,String password) { - this.uid = uid; - this.appId = appId; - this.relatedPassword=password; - } - + public Accounts(String id) { + this.id = id; + } + + public Accounts(String uid, String appId) { + this.uid = uid; + this.appId = appId; + } + + public Accounts(String uid, String appId, String password) { + this.uid = uid; + this.appId = appId; + this.relatedPassword = password; + } + + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public String getRelatedUsername() { + return relatedUsername; + } + + public void setRelatedUsername(String relatedUsername) { + this.relatedUsername = relatedUsername; + } + + public String getRelatedPassword() { + return relatedPassword; + } + + public void setRelatedPassword(String relatedPassword) { + this.relatedPassword = relatedPassword; + } - public String getUid() { - return uid; - } + public String getId() { + return id; + } - public void setUid(String uid) { - this.uid = uid; - } + public void setId(String id) { + this.id = id; + } - - public String getUsername() { - return username; - } - - - public void setUsername(String username) { - this.username = username; - } - - - public String getDisplayName() { - return displayName; - } - - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - - public String getAppId() { - return appId; - } - - - public void setAppId(String appId) { - this.appId = appId; - } - - - public String getAppName() { - return appName; - } - - - public void setAppName(String appName) { - this.appName = appName; - } - - - public String getRelatedUsername() { - return relatedUsername; - } - - - public void setRelatedUsername(String relatedUsername) { - this.relatedUsername = relatedUsername; - } - - - public String getRelatedPassword() { - return relatedPassword; - } - - - public void setRelatedPassword(String relatedPassword) { - this.relatedPassword = relatedPassword; - } - - - /** - * @return the id - */ - public String getId() { - return id; - } - - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - - @Override - public String toString() { - return "AppAccounts [uid=" + uid + ", username=" + username - + ", displayName=" + displayName + ", appId=" + appId - + ", appName=" + appName + ", relatedUsername=" - + relatedUsername + ", relatedPassword=" + relatedPassword - + "]"; - } + @Override + public String toString() { + return "AppAccounts [uid=" + uid + ", username=" + username + ", displayName=" + displayName + ", appId=" + + appId + ", appName=" + appName + ", relatedUsername=" + relatedUsername + ", relatedPassword=" + + relatedPassword + "]"; + } } diff --git a/maxkey-core/src/main/java/org/maxkey/domain/Groups.java b/maxkey-core/src/main/java/org/maxkey/domain/Groups.java index bb8591228..4a52121e6 100644 --- a/maxkey-core/src/main/java/org/maxkey/domain/Groups.java +++ b/maxkey-core/src/main/java/org/maxkey/domain/Groups.java @@ -1,140 +1,141 @@ package org.maxkey.domain; import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; - import org.apache.mybatis.jpa.persistence.JpaBaseDomain; import org.hibernate.validator.constraints.Length; +@Table(name = "GROUPS") +public class Groups extends JpaBaseDomain implements Serializable { -@Table(name = "GROUPS") -public class Groups extends JpaBaseDomain implements Serializable{ - /** - * - */ - private static final long serialVersionUID = 4660258495864814777L; - @Id - @Column - @GeneratedValue(strategy=GenerationType.AUTO,generator="uuid") - String id; - - @Length(max=60) - @Column - private String name; - @Column - private int isdefault; - @Column - String description; - @Column - String createdBy; - @Column - String createdDate; - @Column - String modifiedBy; - @Column - String modifiedDate; - @Column - String status; - - public Groups() {} - - public Groups(String id) { - this.id = id; - } + private static final long serialVersionUID = 4660258495864814777L; + @Id + @Column + @GeneratedValue(strategy = GenerationType.AUTO, generator = "uuid") + String id; - public Groups(String id, String name, int isdefault) { - super(); - this.id = id; - this.name = name; - this.isdefault = isdefault; - } + @Length(max = 60) + @Column + private String name; + @Column + private int isdefault; + @Column + String description; + @Column + String createdBy; + @Column + String createdDate; + @Column + String modifiedBy; + @Column + String modifiedDate; + @Column + String status; - public String getName(){ - return name; - } - - public void setName(String name) { - this.name = name; - } - + public Groups() { + } - public String getId() { - return id; - } + public Groups(String id) { + this.id = id; + } - public void setId(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 int getIsdefault(){ - return isdefault; - } - - public void setIsdefault(int isdefault) { - this.isdefault = isdefault; - } + public String getName() { + return name; + } - public String getDescription() { - return description; - } + public void setName(String name) { + this.name = name; + } - public void setDescription(String description) { - this.description = description; - } + public String getId() { + return id; + } - public String getCreatedBy() { - return createdBy; - } + public void setId(String id) { + this.id = id; + } - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } + public int getIsdefault() { + return isdefault; + } - public String getCreatedDate() { - return createdDate; - } + public void setIsdefault(int isdefault) { + this.isdefault = isdefault; + } - public void setCreatedDate(String createdDate) { - this.createdDate = createdDate; - } + public String getDescription() { + return description; + } - public String getModifiedBy() { - return modifiedBy; - } + public void setDescription(String description) { + this.description = description; + } - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } + public String getCreatedBy() { + return createdBy; + } - public String getModifiedDate() { - return modifiedDate; - } + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } - public void setModifiedDate(String modifiedDate) { - this.modifiedDate = modifiedDate; - } + public String getCreatedDate() { + return createdDate; + } - public String getStatus() { - return status; - } + public void setCreatedDate(String createdDate) { + this.createdDate = createdDate; + } - public void setStatus(String status) { - this.status = status; - } + public String getModifiedBy() { + return modifiedBy; + } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Groups [name=" + name + ", isdefault=" + isdefault + "]"; - } - + public void setModifiedBy(String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + public String getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(String modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Groups [name=" + name + ", isdefault=" + isdefault + "]"; + } - } diff --git a/maxkey-core/src/main/java/org/maxkey/domain/Resources.java b/maxkey-core/src/main/java/org/maxkey/domain/Resources.java new file mode 100644 index 000000000..8eaa931bc --- /dev/null +++ b/maxkey-core/src/main/java/org/maxkey/domain/Resources.java @@ -0,0 +1,164 @@ +package org.maxkey.domain; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import org.apache.mybatis.jpa.persistence.JpaBaseDomain; + +@Table(name = "RESOURCES") +public class Resources extends JpaBaseDomain implements Serializable { + private static final long serialVersionUID = 2567171742999638608L; + @Id + @Column + @GeneratedValue(strategy = GenerationType.AUTO,generator = "uuid") + String id; + @Column + String name; + @Column + String appId; + @Column + String pid; + @Column + String pname; + @Column + String resType; + @Column + String resUrl; + @Column + String resAction; + @Column + String status; + @Column + String description; + @Column + String createdBy; + @Column + String createdDate; + @Column + String modifiedBy; + @Column + String modifiedDate; + + public Resources() { + super(); + // TODO Auto-generated constructor stub + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + 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 String getResType() { + return resType; + } + + public void setResType(String resType) { + this.resType = resType; + } + + public String getResUrl() { + return resUrl; + } + + public void setResUrl(String resUrl) { + this.resUrl = resUrl; + } + + public String getResAction() { + return resAction; + } + + public void setResAction(String resAction) { + this.resAction = resAction; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getPname() { + return pname; + } + + public void setPname(String pname) { + this.pname = pname; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + + +} diff --git a/maxkey-core/src/main/java/org/maxkey/domain/RolePermissions.java b/maxkey-core/src/main/java/org/maxkey/domain/RolePermissions.java new file mode 100644 index 000000000..5f681b4d8 --- /dev/null +++ b/maxkey-core/src/main/java/org/maxkey/domain/RolePermissions.java @@ -0,0 +1,95 @@ +package org.maxkey.domain; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import org.apache.mybatis.jpa.persistence.JpaBaseDomain; +import org.maxkey.constants.ConstantsStatus; + +@Table(name = "ROLE_PERMISSIONS") +public class RolePermissions extends JpaBaseDomain implements Serializable { + private static final long serialVersionUID = -8783585691243853899L; + + @Id + @Column + @GeneratedValue(strategy = GenerationType.AUTO, generator = "uuid") + String id; + @Column + String appId; + @Column + String roleId; + @Column + String resourceId; + + int status = ConstantsStatus.ACTIVE; + + public RolePermissions() { + } + + public RolePermissions(String appId, String roleId) { + this.appId = appId; + this.roleId = roleId; + } + + /** + * . + * @param appId String + * @param roleId String + * @param resourceId String + */ + public RolePermissions(String appId, String roleId, String resourceId) { + this.id = this.generateId(); + this.appId = appId; + this.roleId = roleId; + this.resourceId = resourceId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getUniqueId() { + return appId + "_" + roleId + "_" + resourceId; + } + + +} diff --git a/maxkey-core/src/main/java/org/maxkey/domain/Roles.java b/maxkey-core/src/main/java/org/maxkey/domain/Roles.java new file mode 100644 index 000000000..d7fb332d5 --- /dev/null +++ b/maxkey-core/src/main/java/org/maxkey/domain/Roles.java @@ -0,0 +1,105 @@ +package org.maxkey.domain; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import org.apache.mybatis.jpa.persistence.JpaBaseDomain; + +@Table(name = "ROLES") +public class Roles extends JpaBaseDomain implements Serializable { + private static final long serialVersionUID = -7515832728504943821L; + + @Id + @Column + @GeneratedValue(strategy = GenerationType.AUTO,generator = "uuid") + private String id; + @Column + private String name; + @Column + String status; + @Column + String description; + @Column + String createdBy; + @Column + String createdDate; + @Column + String modifiedBy; + @Column + String modifiedDate; + + public Roles() { + super(); + // TODO Auto-generated constructor stub + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + 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; + } + + + +} diff --git a/maxkey-core/src/main/java/org/maxkey/domain/Saml20Metadata.java b/maxkey-core/src/main/java/org/maxkey/domain/Saml20Metadata.java index 4c7045285..408589847 100644 --- a/maxkey-core/src/main/java/org/maxkey/domain/Saml20Metadata.java +++ b/maxkey-core/src/main/java/org/maxkey/domain/Saml20Metadata.java @@ -1,109 +1,117 @@ package org.maxkey.domain; import java.io.Serializable; - import org.apache.mybatis.jpa.persistence.JpaBaseDomain; - - /** + * Saml20Metadata. * @author Crystal.Sea * */ -public class Saml20Metadata extends JpaBaseDomain implements Serializable{ +public class Saml20Metadata extends JpaBaseDomain implements Serializable { + private static final long serialVersionUID = -403743150268165622L; + + public static final class ContactPersonType { + public static final String TECHNICAL = "technical"; + public static final String SUPPORT = "support"; + public static final String ADMINISTRATIVE = "administrative"; + public static final String BILLING = "billing"; + public static final String OTHER = "other"; + } - public final static class ContactPersonType{ - public final static String TECHNICAL="technical"; - public final static String SUPPORT="support"; - public final static String ADMINISTRATIVE="administrative"; - public final static String BILLING="billing"; - public final static String OTHER="other"; - } - - /** - * - */ - private static final long serialVersionUID = -403743150268165622L; + private String orgName; + private String orgDisplayName; + private String orgURL; + private String contactType; + private String company; + private String givenName; + private String surName; + private String emailAddress; + private String telephoneNumber; - - private String orgName; - private String orgDisplayName; - private String orgURL; - private String contactType; - private String company; - private String givenName; - private String surName; - private String emailAddress; - private String telephoneNumber; - /** - * - */ - public Saml20Metadata() { - super(); - } - public String getOrgName() { - return orgName; - } - public void setOrgName(String orgName) { - this.orgName = orgName; - } - public String getOrgDisplayName() { - return orgDisplayName; - } - public void setOrgDisplayName(String orgDisplayName) { - this.orgDisplayName = orgDisplayName; - } - public String getOrgURL() { - return orgURL; - } - public void setOrgURL(String orgURL) { - this.orgURL = orgURL; - } - public String getContactType() { - return contactType; - } - public void setContactType(String contactType) { - this.contactType = contactType; - } - public String getCompany() { - return company; - } - public void setCompany(String company) { - this.company = company; - } - public String getGivenName() { - return givenName; - } - public void setGivenName(String givenName) { - this.givenName = givenName; - } - public String getSurName() { - return surName; - } - public void setSurName(String surName) { - this.surName = surName; - } - public String getEmailAddress() { - return emailAddress; - } - public void setEmailAddress(String emailAddress) { - this.emailAddress = emailAddress; - } - public String getTelephoneNumber() { - return telephoneNumber; - } - public void setTelephoneNumber(String telephoneNumber) { - this.telephoneNumber = telephoneNumber; - } - @Override - public String toString() { - return "Saml20Metadata [orgName=" + orgName + ", orgDisplayName=" - + orgDisplayName + ", orgURL=" + orgURL + ", contactType=" - + contactType + ", company=" + company + ", givenName=" - + givenName + ", surName=" + surName + ", emailAddress=" - + emailAddress + ", telephoneNumber=" + telephoneNumber + "]"; - } - - + public Saml20Metadata() { + super(); + + } + + public String getOrgName() { + return orgName; + } + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + public String getOrgDisplayName() { + return orgDisplayName; + } + + public void setOrgDisplayName(String orgDisplayName) { + this.orgDisplayName = orgDisplayName; + } + + public String getOrgURL() { + return orgURL; + } + + public void setOrgURL(String orgURL) { + this.orgURL = orgURL; + } + + public String getContactType() { + return contactType; + } + + public void setContactType(String contactType) { + this.contactType = contactType; + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + + public String getGivenName() { + return givenName; + } + + public void setGivenName(String givenName) { + this.givenName = givenName; + } + + public String getSurName() { + return surName; + } + + public void setSurName(String surName) { + this.surName = surName; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getTelephoneNumber() { + return telephoneNumber; + } + + public void setTelephoneNumber(String telephoneNumber) { + this.telephoneNumber = telephoneNumber; + } + + @Override + public String toString() { + return "Saml20Metadata [orgName=" + orgName + ", orgDisplayName=" + orgDisplayName + ", orgURL=" + orgURL + + ", contactType=" + contactType + ", company=" + company + ", givenName=" + givenName + ", surName=" + + surName + ", emailAddress=" + emailAddress + ", telephoneNumber=" + telephoneNumber + "]"; + } + } diff --git a/maxkey-core/src/main/java/org/maxkey/web/component/TreeNode.java b/maxkey-core/src/main/java/org/maxkey/web/component/TreeNode.java index c8e1a04c1..d684fa078 100644 --- a/maxkey-core/src/main/java/org/maxkey/web/component/TreeNode.java +++ b/maxkey-core/src/main/java/org/maxkey/web/component/TreeNode.java @@ -3,78 +3,77 @@ package org.maxkey.web.component; import java.util.HashMap; /** - * 数控件的节点 - * 使用HashMap attr存储节点数据 + * 数控件的节点 使用HashMap attr存储节点数据. + * * @author Crystal.Sea * */ public class TreeNode { - //TreeNode - HashMap attr=new HashMap(); + // TreeNode + HashMap attr = new HashMap(); - public TreeNode() { - super(); - } - - public TreeNode(String id,String name) { - attr.put("id", id); - attr.put("name", name); - } - - public TreeNode(String id,String name,boolean hasChild) { - attr.put("id", id); - attr.put("name", name); - attr.put("isParent", hasChild); - } - - public TreeNode(String id,String name, String pId) { - attr.put("id", id); - attr.put("name", name); - attr.put("pId", pId); - } - - public TreeNode(String id,String name, String pId, String url) { - attr.put("id", id); - attr.put("name", name); - attr.put("pId", pId); - attr.put("url", url); - } - - public TreeNode(String id,String name, String pId, String url, String target) { - attr.put("id", id); - attr.put("name", name); - attr.put("pId", pId); - attr.put("url", url); - attr.put("target", target); - } - - public void setChecked() { - attr.put("checked", true); - } - - public void setHasChild() { - attr.put("isParent", true); - } - - public void setPId(String pId) { - attr.put("pId", pId); - } - - public void setIcon(String icon) { - attr.put("icon", icon); - } - - public HashMap getAttr() { - return attr; - } + public TreeNode() { + super(); + } - public void setAttr(String attrName, Object value) { - this.attr .put(attrName, value); - } - - public void setAttr(HashMap attr) { - this.attr = attr; - } - + public TreeNode(String id, String name) { + attr.put("id", id); + attr.put("name", name); + } + + public TreeNode(String id, String name, boolean hasChild) { + attr.put("id", id); + attr.put("name", name); + attr.put("isParent", hasChild); + } + + public TreeNode(String id, String name, String pId) { + attr.put("id", id); + attr.put("name", name); + attr.put("pId", pId); + } + + public TreeNode(String id, String name, String pId, String url) { + attr.put("id", id); + attr.put("name", name); + attr.put("pId", pId); + attr.put("url", url); + } + + public TreeNode(String id, String name, String pId, String url, String target) { + attr.put("id", id); + attr.put("name", name); + attr.put("pId", pId); + attr.put("url", url); + attr.put("target", target); + } + + public void setChecked() { + attr.put("checked", true); + } + + public void setHasChild() { + attr.put("isParent", true); + } + + public void setPId(String pId) { + attr.put("pId", pId); + } + + public void setIcon(String icon) { + attr.put("icon", icon); + } + + public HashMap getAttr() { + return attr; + } + + public void setAttr(String attrName, Object value) { + this.attr.put(attrName, value); + } + + public void setAttr(HashMap attr) { + this.attr = attr; + } } diff --git a/maxkey-dao/src/main/java/org/maxkey/dao/persistence/ResourcesMapper.java b/maxkey-dao/src/main/java/org/maxkey/dao/persistence/ResourcesMapper.java new file mode 100644 index 000000000..237a34903 --- /dev/null +++ b/maxkey-dao/src/main/java/org/maxkey/dao/persistence/ResourcesMapper.java @@ -0,0 +1,16 @@ +/** + * + */ +package org.maxkey.dao.persistence; + +import org.apache.mybatis.jpa.persistence.IJpaBaseMapper; +import org.maxkey.domain.Resources; + +/** + * @author Crystal.sea + * + */ + +public interface ResourcesMapper extends IJpaBaseMapper { + +} diff --git a/maxkey-dao/src/main/java/org/maxkey/dao/persistence/RolesMapper.java b/maxkey-dao/src/main/java/org/maxkey/dao/persistence/RolesMapper.java new file mode 100644 index 000000000..6c8f5fada --- /dev/null +++ b/maxkey-dao/src/main/java/org/maxkey/dao/persistence/RolesMapper.java @@ -0,0 +1,24 @@ +/** + * + */ +package org.maxkey.dao.persistence; + +import java.util.List; + +import org.apache.mybatis.jpa.persistence.IJpaBaseMapper; +import org.maxkey.domain.RolePermissions; +import org.maxkey.domain.Roles; + +/** + * @author Crystal.sea + * + */ + +public interface RolesMapper extends IJpaBaseMapper { + + public int insertRolePermissions(List rolePermissionsList); + + public int logisticDeleteRolePermissions(List rolePermissionsList); + + public List queryRolePermissions(RolePermissions rolePermissions); +} diff --git a/maxkey-dao/src/main/java/org/maxkey/dao/service/ResourcesService.java b/maxkey-dao/src/main/java/org/maxkey/dao/service/ResourcesService.java new file mode 100644 index 000000000..49ee3c909 --- /dev/null +++ b/maxkey-dao/src/main/java/org/maxkey/dao/service/ResourcesService.java @@ -0,0 +1,23 @@ +package org.maxkey.dao.service; + +import org.apache.mybatis.jpa.persistence.JpaBaseService; +import org.maxkey.dao.persistence.ResourcesMapper; +import org.maxkey.domain.Resources; +import org.springframework.stereotype.Service; + +@Service +public class ResourcesService extends JpaBaseService{ + + public ResourcesService() { + super(ResourcesMapper.class); + } + + /* (non-Javadoc) + * @see com.connsec.db.service.BaseService#getMapper() + */ + @Override + public ResourcesMapper getMapper() { + // TODO Auto-generated method stub + return (ResourcesMapper)super.getMapper(); + } +} diff --git a/maxkey-dao/src/main/java/org/maxkey/dao/service/RolesService.java b/maxkey-dao/src/main/java/org/maxkey/dao/service/RolesService.java new file mode 100644 index 000000000..8a62d49f9 --- /dev/null +++ b/maxkey-dao/src/main/java/org/maxkey/dao/service/RolesService.java @@ -0,0 +1,37 @@ +package org.maxkey.dao.service; + +import java.util.List; + +import org.apache.mybatis.jpa.persistence.JpaBaseService; +import org.maxkey.dao.persistence.RolesMapper; +import org.maxkey.domain.RolePermissions; +import org.maxkey.domain.Roles; +import org.springframework.stereotype.Service; + +@Service +public class RolesService extends JpaBaseService{ + + public RolesService() { + super(RolesMapper.class); + } + + /* (non-Javadoc) + * @see com.connsec.db.service.BaseService#getMapper() + */ + @Override + public RolesMapper getMapper() { + return (RolesMapper)super.getMapper(); + } + + public boolean insertRolePermissions(List rolePermissionsList) { + return getMapper().insertRolePermissions(rolePermissionsList)>0; + }; + + public boolean logisticDeleteRolePermissions(List rolePermissionsList) { + return getMapper().logisticDeleteRolePermissions(rolePermissionsList)>=0; + } + + public List queryRolePermissions(RolePermissions rolePermissions){ + return getMapper().queryRolePermissions(rolePermissions); + } +} diff --git a/maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ResourcesMapper.xml b/maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ResourcesMapper.xml new file mode 100644 index 000000000..58414a6f3 --- /dev/null +++ b/maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ResourcesMapper.xml @@ -0,0 +1,54 @@ + + + + + + + AND ID = #{id} + + + AND APPID = #{appId} + + + AND PID = #{pid} + + + AND NAME LIKE '%${name}%' + + + + + + + + + + UPDATE RESOURCES SET + STATUS = '2' + WHERE 1 = 1 + + AND ID = #{id} + + + ADN NAME = #{name} + + + + + + UPDATE RESOURCES SET STATUS='2' WHERE ID IN + + #{item} + + + + + \ No newline at end of file diff --git a/maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RolesMapper.xml b/maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RolesMapper.xml new file mode 100644 index 000000000..ed16d9390 --- /dev/null +++ b/maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RolesMapper.xml @@ -0,0 +1,84 @@ + + + + + + + AND ID = #{id} + + + AND NAME LIKE '%${name}%' + + + + + + + + + + UPDATE ROLES SET + STATUS = '2' + WHERE 1 = 1 + + AND ID = #{id} + + + ADN NAME = #{name} + + + + + + UPDATE ROLES SET STATUS='2' WHERE ID IN + + #{item} + + + + + + + + UPDATE ROLE_PERMISSIONS SET STATUS=9 WHERE ID IN + + #{item.id} + + + + + INSERT INTO ROLE_PERMISSIONS ( ID,APPID,ROLEID,RESOURCEID,STATUS) + VALUES + + (#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status}) + + + + + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/PermissionsController.java b/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/PermissionsController.java new file mode 100644 index 000000000..821a7d1cd --- /dev/null +++ b/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/PermissionsController.java @@ -0,0 +1,104 @@ +package org.maxkey.web.contorller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.maxkey.constants.ConstantsOperateMessage; +import org.maxkey.dao.service.RolesService; +import org.maxkey.domain.RolePermissions; +import org.maxkey.util.StringUtils; +import org.maxkey.web.WebContext; +import org.maxkey.web.message.Message; +import org.maxkey.web.message.MessageType; +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.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + + +@Controller +@RequestMapping(value={"/permissions"}) +public class PermissionsController { + final static Logger _logger = LoggerFactory.getLogger(PermissionsController.class); + + @Autowired + @Qualifier("rolesService") + RolesService rolesService; + + + + @RequestMapping(value={"/list"}) + public ModelAndView resourcesList(){ + return new ModelAndView("permissions/permissionsList"); + } + + + @ResponseBody + @RequestMapping(value={"/savepermissions"}) + public Message insert(@ModelAttribute("rolePermissions") RolePermissions rolePermissions) { + _logger.debug("-save :" + rolePermissions); + //have + List rolePermissionsedList = rolesService.queryRolePermissions( + new RolePermissions(rolePermissions.getAppId(),rolePermissions.getRoleId())); + + HashMappermedMap =new HashMap(); + for(RolePermissions rolePerms : rolePermissionsedList) { + permedMap.put(rolePerms.getUniqueId(),rolePerms.getId()); + } + //Maybe insert + ArrayList rolePermissionsList =new ArrayList(); + ListresourceIds = StringUtils.string2List(rolePermissions.getResourceId(), ","); + HashMapnewPermsMap =new HashMap(); + for(String resourceId : resourceIds) { + + RolePermissions newRolePermissions=new RolePermissions( + rolePermissions.getAppId(), + rolePermissions.getRoleId(), + resourceId); + + newPermsMap.put(newRolePermissions.getUniqueId(), rolePermissions.getAppId()); + + if(!rolePermissions.getAppId().equalsIgnoreCase(resourceId) && + !permedMap.containsKey(newRolePermissions.getUniqueId())) { + rolePermissionsList.add(newRolePermissions); + } + } + + //delete + ArrayList deleteRolePermissionsList =new ArrayList(); + for(RolePermissions rolePerms : rolePermissionsedList) { + if(!newPermsMap.containsKey(rolePerms.getUniqueId())) { + deleteRolePermissionsList.add(rolePerms); + } + } + if (!deleteRolePermissionsList.isEmpty()) { + rolesService.logisticDeleteRolePermissions(deleteRolePermissionsList); + } + + if (!rolePermissionsList.isEmpty() && rolesService.insertRolePermissions(rolePermissionsList)) { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.success); + + } else { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.error); + } + + } + + @ResponseBody + @RequestMapping(value={"/querypermissions"}) + public List querypermissions(@ModelAttribute("rolePermissions") RolePermissions rolePermissions) { + _logger.debug("-querypermissions :" + rolePermissions); + //have + List rolePermissionsedList = rolesService.queryRolePermissions( + new RolePermissions(rolePermissions.getAppId(),rolePermissions.getRoleId())); + return rolePermissionsedList; + } + + +} diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/ResourcesController.java b/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/ResourcesController.java new file mode 100644 index 000000000..4ad6ddf3f --- /dev/null +++ b/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/ResourcesController.java @@ -0,0 +1,163 @@ +package org.maxkey.web.contorller; + +import java.util.HashMap; +import java.util.List; + +import org.apache.mybatis.jpa.persistence.JpaPageResults; +import org.maxkey.constants.ConstantsOperateMessage; +import org.maxkey.dao.service.ResourcesService; +import org.maxkey.domain.Resources; +import org.maxkey.web.WebContext; +import org.maxkey.web.component.TreeNode; +import org.maxkey.web.component.TreeNodeList; +import org.maxkey.web.message.Message; +import org.maxkey.web.message.MessageType; +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.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + + +@Controller +@RequestMapping(value={"/resources"}) +public class ResourcesController { + final static Logger _logger = LoggerFactory.getLogger(ResourcesController.class); + + @Autowired + @Qualifier("resourcesService") + ResourcesService resourcesService; + + + + @RequestMapping(value={"/list"}) + public ModelAndView resourcesList(){ + return new ModelAndView("resources/resourcesList"); + } + + @RequestMapping(value={"/selectResourcesList"}) + public ModelAndView selectResourcesList(){ + return new ModelAndView("resources/selectResourcesList"); + } + + + @RequestMapping(value = { "/grid" }) + @ResponseBody + public JpaPageResults queryDataGrid(@ModelAttribute("resources") Resources resources) { + _logger.debug(""+resources); + return resourcesService.queryPageResults(resources); + } + + + @RequestMapping(value = { "/forwardAdd" }) + public ModelAndView forwardAdd() { + return new ModelAndView("resources/resourceAdd"); + } + + @RequestMapping(value = { "/forwardUpdate/{id}" }) + public ModelAndView forwardUpdate(@PathVariable("id") String id) { + ModelAndView modelAndView=new ModelAndView("resources/resourceUpdate"); + Resources resource=resourcesService.get(id); + modelAndView.addObject("model",resource); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value={"/add"}) + public Message insert(@ModelAttribute("resource") Resources resource) { + _logger.debug("-Add :" + resource); + + if (resourcesService.insert(resource)) { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.success); + + } else { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.error); + } + + } + + /** + * 查询 + * @param resource + * @return + */ + @ResponseBody + @RequestMapping(value={"/query"}) + public Message query(@ModelAttribute("resource") Resources resource) { + _logger.debug("-query :" + resource); + if (resourcesService.load(resource)!=null) { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.success); + + } else { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_ERROR),MessageType.error); + } + + } + + /** + * 修改 + * @param resource + * @return + */ + @ResponseBody + @RequestMapping(value={"/update"}) + public Message update(@ModelAttribute("resource") Resources resource) { + _logger.debug("-update resource :" + resource); + + if (resourcesService.update(resource)) { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.UPDATE_SUCCESS),MessageType.success); + + } else { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.UPDATE_ERROR),MessageType.error); + } + + } + + + @ResponseBody + @RequestMapping(value={"/delete"}) + public Message delete(@ModelAttribute("resource") Resources resource) { + _logger.debug("-delete resource :" + resource); + + if (resourcesService.remove(resource.getId())) { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success); + + } else { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.error); + } + + } + + @ResponseBody + @RequestMapping({"/tree"}) + public List> resourcesTree( + @RequestParam(value = "appId", required = false) String appId, + @RequestParam(value = "appName", required = false) String appName + ) { + _logger.debug("resourcesTree appId :" + appId + " ,appName " + appName); + Resources queryRes = new Resources(); + queryRes.setAppId(appId); + List resourcesList = this.resourcesService.query(queryRes); + TreeNodeList treeNodeList = new TreeNodeList(); + + TreeNode rootNode = new TreeNode(appId, appName); + rootNode.setAttr("open", Boolean.valueOf(true)); + treeNodeList.addTreeNode(rootNode.getAttr()); + + for (Resources res : resourcesList) { + TreeNode treeNode = new TreeNode(res.getId(), res.getName()); + treeNode.setAttr("data", res); + treeNode.setPId(res.getPid()); + treeNodeList.addTreeNode(treeNode.getAttr()); + } + + + return treeNodeList.getTreeNodeList(); + } +} diff --git a/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/RolesController.java b/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/RolesController.java new file mode 100644 index 000000000..a882b9776 --- /dev/null +++ b/maxkey-web-manage/src/main/java/org/maxkey/web/contorller/RolesController.java @@ -0,0 +1,130 @@ +package org.maxkey.web.contorller; + +import org.apache.mybatis.jpa.persistence.JpaPageResults; +import org.maxkey.constants.ConstantsOperateMessage; +import org.maxkey.dao.service.RolesService; +import org.maxkey.domain.Roles; +import org.maxkey.web.WebContext; +import org.maxkey.web.message.Message; +import org.maxkey.web.message.MessageType; +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.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; + + +@Controller +@RequestMapping(value={"/roles"}) +public class RolesController { + final static Logger _logger = LoggerFactory.getLogger(RolesController.class); + + @Autowired + @Qualifier("rolesService") + RolesService rolesService; + + + + @RequestMapping(value={"/list"}) + public ModelAndView rolesList(){ + return new ModelAndView("roles/rolesList"); + } + + @RequestMapping(value={"/selectRolesList"}) + public ModelAndView selectRolesList(){ + return new ModelAndView("roles/selectRolesList"); + } + + + @RequestMapping(value = { "/grid" }) + @ResponseBody + public JpaPageResults queryDataGrid(@ModelAttribute("roles") Roles roles) { + _logger.debug(""+roles); + return rolesService.queryPageResults(roles); + } + + + @RequestMapping(value = { "/forwardAdd" }) + public ModelAndView forwardAdd() { + return new ModelAndView("roles/roleAdd"); + } + + @RequestMapping(value = { "/forwardUpdate/{id}" }) + public ModelAndView forwardUpdate(@PathVariable("id") String id) { + ModelAndView modelAndView=new ModelAndView("roles/roleUpdate"); + Roles role=rolesService.get(id); + modelAndView.addObject("model",role); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value={"/add"}) + public Message insert(@ModelAttribute("role") Roles role) { + _logger.debug("-Add :" + role); + + if (rolesService.insert(role)) { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.success); + + } else { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.error); + } + + } + + /** + * 查询 + * @param role + * @return + */ + @ResponseBody + @RequestMapping(value={"/query"}) + public Message query(@ModelAttribute("role") Roles role) { + _logger.debug("-query :" + role); + if (rolesService.load(role)!=null) { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.success); + + } else { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_ERROR),MessageType.error); + } + + } + + /** + * 修改 + * @param role + * @return + */ + @ResponseBody + @RequestMapping(value={"/update"}) + public Message update(@ModelAttribute("role") Roles role) { + _logger.debug("-update role :" + role); + + if (rolesService.update(role)) { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.UPDATE_SUCCESS),MessageType.success); + + } else { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.UPDATE_ERROR),MessageType.error); + } + + } + + + @ResponseBody + @RequestMapping(value={"/delete"}) + public Message delete(@ModelAttribute("role") Roles role) { + _logger.debug("-delete role :" + role); + + if (rolesService.remove(role.getId())) { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success); + + } else { + return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.error); + } + + } +} diff --git a/maxkey-web-manage/src/main/resources/messages/message.properties b/maxkey-web-manage/src/main/resources/messages/message.properties index 2c0ea1944..7ae087891 100644 --- a/maxkey-web-manage/src/main/resources/messages/message.properties +++ b/maxkey-web-manage/src/main/resources/messages/message.properties @@ -389,6 +389,14 @@ group.name=\u7528\u6237\u7EC4 role.id=\u89D2\u8272\u7F16\u7801 role.name=\u89D2\u8272 +resource.id=\u8D44\u6E90\u7F16\u7801 +resource.name=\u8D44\u6E90\u540D\u79F0 +resource.pid=\u7236\u7EA7\u7F16\u7801 +resource.pname=\u7236\u7EA7\u540D\u79F0 +resource.resType=\u8D44\u6E90\u7C7B\u578B +resource.resUrl=\u8D44\u6E90\u5730\u5740 +resource.resAction=\u52A8\u4F5C + #account account.username=\u7528\u6237\u540D account.displayName=\u7528\u6237\u59D3\u540D @@ -461,7 +469,7 @@ navs.apps=\u5E94\u7528\u7BA1\u7406 navs.accounts=\u8D26\u53F7\u7BA1\u7406 navs.groups=\u7EC4\u7BA1\u7406 navs.groups.member=\u6210\u5458\u7BA1\u7406 -navs.groups.privileges=\u6743\u9650\u7BA1\u7406 +navs.groups.privileges=\u8BBF\u95EE\u6743\u9650\u7BA1\u7406 navs.conf=\u914D\u7F6E\u7BA1\u7406 navs.conf.passwordpolicy=\u5BC6\u7801\u7B56\u7565 navs.audit=\u65E5\u5FD7\u5BA1\u8BA1 @@ -469,3 +477,5 @@ navs.audit.login=\u767B\u5F55\u65E5\u5FD7 navs.audit.loginapps=\u8BBF\u95EE\u65E5\u5FD7 navs.audit.operate=\u64CD\u4F5C\u65E5\u5FD7 navs.roles=\u89D2\u8272\u7BA1\u7406 +navs.role.permissions=\u89D2\u8272\u6743\u9650\u7BA1\u7406 +navs.resources=\u8D44\u6E90\u7BA1\u7406 diff --git a/maxkey-web-manage/src/main/resources/messages/message_en.properties b/maxkey-web-manage/src/main/resources/messages/message_en.properties index 0814cdb9d..50d51e139 100644 --- a/maxkey-web-manage/src/main/resources/messages/message_en.properties +++ b/maxkey-web-manage/src/main/resources/messages/message_en.properties @@ -388,6 +388,14 @@ group.name=name role.id=id role.name=name +resource.id=id +resource.name=name +resource.pid=pid +resource.pname=pname +resource.resType=Type +resource.resUrl=URL +resource.resAction=Action + #account account.username=username account.displayName=displayName @@ -461,11 +469,13 @@ navs.apps=Apps navs.accounts=Accounts navs.groups=Groups navs.groups.member=Groups Member -navs.groups.privileges=Privileges +navs.groups.privileges=Access Privileges navs.conf=Conf navs.conf.passwordpolicy=PasswordPolicy navs.audit=Audit navs.audit.login=Login navs.audit.loginapps=LoginApps navs.audit.operate=Operate -navs.roles=Roles \ No newline at end of file +navs.roles=Roles +navs.role.permissions=Permissions +navs.resources=Resources \ No newline at end of file diff --git a/maxkey-web-manage/src/main/resources/templates/views/groupapp/groupAppsList.ftl b/maxkey-web-manage/src/main/resources/templates/views/groupapp/groupAppsList.ftl index 3a5276bef..cb732533c 100644 --- a/maxkey-web-manage/src/main/resources/templates/views/groupapp/groupAppsList.ftl +++ b/maxkey-web-manage/src/main/resources/templates/views/groupapp/groupAppsList.ftl @@ -93,24 +93,10 @@ <@locale code="apps.name"/> - + - <@locale code="apps.protocol"/> + - diff --git a/maxkey-web-manage/src/main/resources/templates/views/layout/common.cssjs.ftl b/maxkey-web-manage/src/main/resources/templates/views/layout/common.cssjs.ftl index 39234707d..6a182e475 100644 --- a/maxkey-web-manage/src/main/resources/templates/views/layout/common.cssjs.ftl +++ b/maxkey-web-manage/src/main/resources/templates/views/layout/common.cssjs.ftl @@ -47,6 +47,14 @@ e.preventDefault(); }); + $('.side-nav-menu').each(function(){ + var href = $(this).attr('href'); + if(window.location.href.indexOf(href) > 0){ + $(this).parents("li").addClass("mm-active"); + + } + }); + $(".datetimepicker").datetimepicker({format:'Y-m-d H:i',lang:'<@locale/>'.substring(0, 2)}); $(".datepicker").datetimepicker({timepicker:false,format:'Y-m-d',lang:'<@locale/>'.substring(0, 2)}); diff --git a/maxkey-web-manage/src/main/resources/templates/views/layout/sidenav.ftl b/maxkey-web-manage/src/main/resources/templates/views/layout/sidenav.ftl index da9d423e9..8e5b8f62a 100644 --- a/maxkey-web-manage/src/main/resources/templates/views/layout/sidenav.ftl +++ b/maxkey-web-manage/src/main/resources/templates/views/layout/sidenav.ftl @@ -1,97 +1,114 @@
  • - + <@locale code="navs.home"/>
  • - + <@locale code="navs.orgs"/>
  • - + <@locale code="navs.users"/>
  • - + <@locale code="navs.apps"/>
  • - + <@locale code="navs.accounts"/>
  • - + <@locale code="navs.groups"/> -
  • - +
  • - + <@locale code="navs.conf"/>
  • - + <@locale code="navs.audit"/>
    • - + <@locale code="navs.audit.login"/>
    • - + <@locale code="navs.audit.loginapps"/>
    • - + <@locale code="navs.audit.operate"/> diff --git a/maxkey-web-manage/src/main/resources/templates/views/permissions/permissionsList.ftl b/maxkey-web-manage/src/main/resources/templates/views/permissions/permissionsList.ftl new file mode 100644 index 000000000..0a960948e --- /dev/null +++ b/maxkey-web-manage/src/main/resources/templates/views/permissions/permissionsList.ftl @@ -0,0 +1,331 @@ + + + + <#include "../layout/header.ftl"/> + <#include "../layout/common.cssjs.ftl"/> + + + +
      +
      + + + +
      + +
      +
      + +
      +
      +
      +
      +
      + + + + + + + + + +
      <@locale code="role.name"/>: +
      + + + "> + +
      +
      <@locale code="apps.name"/>: +
      + + + + " + wurl="<@base/>/apps/select" + wwidth="700" + wheight="500" + target="window"> + "> + +
      +
      +
      + "/> +
      +
      + + +
      + + + + + + + +
      + + + + + + + + + + +
      Id<@locale code="role.name"/><@locale code="common.text.description"/>
      +
      +
      +
      + +
      +
      +
      + <#include "../layout/footer.ftl"/> +
      + +
      + +
      +
      + +
      +
      +
      + + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/resources/templates/views/resources/resourceAdd.ftl b/maxkey-web-manage/src/main/resources/templates/views/resources/resourceAdd.ftl new file mode 100644 index 000000000..dd5ea81f6 --- /dev/null +++ b/maxkey-web-manage/src/main/resources/templates/views/resources/resourceAdd.ftl @@ -0,0 +1,85 @@ + + + + <#include "../layout/header.ftl"/> + <#include "../layout/common.cssjs.ftl"/> + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      <@locale code="resource.name" />: + +
      <@locale code="apps.id" />: + +
      <@locale code="resource.pid" />: + +
      <@locale code="resource.pname" />: + +
      <@locale code="resource.resType" />: + +
      <@locale code="resource.resUrl" />: + +
      <@locale code="resource.resAction" />: + +
      <@locale code="common.text.description" />: + +
      + + + "> + "> +
      +
      + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/resources/templates/views/resources/resourceUpdate.ftl b/maxkey-web-manage/src/main/resources/templates/views/resources/resourceUpdate.ftl new file mode 100644 index 000000000..c393af246 --- /dev/null +++ b/maxkey-web-manage/src/main/resources/templates/views/resources/resourceUpdate.ftl @@ -0,0 +1,83 @@ + + + + <#include "../layout/header.ftl"/> + <#include "../layout/common.cssjs.ftl"/> + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      <@locale code="resource.id" />: + +
      <@locale code="resource.name" />: + +
      <@locale code="resource.pid" />: + +
      <@locale code="apps.id" />: + +
      <@locale code="resource.pname" />: + +
      <@locale code="resource.resType" />: + +
      <@locale code="resource.resUrl" />: + +
      <@locale code="resource.resAction" />: + +
      <@locale code="common.text.description" />: + +
      + + + "> + "> +
      +
      + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/resources/templates/views/resources/resourcesList.ftl b/maxkey-web-manage/src/main/resources/templates/views/resources/resourcesList.ftl new file mode 100644 index 000000000..8b7af7724 --- /dev/null +++ b/maxkey-web-manage/src/main/resources/templates/views/resources/resourcesList.ftl @@ -0,0 +1,268 @@ + + + + <#include "../layout/header.ftl"/> + <#include "../layout/common.cssjs.ftl"/> + + + +
      +
      + + + +
      + +
      +
      + +
      +
      +
      +
      +
      + + + + + + + +
      <@locale code="apps.name"/>: +
      + + + + " + wurl="<@base/>/apps/select" + wwidth="700" + wheight="500" + target="window"> + "> + + +
      +
      +
      + " + wurl="<@base/>/resources/forwardAdd" + wwidth="500" + wheight="500" + target="window"/> + + " + wurl="<@base/>/resources/forwardUpdate" + wwidth="500" + wheight="500" + target="window"/> + + " + wurl="<@base/>/resources/delete" /> +
      +
      + + +
      + + + + + + + +
      +
      + +
      + + + + + + + + + + +
      Id<@locale code="resource.name"/><@locale code="common.text.description"/>
      +
      + +
      +
      +
      + <#include "../layout/footer.ftl"/> +
      + +
      + +
      +
      + +
      +
      +
      + + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/resources/templates/views/resources/selectResourcesList.ftl b/maxkey-web-manage/src/main/resources/templates/views/resources/selectResourcesList.ftl new file mode 100644 index 000000000..2d77b7a48 --- /dev/null +++ b/maxkey-web-manage/src/main/resources/templates/views/resources/selectResourcesList.ftl @@ -0,0 +1,79 @@ + + + + <#include "../layout/header.ftl"/> + <#include "../layout/common.cssjs.ftl"/> + + + + +
      + + + + + + + +
      <@locale code="group.name"/>: +
      + + "> +
      +
      +
      + " > +
      +
      +
      + +
      + + + + + + + + + + + + + + +
      Id<@locale code="group.name"/><@locale code="common.text.description"/><@locale code="common.text.createdby"/><@locale code="common.text.createddate"/><@locale code="common.text.modifiedby"/><@locale code="common.text.modifieddate"/>
      + +
      + + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/resources/templates/views/roles/roleAdd.ftl b/maxkey-web-manage/src/main/resources/templates/views/roles/roleAdd.ftl new file mode 100644 index 000000000..ab7c1339e --- /dev/null +++ b/maxkey-web-manage/src/main/resources/templates/views/roles/roleAdd.ftl @@ -0,0 +1,42 @@ + + + + <#include "../layout/header.ftl"/> + <#include "../layout/common.cssjs.ftl"/> + + + +
      + + + + + + + + + + + + + + + +
      <@locale code="role.name" />: + +
      <@locale code="common.text.description" />: + +
      + + + "> + "> +
      +
      + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/resources/templates/views/roles/roleUpdate.ftl b/maxkey-web-manage/src/main/resources/templates/views/roles/roleUpdate.ftl new file mode 100644 index 000000000..0326dba82 --- /dev/null +++ b/maxkey-web-manage/src/main/resources/templates/views/roles/roleUpdate.ftl @@ -0,0 +1,47 @@ + + + + <#include "../layout/header.ftl"/> + <#include "../layout/common.cssjs.ftl"/> + + + +
      + + + + + + + + + + + + + + + + + + +
      <@locale code="role.id" />: + +
      <@locale code="role.name" />: + +
      <@locale code="common.text.description" />: + +
      + + + "> + "> +
      +
      + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/resources/templates/views/roles/rolesList.ftl b/maxkey-web-manage/src/main/resources/templates/views/roles/rolesList.ftl new file mode 100644 index 000000000..9cb913950 --- /dev/null +++ b/maxkey-web-manage/src/main/resources/templates/views/roles/rolesList.ftl @@ -0,0 +1,124 @@ + + + + <#include "../layout/header.ftl"/> + <#include "../layout/common.cssjs.ftl"/> + + + +
      +
      + + + +
      + +
      +
      + +
      +
      +
      +
      +
      + + + + + + + +
      <@locale code="role.name"/>: +
      + + "> + +
      +
      +
      + " + wurl="<@base/>/roles/forwardAdd" + wwidth="500" + wheight="200" + target="window"> + + " + wurl="<@base/>/roles/forwardUpdate" + wwidth="500" + wheight="200" + target="window"> + + " + wurl="<@base/>/roles/delete" /> +
      +
      + + +
      + + + + + + + + + + + + + + + + +
      Id<@locale code="role.name"/><@locale code="common.text.description"/><@locale code="common.text.createdby"/><@locale code="common.text.createddate"/><@locale code="common.text.modifiedby"/><@locale code="common.text.modifieddate"/>
      + + +
      +
      +
      + <#include "../layout/footer.ftl"/> +
      + +
      + +
      +
      + +
      +
      +
      + + + \ No newline at end of file diff --git a/maxkey-web-manage/src/main/resources/templates/views/roles/selectRolesList.ftl b/maxkey-web-manage/src/main/resources/templates/views/roles/selectRolesList.ftl new file mode 100644 index 000000000..4ebf98e8a --- /dev/null +++ b/maxkey-web-manage/src/main/resources/templates/views/roles/selectRolesList.ftl @@ -0,0 +1,79 @@ + + + + <#include "../layout/header.ftl"/> + <#include "../layout/common.cssjs.ftl"/> + + + + +
      + + + + + + + +
      <@locale code="role.name"/>: +
      + + "> +
      +
      +
      + " > +
      +
      +
      + +
      + + + + + + + + + + + + + + +
      Id<@locale code="role.name"/><@locale code="common.text.description"/><@locale code="common.text.createdby"/><@locale code="common.text.createddate"/><@locale code="common.text.modifiedby"/><@locale code="common.text.modifieddate"/>
      + +
      + + + \ No newline at end of file diff --git a/maxkey-web-maxkey/src/main/webapp/WEB-INF/web.xml b/maxkey-web-maxkey/src/main/webapp/WEB-INF/web.xml index 876e1a04c..9fe77e157 100644 --- a/maxkey-web-maxkey/src/main/webapp/WEB-INF/web.xml +++ b/maxkey-web-maxkey/src/main/webapp/WEB-INF/web.xml @@ -1,12 +1,12 @@ - + xmlns:javaee="http://java.sun.com/xml/ns/javaee" + xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" + xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" + version="2.4"> + MaxKey Single Sign On