Browse Source

role manage

shimingxy 5 years ago
parent
commit
ddf99aa011
31 changed files with 2634 additions and 491 deletions
  1. 115 148
      maxkey-core/src/main/java/org/maxkey/domain/Accounts.java
  2. 128 127
      maxkey-core/src/main/java/org/maxkey/domain/Groups.java
  3. 164 0
      maxkey-core/src/main/java/org/maxkey/domain/Resources.java
  4. 95 0
      maxkey-core/src/main/java/org/maxkey/domain/RolePermissions.java
  5. 105 0
      maxkey-core/src/main/java/org/maxkey/domain/Roles.java
  6. 107 99
      maxkey-core/src/main/java/org/maxkey/domain/Saml20Metadata.java
  7. 68 69
      maxkey-core/src/main/java/org/maxkey/web/component/TreeNode.java
  8. 16 0
      maxkey-dao/src/main/java/org/maxkey/dao/persistence/ResourcesMapper.java
  9. 24 0
      maxkey-dao/src/main/java/org/maxkey/dao/persistence/RolesMapper.java
  10. 23 0
      maxkey-dao/src/main/java/org/maxkey/dao/service/ResourcesService.java
  11. 37 0
      maxkey-dao/src/main/java/org/maxkey/dao/service/RolesService.java
  12. 54 0
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ResourcesMapper.xml
  13. 84 0
      maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RolesMapper.xml
  14. 104 0
      maxkey-web-manage/src/main/java/org/maxkey/web/contorller/PermissionsController.java
  15. 163 0
      maxkey-web-manage/src/main/java/org/maxkey/web/contorller/ResourcesController.java
  16. 130 0
      maxkey-web-manage/src/main/java/org/maxkey/web/contorller/RolesController.java
  17. 11 1
      maxkey-web-manage/src/main/resources/messages/message.properties
  18. 12 2
      maxkey-web-manage/src/main/resources/messages/message_en.properties
  19. 2 16
      maxkey-web-manage/src/main/resources/templates/views/groupapp/groupAppsList.ftl
  20. 8 0
      maxkey-web-manage/src/main/resources/templates/views/layout/common.cssjs.ftl
  21. 39 22
      maxkey-web-manage/src/main/resources/templates/views/layout/sidenav.ftl
  22. 331 0
      maxkey-web-manage/src/main/resources/templates/views/permissions/permissionsList.ftl
  23. 85 0
      maxkey-web-manage/src/main/resources/templates/views/resources/resourceAdd.ftl
  24. 83 0
      maxkey-web-manage/src/main/resources/templates/views/resources/resourceUpdate.ftl
  25. 268 0
      maxkey-web-manage/src/main/resources/templates/views/resources/resourcesList.ftl
  26. 79 0
      maxkey-web-manage/src/main/resources/templates/views/resources/selectResourcesList.ftl
  27. 42 0
      maxkey-web-manage/src/main/resources/templates/views/roles/roleAdd.ftl
  28. 47 0
      maxkey-web-manage/src/main/resources/templates/views/roles/roleUpdate.ftl
  29. 124 0
      maxkey-web-manage/src/main/resources/templates/views/roles/rolesList.ftl
  30. 79 0
      maxkey-web-manage/src/main/resources/templates/views/roles/selectRolesList.ftl
  31. 7 7
      maxkey-web-maxkey/src/main/webapp/WEB-INF/web.xml

+ 115 - 148
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{
-
-	/**
-	 * 
-	 */
-	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();
-	}
-
-	
-	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;
-	}
-
-
-	/**
-	 * @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
-				+ "]";
-	}
+@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;
+
+    @Length(max = 60)
+    @Column
+    private String relatedUsername;
+    @Column
+    private String relatedPassword;
+
+    public Accounts() {
+        super();
+    }
+
+    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 getId() {
+        return id;
+    }
+
+
+    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 + "]";
+    }
 
 }

+ 128 - 127
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 {
+
+    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;
+    }
+
+    /**
+     * 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 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 + "]";
+    }
 
-@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;
-	}
-
-	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 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 + "]";
-	}
-	
-
-	
 }

+ 164 - 0
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;
+    }
+    
+    
+   
+}

+ 95 - 0
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;
+    }
+    
+
+}

+ 105 - 0
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;
+    }
+   
+    
+
+}

+ 107 - 99
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 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;
-	/**
-	 * 
-	 */
-	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 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";
+    }
+
+    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 + "]";
+    }
+
 }

+ 68 - 69
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<String,Object> attr存储节点数据
+ * 数控件的节点 使用HashMap<String,Object> attr存储节点数据.
+ * 
  * @author Crystal.Sea
  *
  */
 public class TreeNode {
-	//TreeNode
-	HashMap<String,Object> attr=new HashMap<String,Object>();
-
-	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<String, Object> getAttr() {
-		return attr;
-	}
-
-	public void setAttr(String attrName, Object value) {
-		this.attr .put(attrName, value);
-	}
-	
-	public void setAttr(HashMap<String, Object> attr) {
-		this.attr = attr;
-	}
-	
+    // TreeNode
+    HashMap<String, Object> attr = new HashMap<String, Object>();
+
+    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<String, Object> getAttr() {
+        return attr;
+    }
+
+    public void setAttr(String attrName, Object value) {
+        this.attr.put(attrName, value);
+    }
+
+    public void setAttr(HashMap<String, Object> attr) {
+        this.attr = attr;
+    }
 
 }

+ 16 - 0
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<Resources> {
+
+}

+ 24 - 0
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<Roles> {
+    
+    public int insertRolePermissions(List<RolePermissions> rolePermissionsList);
+    
+    public int logisticDeleteRolePermissions(List<RolePermissions> rolePermissionsList);
+        
+    public List<RolePermissions> queryRolePermissions(RolePermissions rolePermissions);
+}

+ 23 - 0
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<Resources>{
+	
+	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();
+	}
+}

+ 37 - 0
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<Roles>{
+	
+	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<RolePermissions> rolePermissionsList) {
+	    return getMapper().insertRolePermissions(rolePermissionsList)>0;
+	};
+    
+	public boolean logisticDeleteRolePermissions(List<RolePermissions> rolePermissionsList) {
+	     return getMapper().logisticDeleteRolePermissions(rolePermissionsList)>=0;
+	 }
+	
+    public List<RolePermissions> queryRolePermissions(RolePermissions rolePermissions){
+        return getMapper().queryRolePermissions(rolePermissions);
+    }
+}

+ 54 - 0
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/ResourcesMapper.xml

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.maxkey.dao.persistence.ResourcesMapper">
+
+	<sql id="where_statement">
+    	<if test="id != null and id != ''">
+			AND	ID	=	#{id}
+		</if> 
+		<if test="appId != null and appId != ''">
+            AND APPID  =   #{appId}
+        </if> 
+        <if test="pid != null and pid != ''">
+            AND PID  =   #{pid}
+        </if> 
+		<if test="name != null and name != ''">
+			AND NAME LIKE '%${name}%'
+		</if>
+    </sql>
+    
+	
+	
+	<select id="queryPageResults" parameterType="Resources" resultType="Resources">
+		SELECT
+			*
+		FROM
+			RESOURCES
+		WHERE
+			 (1=1)	
+		<include refid="where_statement"/>
+	</select>
+	
+	
+	<update id="logisticDelete" parameterType="Resources" >
+    	UPDATE RESOURCES SET
+    		STATUS	=	'2'  
+    	WHERE	1	=	1
+    	<if test="id != null">
+			AND	ID	=	#{id}
+		</if>
+		<if test="name != name">
+			ADN	NAME	=	#{name}
+		</if>
+    </update>
+    
+    
+    <update id="logisticBatchDelete" parameterType="java.util.List">
+    	UPDATE RESOURCES SET STATUS='2' WHERE ID IN
+    		<foreach item="item" collection="list" open="(" separator="," close=")">
+				#{item}
+    		</foreach>
+    </update>
+    
+   
+</mapper>

