role manage

This commit is contained in:
shimingxy 2020-04-29 21:34:35 +08:00
parent fdbd749376
commit ddf99aa011
31 changed files with 2602 additions and 459 deletions

View File

@ -1,17 +1,14 @@
package org.maxkey.domain; package org.maxkey.domain;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import org.apache.mybatis.jpa.persistence.JpaBaseDomain; import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
/* /*
ID varchar(40) not null, ID varchar(40) not null,
UID varchar(40) null, UID varchar(40) null,
@ -24,10 +21,6 @@ import org.hibernate.validator.constraints.Length;
@Table(name = "ACCOUNTS") @Table(name = "ACCOUNTS")
public class Accounts extends JpaBaseDomain implements Serializable { public class Accounts extends JpaBaseDomain implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6829592256223630307L; private static final long serialVersionUID = 6829592256223630307L;
@Id @Id
@Column @Column
@ -54,7 +47,6 @@ public class Accounts extends JpaBaseDomain implements Serializable{
super(); super();
} }
public Accounts(String id) { public Accounts(String id) {
this.id = id; this.id = id;
} }
@ -64,108 +56,83 @@ public class Accounts extends JpaBaseDomain implements Serializable{
this.appId = appId; this.appId = appId;
} }
public Accounts(String uid, String appId, String password) { public Accounts(String uid, String appId, String password) {
this.uid = uid; this.uid = uid;
this.appId = appId; this.appId = appId;
this.relatedPassword = password; this.relatedPassword = password;
} }
public String getUid() { public String getUid() {
return uid; return uid;
} }
public void setUid(String uid) { public void setUid(String uid) {
this.uid = uid; this.uid = uid;
} }
public String getUsername() { public String getUsername() {
return username; return username;
} }
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
public String getDisplayName() { public String getDisplayName() {
return displayName; return displayName;
} }
public void setDisplayName(String displayName) { public void setDisplayName(String displayName) {
this.displayName = displayName; this.displayName = displayName;
} }
public String getAppId() { public String getAppId() {
return appId; return appId;
} }
public void setAppId(String appId) { public void setAppId(String appId) {
this.appId = appId; this.appId = appId;
} }
public String getAppName() { public String getAppName() {
return appName; return appName;
} }
public void setAppName(String appName) { public void setAppName(String appName) {
this.appName = appName; this.appName = appName;
} }
public String getRelatedUsername() { public String getRelatedUsername() {
return relatedUsername; return relatedUsername;
} }
public void setRelatedUsername(String relatedUsername) { public void setRelatedUsername(String relatedUsername) {
this.relatedUsername = relatedUsername; this.relatedUsername = relatedUsername;
} }
public String getRelatedPassword() { public String getRelatedPassword() {
return relatedPassword; return relatedPassword;
} }
public void setRelatedPassword(String relatedPassword) { public void setRelatedPassword(String relatedPassword) {
this.relatedPassword = relatedPassword; this.relatedPassword = relatedPassword;
} }
/**
* @return the id
*/
public String getId() { public String getId() {
return id; return id;
} }
/**
* @param id the id to set
*/
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
@Override @Override
public String toString() { public String toString() {
return "AppAccounts [uid=" + uid + ", username=" + username return "AppAccounts [uid=" + uid + ", username=" + username + ", displayName=" + displayName + ", appId="
+ ", displayName=" + displayName + ", appId=" + appId + appId + ", appName=" + appName + ", relatedUsername=" + relatedUsername + ", relatedPassword="
+ ", appName=" + appName + ", relatedUsername=" + relatedPassword + "]";
+ relatedUsername + ", relatedPassword=" + relatedPassword
+ "]";
} }
} }

View File

