mirror of https://github.com/Rekoe/rk_svnadmin
fix
parent
426967060f
commit
36ef3e88f3
|
@ -3,6 +3,7 @@ package com.rekoe.module.admin;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
|
@ -14,42 +15,44 @@ import com.rekoe.common.Message;
|
||||||
import com.rekoe.common.page.Pagination;
|
import com.rekoe.common.page.Pagination;
|
||||||
import com.rekoe.domain.Usr;
|
import com.rekoe.domain.Usr;
|
||||||
import com.rekoe.module.BaseAction;
|
import com.rekoe.module.BaseAction;
|
||||||
import com.rekoe.service.SvnUserService;
|
import com.rekoe.service.ProjectGroupService;
|
||||||
|
|
||||||
@IocBean
|
@IocBean
|
||||||
@At("/admin/svn/user")
|
@At("/admin/project/group")
|
||||||
public class AdminProjectGroupAct extends BaseAction {
|
public class AdminProjectGroupAct extends BaseAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SvnUserService svnUserService;
|
private ProjectGroupService projectGroupService;
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("fm:template.admin.svn_user.list")
|
@Ok("fm:template.admin.project_group.list")
|
||||||
@RequiresPermissions({ "svn.user:view" })
|
@RequiresPermissions({ "project.group:view" })
|
||||||
@PermissionTag(name = "SVN浏览账号", tag = "SVN账号管理")
|
@PermissionTag(name = "SVN浏览账号", tag = "SVN账号管理")
|
||||||
public Pagination list(@Param(value = "pageNumber", df = "1") int page) {
|
public Pagination list(@Param(value = "pageNumber", df = "1") int page, @Param("pj") String pj) {
|
||||||
return svnUserService.getObjListByPager(page, 20, null);
|
return projectGroupService.getObjListByPager(page, 20, Cnd.where("pj", "=", pj));
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("fm:template.admin.svn_user.add")
|
@Ok("fm:template.admin.project_group.add")
|
||||||
@RequiresPermissions({ "svn.user:add" })
|
@RequiresPermissions({ "project.group:add" })
|
||||||
@PermissionTag(name = "SVN添加账号", tag = "SVN账号管理", enable = true)
|
@PermissionTag(name = "添加项目用户组", tag = "SVN账号管理", enable = true)
|
||||||
public void add() {
|
public void add() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@Ok("json")
|
@Ok("json")
|
||||||
@RequiresPermissions("svn.user:add")
|
@RequiresPermissions("project.group:add")
|
||||||
@PermissionTag(name = "SVN添加账号", tag = "SVN账号管理", enable = false)
|
@PermissionTag(name = "添加项目用户组", tag = "SVN账号管理", enable = false)
|
||||||
public Message o_save(@Param("::user.") Usr user, HttpServletRequest req) {
|
public Message o_save(@Param("::group.") Usr group, HttpServletRequest req) {
|
||||||
boolean isOk = svnUserService.nameOk(user.getUsr());
|
|
||||||
if (isOk) {
|
|
||||||
isOk = svnUserService.insert(user);
|
|
||||||
}
|
|
||||||
if (isOk) {
|
|
||||||
return Message.success("ok", req);
|
|
||||||
}
|
|
||||||
return Message.error("error", req);
|
return Message.error("error", req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("json")
|
||||||
|
@RequiresPermissions("project.group:delete")
|
||||||
|
@PermissionTag(name = "删除项目用户组", tag = "SVN账号管理", enable = true)
|
||||||
|
public Message delete(@Param("pj") String pj, @Param("gr") String gr, HttpServletRequest req) {
|
||||||
|
projectGroupService.delete(pj, gr);
|
||||||
|
return Message.success("ok", req);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,4 +78,18 @@ public class ProjectGroupService extends BaseService<PjGr> {
|
||||||
sql.setCondition(Cnd.where("pj", "=", pj));
|
sql.setCondition(Cnd.where("pj", "=", pj));
|
||||||
dao().execute(sql);
|
dao().execute(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @param pj
|
||||||
|
* 项目
|
||||||
|
* @param gr
|
||||||
|
* 组
|
||||||
|
*/
|
||||||
|
public void delete(String pj, String gr) {
|
||||||
|
Sql sql = Sqls.create("delete from pj_gr");// where pj = ? and gr=?";
|
||||||
|
sql.setCondition(Cnd.where("pj", "=", pj).and("gr", "=", gr));
|
||||||
|
dao().execute(sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class SvnService {
|
||||||
}
|
}
|
||||||
File parent = new File(pj.getPath());
|
File parent = new File(pj.getPath());
|
||||||
if (!parent.exists() || !parent.isDirectory()) {
|
if (!parent.exists() || !parent.isDirectory()) {
|
||||||
throw new RuntimeException(String.format("找不到仓库 路径{0}", new Object[] { pj.getPath() }));
|
throw new RuntimeException(String.format("找不到仓库 路径 %s", pj.getPath()));
|
||||||
}
|
}
|
||||||
if (Constants.HTTP.equalsIgnoreCase(pj.getType())) {// HTTP(单库) SVNPath
|
if (Constants.HTTP.equalsIgnoreCase(pj.getType())) {// HTTP(单库) SVNPath
|
||||||
this.exportHTTP(pj);
|
this.exportHTTP(pj);
|
||||||
|
|
|
@ -21,18 +21,20 @@ function getTableForm() {
|
||||||
<div class="body-box">
|
<div class="body-box">
|
||||||
<@p.form id="tableForm" method="post">
|
<@p.form id="tableForm" method="post">
|
||||||
<@p.hidden name="pageNumber" value="${pageNo!}" />
|
<@p.hidden name="pageNumber" value="${pageNo!}" />
|
||||||
<@p.table value=obj;user,i,has_next><#rt/>
|
<@p.table value=obj;project,i,has_next><#rt/>
|
||||||
<@p.column title="ID" align="center">${i+1}</@p.column><#t/>
|
<@p.column title="ID" align="center">${i+1}</@p.column><#t/>
|
||||||
<@p.column title="姓名" align="center">${user.pj}</@p.column><#t/>
|
<@p.column title="姓名" align="center">${project.pj}</@p.column><#t/>
|
||||||
<@p.column title="路径" align="center">${user.path}</@p.column><#t/>
|
<@p.column title="路径" align="center">${project.path}</@p.column><#t/>
|
||||||
<@p.column title="URL" align="center"><a href="rep?pj=${user.pj}">${user.url}</a></@p.column><#t/>
|
<@p.column title="URL" align="center"><a href="rep?pj=${project.pj}">${project.url}</a></@p.column><#t/>
|
||||||
<@p.column title="类型" align="center">${user.type}</@p.column><#t/>
|
<@p.column title="类型" align="center">${project.type}</@p.column><#t/>
|
||||||
<@p.column title="描述" align="center">${user.des}</@p.column><#t/>
|
<@p.column title="描述" align="center">${project.des}</@p.column><#t/>
|
||||||
<@p.column title="设置用户组" align="center">设置用户组</@p.column><#t/>
|
<@shiro.hasPermission name="project.group">
|
||||||
<@p.column title="设置权限" align="center">设置权限</@p.column><#t/>
|
<@p.column title="设置用户组" align="center"><a href="${base}/admin/project/group/list?pj=${project.pj}">设置用户组</a></@p.column><#t/>
|
||||||
|
</@shiro.hasPermission>
|
||||||
|
<@p.column title="设置权限" align="center"><a href="rep?pj=${project.pj}">设置权限</a></@p.column><#t/>
|
||||||
<@shiro.hasPermission name="svn.project:auth.manager">
|
<@shiro.hasPermission name="svn.project:auth.manager">
|
||||||
<@p.column title="编辑" align="center">
|
<@p.column title="编辑" align="center">
|
||||||
<a href="javascript:void(0);" onclick="Cms.deleted('${user.pj}')" class="pn-opt">删除</a><#rt/>
|
<a href="javascript:void(0);" onclick="Cms.deleted('${project.pj}')" class="pn-opt">删除</a><#rt/>
|
||||||
</@p.column><#t/>
|
</@p.column><#t/>
|
||||||
</@shiro.hasPermission>
|
</@shiro.hasPermission>
|
||||||
</@p.table>
|
</@p.table>
|
||||||
|
|
|
@ -8,6 +8,31 @@
|
||||||
function getTableForm() {
|
function getTableForm() {
|
||||||
return document.getElementById('tableForm');
|
return document.getElementById('tableForm');
|
||||||
}
|
}
|
||||||
|
function deleted(pj,gr){
|
||||||
|
$.dialog({
|
||||||
|
type: "warn",
|
||||||
|
content: '确定要删除此记录?',
|
||||||
|
ok: 'Ok',
|
||||||
|
cancel: 'Cancel',
|
||||||
|
onOk: function() {
|
||||||
|
$.ajax({
|
||||||
|
url: "delete.rk",
|
||||||
|
type: "POST",
|
||||||
|
data: {"pj":pj,"gr":gr},
|
||||||
|
dataType: "json",
|
||||||
|
cache: false,
|
||||||
|
success: function(message) {
|
||||||
|
$.message(message);
|
||||||
|
if (message.type == "success")
|
||||||
|
{
|
||||||
|
window.location.href = back;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -21,14 +46,15 @@ function getTableForm() {
|
||||||
<div class="body-box">
|
<div class="body-box">
|
||||||
<@p.form id="tableForm" method="post">
|
<@p.form id="tableForm" method="post">
|
||||||
<@p.hidden name="pageNumber" value="${pageNo!}" />
|
<@p.hidden name="pageNumber" value="${pageNo!}" />
|
||||||
<@p.table value=obj;user,i,has_next><#rt/>
|
<@p.table value=obj;group,i,has_next><#rt/>
|
||||||
<@p.column title="ID" align="center">${i+1}</@p.column><#t/>
|
<@p.column title="ID" align="center">${i+1}</@p.column><#t/>
|
||||||
<@p.column title="姓名" align="center">${user.name}</@p.column><#t/>
|
<@p.column title="项目" align="center">${group.pj}</@p.column><#t/>
|
||||||
<@p.column title="名称" align="center">${user.usr}</@p.column><#t/>
|
<@p.column title="用户组" align="center">${group.gr}</@p.column><#t/>
|
||||||
<@p.column title="email" align="center">${user.email!}</@p.column><#t/>
|
<@p.column title="描述" align="center">${group.des!}</@p.column><#t/>
|
||||||
<@shiro.hasPermission name="svn.user:edit">
|
<@p.column title="设置用户" align="center">设置用户</@p.column><#t/>
|
||||||
<@p.column title="编辑" align="center">
|
<@shiro.hasPermission name="project.group:delete">
|
||||||
<a href="edit.rk?id=${user.usr}" class="pn-opt">编辑</a><#rt/>
|
<@p.column title="删除" align="center">
|
||||||
|
<#if group.gr != "manager"><a href="javascript:void(0);" onclick="deleted('${group.pj}','${group.gr}')" class="pn-opt">删除</a></#if><#rt/>
|
||||||
</@p.column><#t/>
|
</@p.column><#t/>
|
||||||
</@shiro.hasPermission>
|
</@shiro.hasPermission>
|
||||||
</@p.table>
|
</@p.table>
|
||||||
|
|
Loading…
Reference in New Issue