+ 84 - 0
maxkey-dao/src/main/resources/org/maxkey/dao/persistence/xml/mysql/RolesMapper.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.maxkey.dao.persistence.RolesMapper">
+
+	<sql id="where_statement">
+    	<if test="id != null and id != ''">
+			AND	ID	=	#{id}
+		</if> 
+		<if test="name != null and name != ''">
+			AND NAME LIKE '%${name}%'
+		</if>
+    </sql>
+    
+	
+	
+	<select id="queryPageResults" parameterType="Groups" resultType="Groups">
+		SELECT
+			*
+		FROM
+			ROLES
+		WHERE
+			 (1=1)	
+		<include refid="where_statement"/>
+	</select>
+	
+	
+	<update id="logisticDelete" parameterType="Groups" >
+    	UPDATE ROLES SET
+    		STATUS	=	'2'  
+    	WHERE	1	=	1
+    	<if test="id != null">
+			AND	ID	=	#{id}
+		</if>
+		<if test="name != name">
+			ADN	NAME	=	#{name}
+		</if>
+    </update>
+    
+    
+    <update id="logisticBatchDelete" parameterType="java.util.List">
+    	UPDATE ROLES SET STATUS='2' WHERE ID IN
+    		<foreach item="item" collection="list" open="(" separator="," close=")">
+				#{item}
+    		</foreach>
+    </update>
+    
+    
+    <select id="queryRolePermissions" parameterType="RolePermissions" resultType="RolePermissions">
+        SELECT
+            *
+        FROM
+            ROLE_PERMISSIONS
+        WHERE
+             STATUS = 1
+       <if test="id != null and id != ''">
+            AND ID  =   #{id}
+        </if> 
+        <if test="roleId != null and roleId != ''">
+            AND ROLEID  =   #{roleId}
+        </if> 
+        <if test="appId != null and appId != ''">
+            AND APPID  =   #{appId}
+        </if> 
+        
+    </select>
+    
+    <update id="logisticDeleteRolePermissions" parameterType="java.util.List">
+        UPDATE ROLE_PERMISSIONS SET STATUS=9 WHERE ID IN
+            <foreach item="item" collection="list" open="(" separator="," close=")">
+                #{item.id}
+            </foreach>
+    </update>
+    
+    <insert id="insertRolePermissions"  parameterType="java.util.List">
+	    INSERT INTO ROLE_PERMISSIONS ( ID,APPID,ROLEID,RESOURCEID,STATUS) 
+	    VALUES 
+	    <foreach collection="list" item="item" index="index" separator=",">
+	        (#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status})
+	    </foreach>
+	</insert>
+	
+	
+   
+</mapper>

+ 104 - 0
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<RolePermissions> rolePermissionsedList = rolesService.queryRolePermissions(
+		                new RolePermissions(rolePermissions.getAppId(),rolePermissions.getRoleId()));
+		
+		HashMap<String,String >permedMap =new HashMap<String,String >();
+		for(RolePermissions rolePerms : rolePermissionsedList) {
+		    permedMap.put(rolePerms.getUniqueId(),rolePerms.getId());
+		}
+		//Maybe insert
+		ArrayList<RolePermissions> rolePermissionsList =new ArrayList<RolePermissions>();
+		List<String>resourceIds = StringUtils.string2List(rolePermissions.getResourceId(), ",");
+		HashMap<String,String >newPermsMap =new HashMap<String,String >();
+		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<RolePermissions> deleteRolePermissionsList =new ArrayList<RolePermissions>();
+		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<RolePermissions> querypermissions(@ModelAttribute("rolePermissions") RolePermissions rolePermissions) {
+        _logger.debug("-querypermissions  :" + rolePermissions);
+        //have
+        List<RolePermissions> rolePermissionsedList = rolesService.queryRolePermissions(
+                        new RolePermissions(rolePermissions.getAppId(),rolePermissions.getRoleId()));
+        return rolePermissionsedList;
+	}
+
+	
+}

+ 163 - 0
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<Resources> 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<HashMap<String, Object>> 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<Resources> 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();
+	  }
+}

+ 130 - 0
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<Roles> 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);
+		}
+		
+	}
+}

+ 11 - 1
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

+ 12 - 2
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
+navs.roles=Roles
+navs.role.permissions=Permissions
+navs.resources=Resources

+ 2 - 16
maxkey-web-manage/src/main/resources/templates/views/groupapp/groupAppsList.ftl

@@ -93,24 +93,10 @@
 	 			<tr>
 		 			<td width="120px"><@locale code="apps.name"/></td>
 		 			<td width="360px">
-		 				<input type="text" name="name" style ="width:150px">
+		 				<input class="form-control" type="text" name="name" style ="width:150px">
 		 			</td>
-		 			<td width="120px"><@locale code="apps.protocol"/></td>
+		 			<td width="120px"></td>
 		 			<td width="360px">
-		 				<select name="protocol" class="select_protocol">
-		 					<option value=""  selected>Select</option>
-		 					<option value="<%=PROTOCOLS.FORMBASED%>"><%=PROTOCOLS.FORMBASED%></option>
-		 					<option value="<%=PROTOCOLS.OPEN_ID_CONNECT%>"><%=PROTOCOLS.OPEN_ID_CONNECT%></option>
-		 					<option value="<%=PROTOCOLS.OAUTH10A%>"><%=PROTOCOLS.OAUTH10A%></option>
-		 					<option value="<%=PROTOCOLS.OAUTH20%>"><%=PROTOCOLS.OAUTH20%></option>
-		 					<option value="<%=PROTOCOLS.SAML11%>"><%=PROTOCOLS.SAML11%></option>
-		 					<option value="<%=PROTOCOLS.SAML20%>"><%=PROTOCOLS.SAML20%></option>
-		 					<option value="<%=PROTOCOLS.COOKIEBASED%>"><%=PROTOCOLS.COOKIEBASED%></option>
-		 					<option value="<%=PROTOCOLS.TOKENBASED%>"><%=PROTOCOLS.TOKENBASED%></option>
-		 					<option value="<%=PROTOCOLS.DESKTOP%>"><%=PROTOCOLS.DESKTOP%></option>
-		 					<option value="<%=PROTOCOLS.BASIC%>"><%=PROTOCOLS.BASIC%></option>
-		 					
-		 				</select>
 		 			</td>
 	 			</tr>
 	 		</table>

+ 8 - 0
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)});
 			

+ 39 - 22
maxkey-web-manage/src/main/resources/templates/views/layout/sidenav.ftl

@@ -1,97 +1,114 @@
 <div  dir="rtl">
 <ul class="metismenu" id="side-nav-menu" >
 	<li>
-		<a class="" href="<@base />/main/">
+		<a class="side-nav-menu" href="<@base />/main/">
        		<span class="fa fa-fw fa-github fa-lg"></span>
        		<@locale code="navs.home"/>
     	</a>
 	</li>
    	<li>
-     	<a class="" href="<@base />/orgs/list/">
+     	<a class="side-nav-menu" href="<@base />/orgs/list/">
       		<span class="fa fa-fw fa-github fa-lg"></span>
        		<@locale code="navs.orgs"/>
      	</a>
    	</li>
    	<li>