@ -1,22 +1,17 @@
package org.maxkey.domain; package org.maxkey.domain;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import org.apache.mybatis.jpa.persistence.JpaBaseDomain; import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
@Table(name = "GROUPS") @Table(name = "GROUPS")
public class Groups extends JpaBaseDomain implements Serializable { public class Groups extends JpaBaseDomain implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4660258495864814777L; private static final long serialVersionUID = 4660258495864814777L;
@Id @Id
@Column @Column
@ -41,12 +36,19 @@ public class Groups extends JpaBaseDomain implements Serializable{
@Column @Column
String status; String status;
public Groups() {} public Groups() {
}
public Groups(String id) { public Groups(String id) {
this.id = id; this.id = id;
} }
/**
* Groups.
* @param id String
* @param name String
* @param isdefault int
*/
public Groups(String id, String name, int isdefault) { public Groups(String id, String name, int isdefault) {
super(); super();
this.id = id; this.id = id;
@ -62,7 +64,6 @@ public class Groups extends JpaBaseDomain implements Serializable{
this.name = name; this.name = name;
} }
public String getId() { public String getId() {
return id; return id;
} }
@ -127,7 +128,9 @@ public class Groups extends JpaBaseDomain implements Serializable{
this.status = status; this.status = status;
} }
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see java.lang.Object#toString() * @see java.lang.Object#toString()
*/ */
@Override @Override
@ -135,6 +138,4 @@ public class Groups extends JpaBaseDomain implements Serializable{
return "Groups [name=" + name + ", isdefault=" + isdefault + "]"; return "Groups [name=" + name + ", isdefault=" + isdefault + "]";
} }
} }

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -1,30 +1,23 @@
package org.maxkey.domain; package org.maxkey.domain;
import java.io.Serializable; import java.io.Serializable;
import org.apache.mybatis.jpa.persistence.JpaBaseDomain; import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
/** /**
* Saml20Metadata.
* @author Crystal.Sea * @author Crystal.Sea
* *
*/ */
public class Saml20Metadata extends JpaBaseDomain implements Serializable { 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 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 orgName;
private String orgDisplayName; private String orgDisplayName;
@ -35,75 +28,90 @@ public class Saml20Metadata extends JpaBaseDomain implements Serializable{
private String surName; private String surName;
private String emailAddress; private String emailAddress;
private String telephoneNumber; private String telephoneNumber;
/**
*
*/
public Saml20Metadata() { public Saml20Metadata() {
super(); super();
} }
public String getOrgName() { public String getOrgName() {
return orgName; return orgName;
} }
public void setOrgName(String orgName) { public void setOrgName(String orgName) {
this.orgName = orgName; this.orgName = orgName;
} }
public String getOrgDisplayName() { public String getOrgDisplayName() {
return orgDisplayName; return orgDisplayName;
} }
public void setOrgDisplayName(String orgDisplayName) { public void setOrgDisplayName(String orgDisplayName) {
this.orgDisplayName = orgDisplayName; this.orgDisplayName = orgDisplayName;
} }
public String getOrgURL() { public String getOrgURL() {
return orgURL; return orgURL;
} }
public void setOrgURL(String orgURL) { public void setOrgURL(String orgURL) {
this.orgURL = orgURL; this.orgURL = orgURL;
} }
public String getContactType() { public String getContactType() {
return contactType; return contactType;
} }
public void setContactType(String contactType) { public void setContactType(String contactType) {
this.contactType = contactType; this.contactType = contactType;
} }
public String getCompany() { public String getCompany() {
return company; return company;
} }
public void setCompany(String company) { public void setCompany(String company) {
this.company = company; this.company = company;
} }
public String getGivenName() { public String getGivenName() {
return givenName; return givenName;
} }
public void setGivenName(String givenName) { public void setGivenName(String givenName) {
this.givenName = givenName; this.givenName = givenName;
} }
public String getSurName() { public String getSurName() {
return surName; return surName;
} }
public void setSurName(String surName) { public void setSurName(String surName) {
this.surName = surName; this.surName = surName;
} }
public String getEmailAddress() { public String getEmailAddress() {
return emailAddress; return emailAddress;
} }
public void setEmailAddress(String emailAddress) { public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress; this.emailAddress = emailAddress;
} }
public String getTelephoneNumber() { public String getTelephoneNumber() {
return telephoneNumber; return telephoneNumber;
} }
public void setTelephoneNumber(String telephoneNumber) { public void setTelephoneNumber(String telephoneNumber) {
this.telephoneNumber = telephoneNumber; this.telephoneNumber = telephoneNumber;
} }
@Override @Override
public String toString() { public String toString() {
return "Saml20Metadata [orgName=" + orgName + ", orgDisplayName=" return "Saml20Metadata [orgName=" + orgName + ", orgDisplayName=" + orgDisplayName + ", orgURL=" + orgURL
+ orgDisplayName + ", orgURL=" + orgURL + ", contactType=" + ", contactType=" + contactType + ", company=" + company + ", givenName=" + givenName + ", surName="
+ contactType + ", company=" + company + ", givenName=" + surName + ", emailAddress=" + emailAddress + ", telephoneNumber=" + telephoneNumber + "]";
+ givenName + ", surName=" + surName + ", emailAddress="
+ emailAddress + ", telephoneNumber=" + telephoneNumber + "]";
} }
} }

