From cc0f7185e80f6008160bd08476d5101ae220011e Mon Sep 17 00:00:00 2001 From: rekoe Date: Fri, 6 May 2016 14:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=9D=83=E9=99=90=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rekoe/module/admin/AdminProjectAct.java | 23 ++++++++++++---- .../module/admin/AdminProjectGroupUsrAct.java | 1 - .../com/rekoe/service/ProjectAuthService.java | 4 ++- .../WEB-INF/template/admin/project/pjauth.ftl | 2 +- .../WEB-INF/template/admin/project/rep.ftl | 2 +- .../template/admin/project_group/add.ftl | 1 + .../template/admin/project_group/edit.ftl | 1 + .../template/admin/project_group/list.ftl | 2 +- src/main/webapp/res/cms/js/admin.js | 26 +++++++++++++++++++ 9 files changed, 52 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/rekoe/module/admin/AdminProjectAct.java b/src/main/java/com/rekoe/module/admin/AdminProjectAct.java index 7dd0e73..5bbda80 100644 --- a/src/main/java/com/rekoe/module/admin/AdminProjectAct.java +++ b/src/main/java/com/rekoe/module/admin/AdminProjectAct.java @@ -248,7 +248,7 @@ public class AdminProjectAct extends BaseAction { projectAuthService.save(pj, res, rw, grs, usrs); return pjauth(pj, res, entity, Mvcs.getReq()); } - + @At @Ok("fm:template.admin.project.add_dir") @RequiresPermissions("svn.project:update") @@ -256,16 +256,29 @@ public class AdminProjectAct extends BaseAction { public String file_add(@Param("pj") String pj) { return pj; } - + @Inject private DoCommit doCommit; - + @At @Ok("json") @RequiresPermissions("svn.project:update") @PermissionTag(name = "SVN编辑项目", tag = "SVN项目管理", enable = false) - public Message file_save(@Param("pj") String pj,@Param("file") String file, HttpServletRequest req) { - doCommit.mkdirs(pj, new String[]{file}); + public Message file_save(@Param("pj") String pj, @Param("file") String file, HttpServletRequest req) { + doCommit.mkdirs(pj, new String[] { file }); return Message.success("ok", req); } + + @At("/pjauth_delete") + @Ok("fm:template.admin.project.pjauth") + @RequiresPermissions("svn.project:auth.manager") + @PermissionTag(name = "SVN编辑项目", tag = "SVN项目管理", enable = false) + public String pjauth_delete(@Param("pj") String pj, @Param("gr") String gr, @Param("usr") String usr, @Param("res") String res, HttpServletRequest req) { + if (StringUtils.isNotBlank(gr)) { + projectAuthService.deleteByGr(pj, gr, res); + } else if (StringUtils.isNotBlank(usr)) { + projectAuthService.deleteByUsr(pj, usr, res); + } + return pjauth(pj, res, null, req); + } } diff --git a/src/main/java/com/rekoe/module/admin/AdminProjectGroupUsrAct.java b/src/main/java/com/rekoe/module/admin/AdminProjectGroupUsrAct.java index 27f7639..3bf0970 100644 --- a/src/main/java/com/rekoe/module/admin/AdminProjectGroupUsrAct.java +++ b/src/main/java/com/rekoe/module/admin/AdminProjectGroupUsrAct.java @@ -13,7 +13,6 @@ import org.nutz.aop.interceptor.async.Async; import org.nutz.dao.Cnd; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; -import org.nutz.json.Json; import org.nutz.lang.Lang; import org.nutz.log.Log; import org.nutz.log.Logs; diff --git a/src/main/java/com/rekoe/service/ProjectAuthService.java b/src/main/java/com/rekoe/service/ProjectAuthService.java index 6b4df33..0cfbdf3 100644 --- a/src/main/java/com/rekoe/service/ProjectAuthService.java +++ b/src/main/java/com/rekoe/service/ProjectAuthService.java @@ -160,7 +160,9 @@ public class ProjectAuthService extends BaseService { * 资源 */ public void deleteByUsr(String pj, String usr, String res) { - deleteByUsr(pj, usr, res); + Sql sql = Sqls.create("delete from pj_usr_auth $condition"); + sql.setCondition(Cnd.where("pj", "=", pj).and("usr", "=", usr).and("res", "=", res)); + dao().execute(sql); svnService.exportConfig(pj); } diff --git a/src/main/webapp/WEB-INF/template/admin/project/pjauth.ftl b/src/main/webapp/WEB-INF/template/admin/project/pjauth.ftl index 784a5f4..fdcee4f 100644 --- a/src/main/webapp/WEB-INF/template/admin/project/pjauth.ftl +++ b/src/main/webapp/WEB-INF/template/admin/project/pjauth.ftl @@ -183,7 +183,7 @@ ${pjAuth.gr!""}${pjAuth.usr!pjAuth.usrName}:(${pjAuth.usr}) <#if "r"== pjAuth.rw>可读<#elseif "rw"== pjAuth.rw>可读可写<#else>没有权限 <@shiro.hasPermission name="svn.project:auth.manager"> - 删除 + 删除 diff --git a/src/main/webapp/WEB-INF/template/admin/project/rep.ftl b/src/main/webapp/WEB-INF/template/admin/project/rep.ftl index 0197fda..131a87a 100644 --- a/src/main/webapp/WEB-INF/template/admin/project/rep.ftl +++ b/src/main/webapp/WEB-INF/template/admin/project/rep.ftl @@ -4,7 +4,7 @@ -项目管理(${pj}) | 权限管理

+项目管理(${pj}) | 权限管理

diff --git a/src/main/webapp/WEB-INF/template/admin/project_group/add.ftl b/src/main/webapp/WEB-INF/template/admin/project_group/add.ftl index ecc2b08..d2e083e 100644 --- a/src/main/webapp/WEB-INF/template/admin/project_group/add.ftl +++ b/src/main/webapp/WEB-INF/template/admin/project_group/add.ftl @@ -14,6 +14,7 @@ $(function() {
<@s.m "global.position"/>: SVN项目组账号 - <@s.m "global.add"/>
+ " onclick="this.form.action='list.rk';" class="return-button"/>
diff --git a/src/main/webapp/WEB-INF/template/admin/project_group/edit.ftl b/src/main/webapp/WEB-INF/template/admin/project_group/edit.ftl index 098dcf7..a8a22ba 100644 --- a/src/main/webapp/WEB-INF/template/admin/project_group/edit.ftl +++ b/src/main/webapp/WEB-INF/template/admin/project_group/edit.ftl @@ -14,6 +14,7 @@ $(function() {
<@s.m "global.position"/>: OauthUser - <@s.m "global.edit"/>
+ " onclick="this.form.action='list.rk';" class="return-button"/>
diff --git a/src/main/webapp/WEB-INF/template/admin/project_group/list.ftl b/src/main/webapp/WEB-INF/template/admin/project_group/list.ftl index e99becb..da3267f 100644 --- a/src/main/webapp/WEB-INF/template/admin/project_group/list.ftl +++ b/src/main/webapp/WEB-INF/template/admin/project_group/list.ftl @@ -25,7 +25,7 @@ function deleted(pj,gr){ $.message(message); if (message.type == "success") { - window.location.href = list.rk; + window.location.href = "list.rk?pj="+pj; } } }); diff --git a/src/main/webapp/res/cms/js/admin.js b/src/main/webapp/res/cms/js/admin.js index 4de212f..37a4e77 100644 --- a/src/main/webapp/res/cms/js/admin.js +++ b/src/main/webapp/res/cms/js/admin.js @@ -215,4 +215,30 @@ Cms.deleted = function(id){ } }); return false; +} + +Cms.deletedByAction = function(id,action){ + $.dialog({ + type: "warn", + content: '确定要删除此记录?', + ok: 'Ok', + cancel: 'Cancel', + onOk: function() { + $.ajax({ + url: "delete.rk", + type: "POST", + data: {"id":id}, + dataType: "json", + cache: false, + success: function(message) { + $.message(message); + if (message.type == "success") + { + window.location.href = action; + } + } + }); + } + }); + return false; } \ No newline at end of file