-     	<a class="" href="<@base />/userinfo/list/">
+     	<a class="side-nav-menu" href="<@base />/userinfo/list/">
       		<span class="fa fa-fw fa-github fa-lg"></span>
        		<@locale code="navs.users"/>
      	</a>
    	</li>
    	<li>
-     	<a class="" href="<@base />/apps/list/">
+     	<a class="side-nav-menu" href="<@base />/apps/list/">
       		<span class="fa fa-fw fa-github fa-lg"></span>
        		<@locale code="navs.apps"/>
      	</a>
    	</li>
    	
  	<li>
-     	<a class="" href="<@base />/app/accounts/list">
+     	<a class="side-nav-menu" href="<@base />/app/accounts/list/">
       		<span class="fa fa-fw fa-github fa-lg"></span>
        		<@locale code="navs.accounts"/>
      	</a>
    	</li>  	
    	<li>
-     	<a class="has-arrow" href="#">
+     	<a class="side-nav-menu has-arrow" href="#">
       		<span class="fa fa-fw fa-github fa-lg"></span>
        		<@locale code="navs.groups"/>
      	</a>
      	<ul>
      		<li>
-	         <a href="<@base />/groups/list/">
+	         <a class="side-nav-menu" href="<@base />/groups/list/">
 	           <span class="fa fa-fw fa-code-fork"></span>
 	         	<@locale code="navs.groups"/>	
 	         </a>
 	       </li>
 	       <li>
-	         <a href="<@base />/groupMember/list">
+	         <a class="side-nav-menu"  href="<@base />/groupMember/list/">
 	           <span class="fa fa-fw fa-code-fork"></span>
 	         	<@locale code="navs.groups.member"/>
 	         </a>
 	       </li>
 	       <li>
-	         <a href="<@base />/groupPrivileges/list">
+	         <a class="side-nav-menu" href="<@base />/groupPrivileges/list/">
 	           <span class="fa fa-fw fa-code-fork"></span>
 	         	 <@locale code="navs.groups.privileges"/>
 	         </a>
 	       </li>
 	    </ul>
-   	</li>
-   		
+   	</li> 
    	<li>
-     	<a class="has-arrow" href="#">
+     	<a class="side-nav-menu has-arrow" href="#">
       		<span class="fa fa-fw fa-github fa-lg"></span>
        		<@locale code="navs.conf"/>
      	</a>
      	<ul>
-     		<li>
-	         <a href="<@base />/config/passwordpolicy/forward">
-	           <span class="fa fa-fw fa-code-fork"></span>
-	         	<@locale code="navs.conf.passwordpolicy"/>
-	         </a>
-	       </li>
+	       <li>
+             <a class="side-nav-menu" href="<@base />/roles/list/">
+               <span class="fa fa-fw fa-code-fork"></span>
+                <@locale code="navs.roles"/>  
+             </a>
+           </li>
+           <li>
+                 <a class="side-nav-menu" href="<@base />/resources/list/">
+                   <span class="fa fa-fw fa-code-fork"></span>
+                    <@locale code="navs.resources"/>
+                 </a>
+            </li>
+           <li>
+             <a class="side-nav-menu" href="<@base />/permissions/list/">
+               <span class="fa fa-fw fa-code-fork"></span>
+                 <@locale code="navs.role.permissions"/>
+             </a>
+           </li>
+           <li>
+             <a class="side-nav-menu" href="<@base />/config/passwordpolicy/forward/">
+               <span class="fa fa-fw fa-code-fork"></span>
+                <@locale code="navs.conf.passwordpolicy"/>
+             </a>
+           </li>
 	    </ul>
 	</li>
    	<li>
-     	<a class="has-arrow" href="#">
+     	<a class="side-nav-menu has-arrow" href="#">
       		<span class="fa fa-fw fa-github fa-lg"></span>
        		<@locale code="navs.audit"/>
      	</a>
      	<ul>
 	       <li>
-	         <a href="<@base />/logs/loginHistoryList">
+	         <a class="side-nav-menu" href="<@base />/logs/loginHistoryList/">
 	           <span class="fa fa-fw fa-code-fork"></span>
 	         	<@locale code="navs.audit.login"/>
 	         </a>
 	       </li>
 	       <li>
-	         <a href="<@base />/logs/loginAppsHistoryList">
+	         <a class="side-nav-menu" href="<@base />/logs/loginAppsHistoryList/">
 	           <span class="fa fa-fw fa-code-fork"></span>
 	         	 <@locale code="navs.audit.loginapps"/>
 	         </a>
 	       </li>
 	       <li>
-	         <a href="<@base />/logs/list">
+	         <a class="side-nav-menu" href="<@base />/logs/list/">
 	           <span class="fa fa-fw fa-code-fork"></span>
 	         	  <@locale code="navs.audit.operate"/>
 	         </a>

+ 331 - 0
maxkey-web-manage/src/main/resources/templates/views/permissions/permissionsList.ftl