View File

@ -3,8 +3,8 @@ package org.maxkey.web.component;
import java.util.HashMap; import java.util.HashMap;
/** /**
* 数控件的节点 * 数控件的节点 使用HashMap<String,Object> attr存储节点数据.
* 使用HashMap<String,Object> attr存储节点数据 *
* @author Crystal.Sea * @author Crystal.Sea
* *
*/ */
@ -76,5 +76,4 @@ public class TreeNode {
this.attr = attr; this.attr = attr;
} }
} }

View File

@ -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> {
}

View File

@ -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);
}

View File

@ -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();
}
}

View File

@ -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);
}
}

View File

@ -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>

View File

@ -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>

View File

@ -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;
}
}

View File

@ -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();
}
}

View File

@ -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);
}
}
}

View File

@ -389,6 +389,14 @@ group.name=\u7528\u6237\u7EC4
role.id=\u89D2\u8272\u7F16\u7801 role.id=\u89D2\u8272\u7F16\u7801
role.name=\u89D2\u8272 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
account.username=\u7528\u6237\u540D account.username=\u7528\u6237\u540D
account.displayName=\u7528\u6237\u59D3\u540D account.displayName=\u7528\u6237\u59D3\u540D
@ -461,7 +469,7 @@ navs.apps=\u5E94\u7528\u7BA1\u7406
navs.accounts=\u8D26\u53F7\u7BA1\u7406 navs.accounts=\u8D26\u53F7\u7BA1\u7406
navs.groups=\u7EC4\u7BA1\u7406 navs.groups=\u7EC4\u7BA1\u7406
navs.groups.member=\u6210\u5458\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=\u914D\u7F6E\u7BA1\u7406
navs.conf.passwordpolicy=\u5BC6\u7801\u7B56\u7565 navs.conf.passwordpolicy=\u5BC6\u7801\u7B56\u7565
navs.audit=\u65E5\u5FD7\u5BA1\u8BA1 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.loginapps=\u8BBF\u95EE\u65E5\u5FD7
navs.audit.operate=\u64CD\u4F5C\u65E5\u5FD7 navs.audit.operate=\u64CD\u4F5C\u65E5\u5FD7
navs.roles=\u89D2\u8272\u7BA1\u7406 navs.roles=\u89D2\u8272\u7BA1\u7406
navs.role.permissions=\u89D2\u8272\u6743\u9650\u7BA1\u7406
navs.resources=\u8D44\u6E90\u7BA1\u7406

View File

@ -388,6 +388,14 @@ group.name=name
role.id=id role.id=id
role.name=name 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
account.username=username account.username=username
account.displayName=displayName account.displayName=displayName
@ -461,7 +469,7 @@ navs.apps=Apps
navs.accounts=Accounts navs.accounts=Accounts
navs.groups=Groups navs.groups=Groups
navs.groups.member=Groups Member navs.groups.member=Groups Member
navs.groups.privileges=Privileges navs.groups.privileges=Access Privileges
navs.conf=Conf navs.conf=Conf
navs.conf.passwordpolicy=PasswordPolicy navs.conf.passwordpolicy=PasswordPolicy
navs.audit=Audit navs.audit=Audit
@ -469,3 +477,5 @@ navs.audit.login=Login
navs.audit.loginapps=LoginApps navs.audit.loginapps=LoginApps
navs.audit.operate=Operate navs.audit.operate=Operate
navs.roles=Roles navs.roles=Roles
navs.role.permissions=Permissions
navs.resources=Resources

View File

