mirror of https://github.com/Rekoe/rk_svnadmin
添加 项目删除功能
parent
1facf6a74a
commit
a48459a10f
|
@ -23,9 +23,11 @@ import com.rekoe.common.Message;
|
||||||
import com.rekoe.common.page.Pagination;
|
import com.rekoe.common.page.Pagination;
|
||||||
import com.rekoe.domain.Pj;
|
import com.rekoe.domain.Pj;
|
||||||
import com.rekoe.domain.PjAuth;
|
import com.rekoe.domain.PjAuth;
|
||||||
|
import com.rekoe.domain.ProjectConfig;
|
||||||
import com.rekoe.module.BaseAction;
|
import com.rekoe.module.BaseAction;
|
||||||
import com.rekoe.service.DefaultTreeService;
|
import com.rekoe.service.DefaultTreeService;
|
||||||
import com.rekoe.service.ProjectAuthService;
|
import com.rekoe.service.ProjectAuthService;
|
||||||
|
import com.rekoe.service.ProjectConfigService;
|
||||||
import com.rekoe.service.ProjectGroupService;
|
import com.rekoe.service.ProjectGroupService;
|
||||||
import com.rekoe.service.ProjectService;
|
import com.rekoe.service.ProjectService;
|
||||||
import com.rekoe.service.RepositoryService;
|
import com.rekoe.service.RepositoryService;
|
||||||
|
@ -154,6 +156,19 @@ public class AdminProjectAct extends BaseAction {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("json")
|
||||||
|
@RequiresPermissions({ "svn.project:auth.manager" })
|
||||||
|
@PermissionTag(name = "管理项目权限", tag = "SVN项目管理", enable = false)
|
||||||
|
public Message delete(@Param("id") String id, HttpServletRequest req) {
|
||||||
|
try {
|
||||||
|
projectService.delete(id);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Message.error(e.getMessage(), req);
|
||||||
|
}
|
||||||
|
return Message.success("ok", req);
|
||||||
|
}
|
||||||
|
|
||||||
@At("/pjauth/delete")
|
@At("/pjauth/delete")
|
||||||
@Ok("fm:template.admin.project.pjauth")
|
@Ok("fm:template.admin.project.pjauth")
|
||||||
@RequiresPermissions({ "svn.project:auth.manager" })
|
@RequiresPermissions({ "svn.project:auth.manager" })
|
||||||
|
@ -166,4 +181,27 @@ public class AdminProjectAct extends BaseAction {
|
||||||
}
|
}
|
||||||
return pjauth(pj, res, Mvcs.getReq());
|
return pjauth(pj, res, Mvcs.getReq());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ProjectConfigService projectConfigService;
|
||||||
|
|
||||||
|
@At
|
||||||
|
@Ok("fm:template.admin.project.config")
|
||||||
|
@RequiresPermissions({ "svn.project:conf" })
|
||||||
|
@PermissionTag(name = "配置管理", tag = "SVN项目管理", enable = true)
|
||||||
|
public ProjectConfig conf() {
|
||||||
|
return projectConfigService.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@At("/conf/update")
|
||||||
|
@Ok("json")
|
||||||
|
@RequiresPermissions({ "svn.project:conf" })
|
||||||
|
@PermissionTag(name = "配置管理", tag = "SVN项目管理", enable = false)
|
||||||
|
public Message conf_update(@Param("::conf.") ProjectConfig conf, HttpServletRequest req) {
|
||||||
|
boolean isRight = projectConfigService.update(conf.getRepositoryPath(), conf.getDomainPath());
|
||||||
|
if (isRight) {
|
||||||
|
return Message.success("ok", req);
|
||||||
|
}
|
||||||
|
return Message.error("erroe", req);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,4 +362,19 @@ public class ProjectAuthService extends BaseService<PjAuth> {
|
||||||
dao().execute(sql);
|
dao().execute(sql);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目 资源的权限
|
||||||
|
*
|
||||||
|
* @param pj
|
||||||
|
* 项目
|
||||||
|
*/
|
||||||
|
public void deletePj(String pj) {
|
||||||
|
Sql sql = Sqls.create("delete from pj_gr_auth $condition");
|
||||||
|
sql.setCondition(Cnd.where("pj", "=", pj));
|
||||||
|
dao().execute(sql);
|
||||||
|
sql = Sqls.create("delete from pj_usr_auth $condition");
|
||||||
|
sql.setCondition(Cnd.where("pj", "=", pj));
|
||||||
|
dao().execute(sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,4 +66,16 @@ public class ProjectGroupService extends BaseService<PjGr> {
|
||||||
result.setDes(rs.getString("des"));
|
result.setDes(rs.getString("des"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @param pj
|
||||||
|
* 项目
|
||||||
|
*/
|
||||||
|
public void deletePj(String pj) {
|
||||||
|
Sql sql = Sqls.create("delete from pj_gr $condition");
|
||||||
|
sql.setCondition(Cnd.where("pj", "=", pj));
|
||||||
|
dao().execute(sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,10 @@ package com.rekoe.service;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
|
import org.nutz.ioc.aop.Aop;
|
||||||
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.lang.Lang;
|
import org.nutz.lang.Lang;
|
||||||
|
@ -121,7 +123,9 @@ public class ProjectService extends BaseService<Pj> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取项目的相对根路径.例如项目的path=e:/svn/projar,则返回projar。如果path为空,则返回项目ID
|
* 获取项目的相对根路径.例如项目的path=e:/svn/projar,则返回projar。如果path为空,则返回项目ID
|
||||||
* @param pj 项目id
|
*
|
||||||
|
* @param pj
|
||||||
|
* 项目id
|
||||||
* @return 项目的相对根路径
|
* @return 项目的相对根路径
|
||||||
* @since 3.0.3
|
* @since 3.0.3
|
||||||
*/
|
*/
|
||||||
|
@ -132,9 +136,12 @@ public class ProjectService extends BaseService<Pj> {
|
||||||
}
|
}
|
||||||
return getRelateRootPath(pj);
|
return getRelateRootPath(pj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取项目的相对根路径.例如项目的path=e:/svn/projar,则返回projar。如果path为空,则返回项目ID
|
* 获取项目的相对根路径.例如项目的path=e:/svn/projar,则返回projar。如果path为空,则返回项目ID
|
||||||
* @param pj 项目
|
*
|
||||||
|
* @param pj
|
||||||
|
* 项目
|
||||||
* @return 项目的相对根路径
|
* @return 项目的相对根路径
|
||||||
* @since 3.0.3
|
* @since 3.0.3
|
||||||
*/
|
*/
|
||||||
|
@ -149,4 +156,22 @@ public class ProjectService extends BaseService<Pj> {
|
||||||
}
|
}
|
||||||
return StringUtils.substringAfterLast(path, "/");
|
return StringUtils.substringAfterLast(path, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ProjectGroupUsrService projectGroupUsrService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ProjectUserService projectUserService;
|
||||||
|
@Inject
|
||||||
|
private ProjectService projectService;
|
||||||
|
|
||||||
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
|
public void delete(String pj) {
|
||||||
|
projectAuthService.deletePj(pj);
|
||||||
|
projectGroupUsrService.deletePj(pj);
|
||||||
|
projectGroupService.deletePj(pj);
|
||||||
|
projectUserService.deletePj(pj);
|
||||||
|
svnService.exportConfig(pj);
|
||||||
|
projectService.delete(pj);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
|
@ -46,4 +47,16 @@ public class ProjectUserService extends BaseService<PjUsr> {
|
||||||
dao().execute(sql);
|
dao().execute(sql);
|
||||||
return sql.getObject(PjUsr.class);
|
return sql.getObject(PjUsr.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除这个项目的用户
|
||||||
|
*
|
||||||
|
* @param pj
|
||||||
|
* 项目
|
||||||
|
*/
|
||||||
|
public void deletePj(String pj) {
|
||||||
|
Sql sql = Sqls.create("delete from pj_usr $condition");// where pj = ?";
|
||||||
|
sql.setCondition(Cnd.where("pj", "=", pj));
|
||||||
|
dao().execute(sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ var ioc = {
|
||||||
"system_role", "system_user", "system_server",
|
"system_role", "system_user", "system_server",
|
||||||
" system_user_server", "system_user_role", "verify_server",
|
" system_user_server", "system_user_role", "verify_server",
|
||||||
"official_server", "server_history", "platform_user",
|
"official_server", "server_history", "platform_user",
|
||||||
"cdkey_category" ],
|
"cdkey_category", "project_config" ],
|
||||||
enableWhenTrans : false, // 事务作用域内不启用缓存,默认也是false
|
enableWhenTrans : false, // 事务作用域内不启用缓存,默认也是false
|
||||||
db : "MYSQL"
|
db : "MYSQL"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||||
|
<title></title>
|
||||||
|
<#include "/template/admin/head.ftl"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="box-positon">
|
||||||
|
<div class="rpos"><@s.m "global.position"/>: <@s.m "cmsAdminGlobal.function"/> - <@s.m "global.add"/></div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
||||||
|
<div class="body-box">
|
||||||
|
<@p.form id="jvForm" action="update" labelWidth="12" onsubmit="return false;">
|
||||||
|
<@p.hidden id="conf.id" name="conf.id" value='${obj.id}' />
|
||||||
|
<@p.text width="30" label="仓库路径" id="conf.repositoryPath" name="conf.repositoryPath" value="${obj.repositoryPath}" maxlength="100" class="required" required="true"/><@p.tr/>
|
||||||
|
<@p.text width="30" label="访问url" id="conf.domainPath" name="conf.domainPath" value="${obj.domainPath}" maxlength="100" class="required" required="true"/><@p.tr/>
|
||||||
|
<@p.td colspan="1"><@p.submit code="global.submit" onclick="Cms.updateAll('conf/update','conf.rk');"/> <@p.reset code="global.reset"/></@p.td><@p.tr/>
|
||||||
|
</@p.form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -18,8 +18,9 @@ h3{ padding:0; margin:0; font-weight:normal; font-size:12px;}
|
||||||
<#include "/template/admin/date.ftl"/>
|
<#include "/template/admin/date.ftl"/>
|
||||||
<ul class="w-lful">
|
<ul class="w-lful">
|
||||||
<li><a href="${base}/admin/server/right" target="rightFrame"><@s.m "global.admin.index"/></a></li>
|
<li><a href="${base}/admin/server/right" target="rightFrame"><@s.m "global.admin.index"/></a></li>
|
||||||
<@perm_chow perm="oauth.user">
|
<@perm_chow perm="svn.project">
|
||||||
<li><a href="${base}/admin/project/list.rk" target="rightFrame">项目列表</a></li>
|
<li><a href="${base}/admin/project/list.rk" target="rightFrame">项目列表</a></li>
|
||||||
|
<li><a href="${base}/admin/project/conf.rk" target="rightFrame">基本设置</a></li>
|
||||||
</@perm_chow>
|
</@perm_chow>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -140,3 +140,29 @@ Cms.update = function(id){
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cms.updateAll = function(url,back){
|
||||||
|
$.dialog({
|
||||||
|
type: "warn",
|
||||||
|
content: '确定要修改此记录?',
|
||||||
|
ok: 'Ok',
|
||||||
|
cancel: 'Cancel',
|
||||||
|
onOk: function() {
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: "POST",
|
||||||
|
data: $('#jvForm').serialize(),
|
||||||
|
dataType: "json",
|
||||||
|
cache: false,
|
||||||
|
success: function(message) {
|
||||||
|
$.message(message);
|
||||||
|
if (message.type == "success")
|
||||||
|
{
|
||||||
|
window.location.href = back;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
Loading…
Reference in New Issue