@@ -0,0 +1,331 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+<script type="text/javascript"> 
+
+function onClick (event, treeId, treeNode) {
+
+    $("#pid").val(treeNode.id);
+    $.cookie("select_res_id", treeNode.id, { path: '/' });
+    $.cookie("select_app_id", $("#appId").val(), { path: '/' });
+    $.cookie("select_res_name", treeNode.name,{ path: '/' });
+    $("#searchBtn").click();
+    
+     
+}
+
+
+$(function () {
+
+ $("#savePermBtn").click(function(){
+    
+    var roleId="";
+    if($("#datagrid").length>0){//get grid list selected ids
+        var selRows = $('#datagrid').bootstrapTable('getSelections');
+        for (var i=0;i<selRows.length; i++){
+            roleId=roleId+","+selRows[i].id;
+            break;
+        }
+        roleId=roleId.substring(1);
+    }
+    
+    if(roleId == null || roleId == "") {
+        $.alert({content:$.platform.messages.select.alertText});
+        return;
+    }
+    
+    var resIds="";
+    var nodes = $.fn.zTree.getZTreeObj("resourcesTree").getCheckedNodes(true);
+    for(var i=0;i<nodes.length;i++){
+         resIds=resIds+","+nodes[i].id;
+     }
+     resIds=resIds.substring(1);
+    
+    $.post("<@base/>/permissions/savepermissions", 
+            {
+                appId:$("#appId").val(),
+                roleId:roleId,
+                resourceId:resIds,
+                currTime:(new Date()).getTime()
+            }, 
+            function(data) {
+        if (typeof(afterDelete) == "function"){
+            afterDelete(data);//call back action
+        }
+        //alert delete result
+        $.alert({content:data.message,type:$.platform.messages.messageType[data.messageType]});
+        //refresh grid list
+        
+    }); 
+ });
+   
+$('#datagrid').on('click-row.bs.table', function (row, element, field) {
+     if($("#appId").val() == null || $("#appId").val() == "") {
+        $.alert({content:$.platform.messages.select.alertText});
+        return;
+    }
+    
+    $.post("<@base/>/permissions/querypermissions", 
+            {
+                appId:$("#appId").val(),
+                roleId:element.id,
+                currTime:(new Date()).getTime()
+            }, 
+            function(data) {
+                if (typeof(afterDelete) == "function"){
+                    afterDelete(data);//call back action
+                }
+                var zTree = $.fn.zTree.getZTreeObj("resourcesTree");
+                zTree.checkAllNodes(false);
+                for(var permsData  of  data){
+                    var node = zTree.getNodeByParam("id",permsData.resourceId);
+                    zTree.checkNode(node, true, true);
+                }
+        
+    }); 
+});
+
+ $("#changTreeBtn").click(function(){
+        var treeSettings={
+            element  :  "resourcesTree",
+            rootId  :  "1",
+            checkbox  :  true,
+            onClick  :  onClick,
+            onDblClick  :  null,
+            url  :  "<@base/>/resources/tree/"
+        };
+            
+        function singlePath(newNode) {
+            if (newNode === curExpandNode) return;
+            if (curExpandNode && curExpandNode.open==true) {
+                var zTree = $.fn.zTree.getZTreeObj(treeSettings.element);
+                if (newNode.parentTId === curExpandNode.parentTId) {
+                    zTree.expandNode(curExpandNode, false);
+                } else {
+                    var newParents = [];
+                    while (newNode) {
+                        newNode = newNode.getParentNode();
+                        if (newNode === curExpandNode) {
+                            newParents = null;
+                            break;
+                        } else if (newNode) {
+                            newParents.push(newNode);
+                        }
+                    }
+                    if (newParents!=null) {
+                        var oldNode = curExpandNode;
+                        var oldParents = [];
+                        while (oldNode) {
+                            oldNode = oldNode.getParentNode();
+                            if (oldNode) {
+                                oldParents.push(oldNode);
+                            }
+                        }
+                        if (newParents.length>0) {
+                            for (var i = Math.min(newParents.length, oldParents.length)-1; i>=0; i--) {
+                                if (newParents[i] !== oldParents[i]) {
+                                    zTree.expandNode(oldParents[i], false);
+                                    break;
+                                }
+                            }
+                        } else {
+                            zTree.expandNode(oldParents[oldParents.length-1], false);
+                        }
+                    }
+                }
+            }
+            curExpandNode = newNode;
+        };
+
+
+        function beforeExpand(treeId, treeNode) {
+            var pNode = curExpandNode ? curExpandNode.getParentNode():null;
+            var treeNodeP = treeNode.parentTId ? treeNode.getParentNode():null;
+            var zTree = $.fn.zTree.getZTreeObj(""+treeSettings.element);
+            for(var i=0, l=!treeNodeP ? 0:treeNodeP.children.length; i<l; i++ ) {
+                if (treeNode !== treeNodeP.children[i]) {
+                    zTree.expandNode(treeNodeP.children[i], false);
+                }
+            }
+            while (pNode) {
+                if (pNode === treeNode) {
+                    break;
+                }
+                pNode = pNode.getParentNode();
+            }
+            if (!pNode) {
+                singlePath(treeNode);
+            }
+
+        };
+        
+        $.fn.zTree.init(
+                $("#"+treeSettings.element), //element
+                {//json object 
+                    check   :   {
+                        enable      :   treeSettings.checkbox
+                    },
+                    async   :   {
+                        enable      :   true,
+                        url         :   treeSettings.url,
+                        autoParam   :   ["id", "name=n", "level=lv"],
+                        otherParam  :   {
+                                            "otherParam":"zTreeAsyncTest",
+                                            id:treeSettings.rootId,
+                                            "appId":$("#appId").val(),
+                                            "appName":$("#appName").val(),
+                                            }
+                    },
+                    data            :   {
+                        simpleData  :   {
+                            enable  :   true
+                        }
+                    },
+                    callback: {
+                        onClick         :   treeSettings.onClick,
+                        onDblClick      :   treeSettings.onDblClick,
+                        beforeAsync     :   function(treeId, treeNode){
+                            $.loading();
+                        },
+                        onAsyncSuccess  :   function(event, treeId, treeNode, msg){
+                            $.unloading();
+                        },
+                        //beforeExpand  :   beforeExpand,
+                        onExpand        :   function onExpand(event, treeId, treeNode) {
+                            curExpandNode = treeNode;
+                        }
+                    }
+                }
+            );//end tree
+ }); 
+
+            
+});
+    </script>
+</head>
+<body> 
+<div class="app header-default side-nav-dark">
+<div class="layout">
+	<div class="header navbar">
+		<#include  "../layout/top.ftl"/>
+	</div>
+	
+	<div class="col-md-3 sidebar-nav side-nav" >
+ 		<#include  "../layout/sidenav.ftl"/>
+	</div>
+	<div class="page-container">
+	
+	<div class="main-content">
+		<div class="container-fluid">
+			<div class="breadcrumb-wrapper row">
+				<div class="col-12 col-lg-3 col-md-6">
+					<h4 class="page-title"><@locale code="navs.role.permissions"/></h4>
+				</div>
+				<div class="col-12 col-lg-9 col-md-6">
+					<ol class="breadcrumb float-right">
+						<li><a href="<@base/>/main"><@locale code="navs.home"/></a></li>
+						<li class="active">/ <@locale code="navs.resources"/></li>
+					</ol>
+				</div>
+			</div>
+		</div>
+		<div class="container-fluid">
+			<div class="col-12 grid-margin">
+				<div class="card">
+					<div class="card-body">
+		
+			<table  class="table table-bordered">
+ 				<tr>
+		 			<td style="width:80px;"><@locale code="role.name"/>:</td>
+		 			<td style="width:350px;">
+		 				<form id="basic_search_form">
+                            <input class="form-control"    style="width:200px;float: left;" value=""    id="name" name="name" type="text" >
+                            
+			 				<input  class="button btn btn-primary mr-3"    id="searchBtn" type="button" size="50" value="<@locale code="button.text.search"/>">
+				 			
+					 	</form>
+		 			</td>
+		 			<td style="width:120px;"><@locale code="apps.name"/>:</td>
+                    <td style="width:500px;">
+                        <form id="resources_search_form">
+                            <input class="form-control appId" id="appId" name="appId" value="" type="hidden"  >
+                            <input class="form-control" id="pid" name="pid" value="" type="hidden"  >
+                            <input class="form-control appName"    style="width:200px;float: left;" value=""    id="appName" name="appName" type="text" >
+                            <input class="button btn btn-success mr-3 window" style="float: left;" id="selectBtn" type="button" value="<@locale code="button.text.select"/>" 
+                                    wurl="<@base/>/apps/select"
+                                    wwidth="700"
+                                    wheight="500"
+                                    target="window">
+                            <input  class="button btn btn-primary mr-3"    id="changTreeBtn" type="button" size="50" value="<@locale code="button.text.search"/>">
+                           
+                        </form>
+                    </td>
+		 			<td >
+		 				<div id="tool_box_right" style="width:100px;">
+					 	     <input class="button btn btn-success mr-3 "  id="savePermBtn" type="button" value="<@locale code="button.text.save"/>"/>
+						</div>
+		 			</td>
+		 		</tr>
+		 	</table>
+		
+		 		
+ 	</div>
+ 	
+ 	<div id="advanced_search">
+ 		<form id="advanced_search_form">
+	 		
+	 	</form>
+ 	</div>
+ 	 <table class="datatable"   width="100%" >
+   <tr>
+      <td valign="top"  class="td_1" style="vertical-align: top;width:450px;">
+            <table  data-url="<@base/>/roles/grid"
+                    id="datagrid"
+                        data-toggle="table"
+                        data-classes="table table-bordered table-hover table-striped"
+                        data-click-to-select="true"
+                        data-pagination="true"
+                        data-total-field="records"
+                        data-page-list="[10, 25, 50, 100]"
+                        data-search="false"
+                        data-single-select="true"
+                        data-locale="zh-CN"
+                        data-query-params="dataGridQueryParams"
+                        data-query-params-type="pageSize"
+                        data-side-pagination="server">
+                <thead>
+                    <tr>
+                        <th data-checkbox="true"></th>
+                        <th data-sortable="true" data-field="id"   data-visible="false">Id</th>
+                        <th data-field="name"><@locale code="role.name"/></th>
+                        <th data-field="description"><@locale code="common.text.description"/></th>
+            
+                    </tr>
+                </thead>
+            </table>
+      </td>
+      <td  valign="top"  class="td_1" style="vertical-align: top;">
+        <div id="resourcesTree" class="ztree"></div>
+	 </td>
+       </tr>
+    </table>
+	
+</div>
+					</div>
+	<footer class="content-footer">
+		<#include  "../layout/footer.ftl"/>
+	</footer>
+
+	</div>
+	
+	</div>
+</div>
+
+<div id="preloader">
+<div class="loader" id="loader-1"></div>
+</div>
+
+</body>
+</html>