@ -93,24 +93,10 @@
<tr> <tr>
<td width="120px"><@locale code="apps.name"/></td> <td width="120px"><@locale code="apps.name"/></td>
<td width="360px"> <td width="360px">
<input type="text" name="name" style ="width:150px"> <input class="form-control" type="text" name="name" style ="width:150px">
</td> </td>
<td width="120px"><@locale code="apps.protocol"/></td> <td width="120px"></td>
<td width="360px"> <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> </td>
</tr> </tr>
</table> </table>

View File

@ -47,6 +47,14 @@
e.preventDefault(); 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)}); $(".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)}); $(".datepicker").datetimepicker({timepicker:false,format:'Y-m-d',lang:'<@locale/>'.substring(0, 2)});

View File

@ -1,71 +1,88 @@
<div dir="rtl"> <div dir="rtl">
<ul class="metismenu" id="side-nav-menu" > <ul class="metismenu" id="side-nav-menu" >
<li> <li>
<a class="" href="<@base />/main/"> <a class="side-nav-menu" href="<@base />/main/">
<span class="fa fa-fw fa-github fa-lg"></span> <span class="fa fa-fw fa-github fa-lg"></span>
<@locale code="navs.home"/> <@locale code="navs.home"/>
</a> </a>
</li> </li>
<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> <span class="fa fa-fw fa-github fa-lg"></span>
<@locale code="navs.orgs"/> <@locale code="navs.orgs"/>
</a> </a>
</li> </li>
<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> <span class="fa fa-fw fa-github fa-lg"></span>
<@locale code="navs.users"/> <@locale code="navs.users"/>
</a> </a>
</li> </li>
<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> <span class="fa fa-fw fa-github fa-lg"></span>
<@locale code="navs.apps"/> <@locale code="navs.apps"/>
</a> </a>
</li> </li>
<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> <span class="fa fa-fw fa-github fa-lg"></span>
<@locale code="navs.accounts"/> <@locale code="navs.accounts"/>
</a> </a>
</li> </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> <span class="fa fa-fw fa-github fa-lg"></span>
<@locale code="navs.groups"/> <@locale code="navs.groups"/>
</a> </a>
<ul> <ul>
<li> <li>
<a href="<@base />/groups/list/"> <a class="side-nav-menu" href="<@base />/groups/list/">
<span class="fa fa-fw fa-code-fork"></span> <span class="fa fa-fw fa-code-fork"></span>
<@locale code="navs.groups"/> <@locale code="navs.groups"/>
</a> </a>
</li> </li>
<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> <span class="fa fa-fw fa-code-fork"></span>
<@locale code="navs.groups.member"/> <@locale code="navs.groups.member"/>
</a> </a>
</li> </li>
<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> <span class="fa fa-fw fa-code-fork"></span>
<@locale code="navs.groups.privileges"/> <@locale code="navs.groups.privileges"/>
</a> </a>
</li> </li>
</ul> </ul>
</li> </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> <span class="fa fa-fw fa-github fa-lg"></span>
<@locale code="navs.conf"/> <@locale code="navs.conf"/>
</a> </a>
<ul> <ul>
<li> <li>
<a href="<@base />/config/passwordpolicy/forward"> <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> <span class="fa fa-fw fa-code-fork"></span>
<@locale code="navs.conf.passwordpolicy"/> <@locale code="navs.conf.passwordpolicy"/>
</a> </a>
@ -73,25 +90,25 @@
</ul> </ul>
</li> </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> <span class="fa fa-fw fa-github fa-lg"></span>
<@locale code="navs.audit"/> <@locale code="navs.audit"/>
</a> </a>
<ul> <ul>
<li> <li>
<a href="<@base />/logs/loginHistoryList"> <a class="side-nav-menu" href="<@base />/logs/loginHistoryList/">
<span class="fa fa-fw fa-code-fork"></span> <span class="fa fa-fw fa-code-fork"></span>
<@locale code="navs.audit.login"/> <@locale code="navs.audit.login"/>
</a> </a>
</li> </li>
<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> <span class="fa fa-fw fa-code-fork"></span>
<@locale code="navs.audit.loginapps"/> <@locale code="navs.audit.loginapps"/>
</a> </a>
</li> </li>
<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> <span class="fa fa-fw fa-code-fork"></span>
<@locale code="navs.audit.operate"/> <@locale code="navs.audit.operate"/>
</a> </a>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>