+ 85 - 0
maxkey-web-manage/src/main/resources/templates/views/resources/resourceAdd.ftl

@@ -0,0 +1,85 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+<style   type="text/css">
+  .table th, .table td {
+    padding: .2rem;
+    vertical-align: middle;
+  }
+</style>
+
+<script type="text/javascript"> 
+$(function () {
+    $("#appId").val($.cookie("select_app_id"));
+    $("#pid").val($.cookie("select_res_id"));
+    $("#pname").val($.cookie("select_res_name"));
+});
+</script>
+</head>
+<body>
+<form id="actionForm"  method="post" type="label" autoclose="true"  action="<@base/>/resources/add"  class="needs-validation" novalidate>
+	<table border="0" cellpadding="0" cellspacing="0" class="table table-bordered" >
+		<tbody>
+			<tr>
+				<th><@locale code="resource.name" />:</th>
+				<td nowrap>
+					<input type="text" id="name" name="name" class="form-control" title="" value=""  required="" />
+				</td>
+			</tr>
+			 <tr>
+                <th><@locale code="apps.id" />:</th>
+                <td nowrap>
+                    <input type="text" id="appId" name="appId" class="form-control" title="" value=""  required="" />
+                </td>
+            </tr>
+			<tr>
+                <th><@locale code="resource.pid" />:</th>
+                <td nowrap>
+                    <input type="text" id="pid" name="pid" class="form-control" title="" value=""  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="resource.pname" />:</th>
+                <td nowrap>
+                    <input type="text" id="pname" name="pname" class="form-control" title="" value=""  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="resource.resType" />:</th>
+                <td nowrap>
+                    <input type="text" id="resType" name="resType" class="form-control" title="" value=""  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="resource.resUrl" />:</th>
+                <td nowrap>
+                    <input type="text" id="resUrl" name="resUrl" class="form-control" title="" value=""  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="resource.resAction" />:</th>
+                <td nowrap>
+                    <input type="text" id="resAction" name="resAction" class="form-control" title="" value=""  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="common.text.description" />:</th>
+                <td nowrap>
+                    <input type="text" id="description" name="description" class="form-control" title="" value=""  />
+                </td>
+            </tr>
+			<tr>
+				<td nowrap colspan="2" class="center">
+					<input id="_method" type="hidden" name="_method"  value="post"/>
+					<input  id="status" type="hidden" name="status"  value="1"/>
+		    		<input class="button btn btn-primary mr-3"  id="submitBtn" type="submit" value="<@locale code="button.text.save" />">
+	  				<input class="button btn btn-secondary mr-3"  id="closeBtn"   type="button" value="<@locale code="button.text.cancel" />"> 
+				</td>
+			</tr>
+		</tbody>
+	</table>
+</form>
+</body>
+</html>

+ 83 - 0
maxkey-web-manage/src/main/resources/templates/views/resources/resourceUpdate.ftl

@@ -0,0 +1,83 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+<style   type="text/css">
+  .table th, .table td {
+    padding: .2rem;
+    vertical-align: middle;
+  }
+</style>
+</head>
+<body>
+<form id="actionForm"  method="post" type="label" autoclose="true"  action="<@base/>/resources/update"  class="needs-validation" novalidate>
+	 <table  border="0" cellpadding="0" cellspacing="0" class="table table-bordered">
+		<tbody>
+		<tr style="display:none1">
+			<th><@locale code="resource.id" />:</th>
+			<td nowrap>
+				<input id="id" type="text" readonly name="id"  class="form-control"   value="${model.id}"/>
+			</td>
+		</tr>
+		<tr>
+			<th><@locale code="resource.name" />:</th>
+			<td nowrap>
+				<input type="text" id="name" name="name" class="form-control" title="" value="${model.name}"  required="" />
+			</td>
+		</tr>
+		<tr>
+                <th><@locale code="resource.pid" />:</th>
+                <td nowrap>
+                    <input type="text" id="pid" name="pid" class="form-control" title="" value="${model.pid!}"  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="apps.id" />:</th>
+                <td nowrap>
+                    <input type="text" id="appId" name="appId" class="form-control" title="" value="${model.appId!}"  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="resource.pname" />:</th>
+                <td nowrap>
+                    <input type="text" id="pname" name="pname" class="form-control" title="" value="${model.pname!}"  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="resource.resType" />:</th>
+                <td nowrap>
+                    <input type="text" id="resType" name="resType" class="form-control" title="" value="${model.resType!}"  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="resource.resUrl" />:</th>
+                <td nowrap>
+                    <input type="text" id="resUrl" name="resUrl" class="form-control" title="" value="${model.resUrl!}"  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="resource.resAction" />:</th>
+                <td nowrap>
+                    <input type="text" id="resAction" name="resAction" class="form-control" title="" value="${model.resAction!}"  required="" />
+                </td>
+            </tr>
+            <tr>
+                <th><@locale code="common.text.description" />:</th>
+                <td nowrap>
+                    <input type="text" id="description" name="description" class="form-control" title="" value="${model.description!}"  />
+                </td>
+            </tr>
+		<tr>
+			<td nowrap colspan="2"  class="center">
+				<input id="_method" type="hidden" name="_method"  value="post"/>
+				<input id="status" type="hidden" name="status"  value="1"/>
+	    		<input class="button btn btn-primary mr-3"  id="submitBtn" type="submit" value="<@locale code="button.text.save" />">
+  				<input class="button btn btn-secondary mr-3"  id="closeBtn"   type="button" value="<@locale code="button.text.cancel" />">	 
+			</td>
+		</tr>
+		</tbody>
+	  </table>
+</form>
+</body>
+</html>

+ 268 - 0
maxkey-web-manage/src/main/resources/templates/views/resources/resourcesList.ftl

@@ -0,0 +1,268 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+<script type="text/javascript"> 
+
+function onClick (event, treeId, treeNode) {
+
+    $("#pid").val(treeNode.id);
+    $.cookie("select_res_id", treeNode.id, { path: '/' });
+    $.cookie("select_app_id", $("#appId").val(), { path: '/' });
+    $.cookie("select_res_name", treeNode.name,{ path: '/' });
+    $("#searchBtn").click();
+    
+     
+}
+
+
+$(function () {
+ $("#changTreeBtn").click(function(){
+        var treeSettings={
+            element  :  "resourcesTree",
+            rootId  :  "1",
+            checkbox  :  null,
+            onClick  :  onClick,
+            onDblClick  :  null,
+            url  :  "<@base/>/resources/tree/"
+        };
+            
+        function singlePath(newNode) {
+            if (newNode === curExpandNode) return;
+            if (curExpandNode && curExpandNode.open==true) {
+                var zTree = $.fn.zTree.getZTreeObj(treeSettings.element);
+                if (newNode.parentTId === curExpandNode.parentTId) {
+                    zTree.expandNode(curExpandNode, false);
+                } else {
+                    var newParents = [];
+                    while (newNode) {
+                        newNode = newNode.getParentNode();
+                        if (newNode === curExpandNode) {
+                            newParents = null;
+                            break;
+                        } else if (newNode) {
+                            newParents.push(newNode);
+                        }
+                    }
+                    if (newParents!=null) {
+                        var oldNode = curExpandNode;
+                        var oldParents = [];
+                        while (oldNode) {
+                            oldNode = oldNode.getParentNode();
+                            if (oldNode) {
+                                oldParents.push(oldNode);
+                            }
+                        }
+                        if (newParents.length>0) {
+                            for (var i = Math.min(newParents.length, oldParents.length)-1; i>=0; i--) {
+                                if (newParents[i] !== oldParents[i]) {
+                                    zTree.expandNode(oldParents[i], false);
+                                    break;
+                                }
+                            }
+                        } else {
+                            zTree.expandNode(oldParents[oldParents.length-1], false);
+                        }
+                    }
+                }
+            }
+            curExpandNode = newNode;
+        };
+
+
+        function beforeExpand(treeId, treeNode) {
+            var pNode = curExpandNode ? curExpandNode.getParentNode():null;
+            var treeNodeP = treeNode.parentTId ? treeNode.getParentNode():null;
+            var zTree = $.fn.zTree.getZTreeObj(""+treeSettings.element);
+            for(var i=0, l=!treeNodeP ? 0:treeNodeP.children.length; i<l; i++ ) {
+                if (treeNode !== treeNodeP.children[i]) {
+                    zTree.expandNode(treeNodeP.children[i], false);
+                }
+            }
+            while (pNode) {
+                if (pNode === treeNode) {
+                    break;
+                }
+                pNode = pNode.getParentNode();
+            }
+            if (!pNode) {
+                singlePath(treeNode);
+            }
+
+        };
+        
+        $.fn.zTree.init(
+                $("#"+treeSettings.element), //element
+                {//json object 
+                    check   :   {
+                        enable      :   treeSettings.checkbox
+                    },
+                    async   :   {
+                        enable      :   true,
+                        url         :   treeSettings.url,
+                        autoParam   :   ["id", "name=n", "level=lv"],
+                        otherParam  :   {
+                                            "otherParam":"zTreeAsyncTest",
+                                            id:treeSettings.rootId,
+                                            "appId":$("#appId").val(),
+                                            "appName":$("#appName").val(),
+                                            }
+                    },
+                    data            :   {
+                        simpleData  :   {
+                            enable  :   true
+                        }
+                    },
+                    callback: {
+                        onClick         :   treeSettings.onClick,
+                        onDblClick      :   treeSettings.onDblClick,
+                        beforeAsync     :   function(treeId, treeNode){
+                            $.loading();
+                        },
+                        onAsyncSuccess  :   function(event, treeId, treeNode, msg){
+                            $.unloading();
+                        },
+                        //beforeExpand  :   beforeExpand,
+                        onExpand        :   function onExpand(event, treeId, treeNode) {
+                            curExpandNode = treeNode;
+                        }
+                    }
+                }
+            );//end tree
+ }); 
+
+            
+});
+    </script>
+</head>
+<body> 
+<div class="app header-default side-nav-dark">
+<div class="layout">
+	<div class="header navbar">
+		<#include  "../layout/top.ftl"/>
+	</div>
+	
+	<div class="col-md-3 sidebar-nav side-nav" >
+ 		<#include  "../layout/sidenav.ftl"/>
+	</div>
+	<div class="page-container">
+	
+	<div class="main-content">
+		<div class="container-fluid">
+			<div class="breadcrumb-wrapper row">
+				<div class="col-12 col-lg-3 col-md-6">
+					<h4 class="page-title"><@locale code="navs.resources"/></h4>
+				</div>
+				<div class="col-12 col-lg-9 col-md-6">
+					<ol class="breadcrumb float-right">
+						<li><a href="<@base/>/main"><@locale code="navs.home"/></a></li>
+						<li class="active">/ <@locale code="navs.resources"/></li>
+					</ol>
+				</div>
+			</div>
+		</div>
+		<div class="container-fluid">
+			<div class="col-12 grid-margin">
+				<div class="card">
+					<div class="card-body">
+		
+			<table  class="table table-bordered">
+ 				<tr>
+		 			<td width="120px"><@locale code="apps.name"/>:</td>
+		 			<td width="450px">
+		 				<form id="basic_search_form">
+			 				<input class="form-control appId" id="appId" name="appId" value="" type="hidden"  >
+			 				<input class="form-control" id="pid" name="pid" value="" type="hidden"  >
+                            <input class="form-control appName"    style="width:200px;float: left;" value=""    id="appName" name="appName" type="text" >
+                            <input class="button btn btn-success mr-3 window" style="float: left;" id="selectBtn" type="button" value="<@locale code="button.text.select"/>" 
+                                    wurl="<@base/>/apps/select"
+                                    wwidth="700"
+                                    wheight="500"
+                                    target="window">
+			 				<input  class="button btn btn-primary mr-3"    id="changTreeBtn" type="button" size="50" value="<@locale code="button.text.search"/>">
+				 			<!--<input  class="button btn btn-secondary"  id="advancedSearchExpandBtn" type="button" size="50"  value="<@locale code="button.text.expandsearch"/>" expandValue="<@locale code="button.text.expandsearch"/>"  collapseValue="<@locale code="button.text.collapsesearch"/>">
+					 		-->
+					 		<input style="display:none"  class="button btn btn-primary mr-3"    id="searchBtn" type="button"/>
+					 	</form>
+		 			</td>
+		 			<td colspan="2">
+		 				<div id="tool_box_right" style="width:350px;">
+		 					 <input class="button btn btn-success mr-3" id="addBtn" type="button" value="<@locale code="button.text.add"/>" 
+						 		    wurl="<@base/>/resources/forwardAdd"
+						 		    wwidth="500"
+						 		    wheight="500"
+					 		    	target="window"/>	    	
+					 		    	
+					 	<input class="button btn btn-info mr-3 " id="modifyBtn" type="button" value="<@locale code="button.text.edit"/>" 
+					 				wurl="<@base/>/resources/forwardUpdate"
+					 				wwidth="500"
+						 		    wheight="500"
+					 		    	target="window"/> 
+					 		    	
+					 	<input class="button btn btn-danger mr-3 "  id="deleteBtn" type="button" value="<@locale code="button.text.delete"/>"
+					 				wurl="<@base/>/resources/delete" />
+						</div>
+		 			</td>
+		 		</tr>
+		 	</table>
+		
+		 		
+ 	</div>
+ 	
+ 	<div id="advanced_search">
+ 		<form id="advanced_search_form">
+	 		
+	 	</form>
+ 	</div>
+ 	 <table class="datatable"   width="100%" >
+   <tr>
+      <td valign="top"  class="td_1" style="vertical-align: top;width:400px;">
+        <div id="resourcesTree" class="ztree"></div>
+         
+      </td>
+      <td  valign="top"  class="td_1" style="vertical-align: top;">
+		<table  data-url="<@base/>/resources/grid"
+			id="datagrid"
+				data-toggle="table"
+				data-classes="table table-bordered table-hover table-striped"
+				data-click-to-select="true"
+				data-pagination="true"
+				data-total-field="records"
+				data-page-list="[10, 25, 50, 100]"
+				data-search="false"
+				data-locale="zh-CN"
+				data-query-params="dataGridQueryParams"
+				data-query-params-type="pageSize"
+				data-side-pagination="server">
+		<thead>
+			<tr>
+				<th data-checkbox="true"></th>
+				<th data-sortable="true" data-field="id"   data-visible="false">Id</th>
+				<th data-field="name"><@locale code="resource.name"/></th>
+				<th data-field="description"><@locale code="common.text.description"/></th>
+	
+			</tr>
+		</thead>
+	</table>
+	 </td>
+       </tr>
+    </table>
+	
+</div>
+					</div>
+	<footer class="content-footer">
+		<#include  "../layout/footer.ftl"/>
+	</footer>
+
+	</div>
+	
+	</div>
+</div>
+
+<div id="preloader">
+<div class="loader" id="loader-1"></div>
+</div>
+
+</body>
+</html>

+ 79 - 0
maxkey-web-manage/src/main/resources/templates/views/resources/selectResourcesList.ftl

@@ -0,0 +1,79 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+<style   type="text/css">
+  .table th, .table td {
+    padding: .2rem;
+    vertical-align: middle;
+  }
+</style>
+<script type="text/javascript">	
+	
+	$(function () {
+		$("#selectBtn").on("click",function(){
+			var seldata=$.dataGridSelRowsData("#datagrid"); 
+			console.log(seldata[0].id+" - "+seldata[0].name);
+			$(".groupId", window.parent.document).val(seldata[0].id);
+			$(".groupName", window.parent.document).val(seldata[0].name);
+			$.closeWindow();
+		 			
+		});
+	});
+</script>
+</head>
+<body>
+	<div id="tool_box">
+	 		<table   class="datatable">
+ 				<tr>
+		 			<td width="120px"><@locale code="group.name"/>:</td>
+		 			<td width="374px">
+		 				<form id="basic_search_form">
+				 			<input class="form-control" type="text" name="name" style ="width:150px;float: left;">
+				 			<input class="button btn btn-success mr-3"  id="searchBtn" type="button" size="50" value="<@locale code="button.text.search"/>">
+				 		</form>
+		 			</td>
+				 	<td colspan="2"> 
+					 	<div id="tool_box_right" style="width: auto;">
+							<input  class="button btn btn-primary mr-3"   id="selectBtn" type="button" value="<@locale code="button.text.select"/>" >
+						</div>
+				 	</td>
+				</tr>
+			
+			</table>
+ 	</div>
+ 	
+	<div class="mainwrap" id="main">
+		<table  data-url="<@base/>/resources/grid"
+			id="datagrid"
+				data-toggle="table"
+				data-classes="table table-bordered table-hover table-striped"
+				data-click-to-select="true"
+				data-pagination="true"
+				data-total-field="records"
+				data-page-list="[10, 25, 50, 100]"
+				data-search="false"
+				data-locale="zh-CN"
+				data-query-params="dataGridQueryParams"
+				data-query-params-type="pageSize"
+				data-side-pagination="server">
+		<thead>
+			<tr>
+				<th data-checkbox="true"></th>
+				<th data-sortable="true" data-field="id"   data-visible="false">Id</th>
+				<th data-field="name"><@locale code="group.name"/></th>
+				<th data-field="description"><@locale code="common.text.description"/></th>
+				<th data-field="createdBy"><@locale code="common.text.createdby"/></th>
+				<th data-field="createdDate"><@locale code="common.text.createddate"/></th>
+				<th data-field="modifiedBy"><@locale code="common.text.modifiedby"/></th>
+				<th data-field="modifiedDate"><@locale code="common.text.modifieddate"/></th>
+	
+			</tr>
+		</thead>
+	</table>
+			
+	</div>
+	
+</body>
+</html>

+ 42 - 0
maxkey-web-manage/src/main/resources/templates/views/roles/roleAdd.ftl

@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+<style   type="text/css">
+  .table th, .table td {
+    padding: .2rem;
+    vertical-align: middle;
+  }
+</style>
+</head>
+<body>
+<form id="actionForm"  method="post" type="label" autoclose="true"  action="<@base/>/roles/add"  class="needs-validation" novalidate>
+	<table border="0" cellpadding="0" cellspacing="0" class="table table-bordered" >
+		<tbody>
+			<tr>
+				<th><@locale code="role.name" />:</th>
+				<td nowrap>
+					<input type="text" id="name" name="name" class="form-control" title="" value=""  required="" />
+				</td>
+			</tr>
+			<tr>
+                <th><@locale code="common.text.description" />:</th>
+                <td nowrap>
+                    <input type="text" id="description" name="description" class="form-control" title="" value=""  />
+                </td>
+            </tr>
+			
+			<tr>
+				<td nowrap colspan="2" class="center">
+					<input id="_method" type="hidden" name="_method"  value="post"/>
+					<input  id="status" type="hidden" name="status"  value="1"/>
+		    		<input class="button btn btn-primary mr-3"  id="submitBtn" type="submit" value="<@locale code="button.text.save" />">
+	  				<input class="button btn btn-secondary mr-3"  id="closeBtn"   type="button" value="<@locale code="button.text.cancel" />"> 
+				</td>
+			</tr>
+		</tbody>
+	</table>
+</form>
+</body>
+</html>

+ 47 - 0
maxkey-web-manage/src/main/resources/templates/views/roles/roleUpdate.ftl

@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+<style   type="text/css">
+  .table th, .table td {
+    padding: .2rem;
+    vertical-align: middle;
+  }
+</style>
+</head>
+<body>
+<form id="actionForm"  method="post" type="label" autoclose="true"  action="<@base/>/roles/update"  class="needs-validation" novalidate>
+	 <table  border="0" cellpadding="0" cellspacing="0" class="table table-bordered">
+		<tbody>
+		<tr style="display:none1">
+			<th><@locale code="role.id" />:</th>
+			<td nowrap>
+				<input id="id" type="text" readonly name="id"  class="form-control"   value="${model.id}"/>
+			</td>
+		</tr>
+		<tr>
+			<th><@locale code="role.name" />:</th>
+			<td nowrap>
+				<input type="text" id="name" name="name" class="form-control" title="" value="${model.name!}"  required="" />
+			</td>
+		</tr>
+		<tr>
+                <th><@locale code="common.text.description" />:</th>
+                <td nowrap>
+                    <input type="text" id="description" name="description" class="form-control" title="" value="${model.description!}"  />
+                </td>
+            </tr>
+		<tr>
+			<td nowrap colspan="2"  class="center">
+				<input id="_method" type="hidden" name="_method"  value="post"/>
+				<input id="status" type="hidden" name="status"  value="1"/>
+	    		<input class="button btn btn-primary mr-3"  id="submitBtn" type="submit" value="<@locale code="button.text.save" />">
+  				<input class="button btn btn-secondary mr-3"  id="closeBtn"   type="button" value="<@locale code="button.text.cancel" />">	 
+			</td>
+		</tr>
+		</tbody>
+	  </table>
+</form>
+</body>
+</html>

+ 124 - 0
maxkey-web-manage/src/main/resources/templates/views/roles/rolesList.ftl

@@ -0,0 +1,124 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+
+</head>
+<body> 
+<div class="app header-default side-nav-dark">
+<div class="layout">
+	<div class="header navbar">
+		<#include  "../layout/top.ftl"/>
+	</div>
+	
+	<div class="col-md-3 sidebar-nav side-nav" >
+ 		<#include  "../layout/sidenav.ftl"/>
+	</div>
+	<div class="page-container">
+	
+	<div class="main-content">
+		<div class="container-fluid">
+			<div class="breadcrumb-wrapper row">
+				<div class="col-12 col-lg-3 col-md-6">
+					<h4 class="page-title"><@locale code="navs.roles"/></h4>
+				</div>
+				<div class="col-12 col-lg-9 col-md-6">
+					<ol class="breadcrumb float-right">
+						<li><a href="<@base/>/main"><@locale code="navs.home"/></a></li>
+						<li class="active">/ <@locale code="navs.roles"/></li>
+					</ol>
+				</div>
+			</div>
+		</div>
+		<div class="container-fluid">
+			<div class="col-12 grid-margin">
+				<div class="card">
+					<div class="card-body">
+		
+			<table  class="table table-bordered">
+ 				<tr>
+		 			<td width="120px"><@locale code="role.name"/>:</td>
+		 			<td width="375px">
+		 				<form id="basic_search_form">
+			 				<input class="form-control" type="text" name="name"  style ="width:150px;float:left;">
+			 				<input  class="button btn btn-primary mr-3"    id="searchBtn" type="button" size="50" value="<@locale code="button.text.search"/>">
+				 			<!--<input  class="button btn btn-secondary"  id="advancedSearchExpandBtn" type="button" size="50"  value="<@locale code="button.text.expandsearch"/>" expandValue="<@locale code="button.text.expandsearch"/>"  collapseValue="<@locale code="button.text.collapsesearch"/>">
+					 		-->
+					 	</form>
+		 			</td>
+		 			<td colspan="2">
+		 				<div id="tool_box_right">
+		 					 <input class="button btn btn-success mr-3" id="addBtn" type="button" value="<@locale code="button.text.add"/>" 
+						 		    wurl="<@base/>/roles/forwardAdd"
+						 		    wwidth="500"
+						 		    wheight="200"
+					 		    	target="window">	    	
+					 		    	
+					 	<input class="button btn btn-info mr-3 " id="modifyBtn" type="button" value="<@locale code="button.text.edit"/>" 
+					 				wurl="<@base/>/roles/forwardUpdate"
+					 				wwidth="500"
+						 		    wheight="200"
+					 		    	target="window"> 
+					 		    	
+					 	<input class="button btn btn-danger mr-3 "  id="deleteBtn" type="button" value="<@locale code="button.text.delete"/>"
+					 				wurl="<@base/>/roles/delete" />
+						</div>
+		 			</td>
+		 		</tr>
+		 	</table>
+		
+		 		
+ 	</div>
+ 	
+ 	<div id="advanced_search">
+ 		<form id="advanced_search_form">
+	 		
+	 	</form>
+ 	</div>
+		<table  data-url="<@base/>/roles/grid"
+			id="datagrid"
+				data-toggle="table"
+				data-classes="table table-bordered table-hover table-striped"
+				data-click-to-select="true"
+				data-pagination="true"
+				data-total-field="records"
+				data-page-list="[10, 25, 50, 100]"
+				data-search="false"
+				data-locale="zh-CN"
+				data-query-params="dataGridQueryParams"
+				data-query-params-type="pageSize"
+				data-side-pagination="server">
+		<thead>
+			<tr>
+				<th data-checkbox="true"></th>
+				<th data-sortable="true" data-field="id"   data-visible="false">Id</th>
+				<th data-field="name"><@locale code="role.name"/></th>
+				<th data-field="description"><@locale code="common.text.description"/></th>
+				<th data-field="createdBy"><@locale code="common.text.createdby"/></th>
+				<th data-field="createdDate"><@locale code="common.text.createddate"/></th>
+				<th data-field="modifiedBy"><@locale code="common.text.modifiedby"/></th>
+				<th data-field="modifiedDate"><@locale code="common.text.modifieddate"/></th>
+	
+			</tr>
+		</thead>
+	</table>
+	
+	
+</div>
+					</div>
+	<footer class="content-footer">
+		<#include  "../layout/footer.ftl"/>
+	</footer>
+
+	</div>
+	
+	</div>
+</div>
+
+<div id="preloader">
+<div class="loader" id="loader-1"></div>
+</div>
+
+</body>
+</html>

+ 79 - 0
maxkey-web-manage/src/main/resources/templates/views/roles/selectRolesList.ftl

@@ -0,0 +1,79 @@
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<#include  "../layout/header.ftl"/>
+	<#include  "../layout/common.cssjs.ftl"/>
+<style   type="text/css">
+  .table th, .table td {
+    padding: .2rem;
+    vertical-align: middle;
+  }
+</style>
+<script type="text/javascript">	
+	
+	$(function () {
+		$("#selectBtn").on("click",function(){
+			var seldata=$.dataGridSelRowsData("#datagrid"); 
+			console.log(seldata[0].id+" - "+seldata[0].name);
+			$(".roleId", window.parent.document).val(seldata[0].id);
+			$(".roleName", window.parent.document).val(seldata[0].name);
+			$.closeWindow();
+		 			
+		});
+	});
+</script>
+</head>
+<body>
+	<div id="tool_box">
+	 		<table   class="datatable">
+ 				<tr>
+		 			<td width="120px"><@locale code="role.name"/>:</td>
+		 			<td width="374px">
+		 				<form id="basic_search_form">
+				 			<input class="form-control" type="text" name="name" style ="width:150px;float: left;">
+				 			<input class="button btn btn-success mr-3"  id="searchBtn" type="button" size="50" value="<@locale code="button.text.search"/>">
+				 		</form>
+		 			</td>
+				 	<td colspan="2"> 
+					 	<div id="tool_box_right" style="width: auto;">
+							<input  class="button btn btn-primary mr-3"   id="selectBtn" type="button" value="<@locale code="button.text.select"/>" >
+						</div>
+				 	</td>
+				</tr>
+			
+			</table>
+ 	</div>
+ 	
+	<div class="mainwrap" id="main">
+		<table  data-url="<@base/>/roles/grid"
+			id="datagrid"
+				data-toggle="table"
+				data-classes="table table-bordered table-hover table-striped"
+				data-click-to-select="true"
+				data-pagination="true"
+				data-total-field="records"
+				data-page-list="[10, 25, 50, 100]"
+				data-search="false"
+				data-locale="zh-CN"
+				data-query-params="dataGridQueryParams"
+				data-query-params-type="pageSize"
+				data-side-pagination="server">
+		<thead>
+			<tr>
+				<th data-checkbox="true"></th>
+				<th data-sortable="true" data-field="id"   data-visible="false">Id</th>
+				<th data-field="name"><@locale code="role.name"/></th>
+				<th data-field="description"><@locale code="common.text.description"/></th>
+				<th data-field="createdBy"><@locale code="common.text.createdby"/></th>
+				<th data-field="createdDate"><@locale code="common.text.createddate"/></th>
+				<th data-field="modifiedBy"><@locale code="common.text.modifiedby"/></th>
+				<th data-field="modifiedDate"><@locale code="common.text.modifieddate"/></th>
+	
+			</tr>
+		</thead>
+	</table>
+			
+	</div>
+	
+</body>
+</html>

+ 7 - 7
maxkey-web-maxkey/src/main/webapp/WEB-INF/web.xml

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <web-app xmlns="http://java.sun.com/xml/ns/j2ee" 
-		 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">
-		 
+         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">
+         
    <display-name>MaxKey Single Sign On</display-name>
    <!-- webAppRootKey -->
    <context-param>