管理权限组

pull/3/head
rekoe 2016-05-06 14:08:29 +08:00
parent 5eeac83a9c
commit cc0f7185e8
9 changed files with 52 additions and 10 deletions

View File

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

View File

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

View File

@ -160,7 +160,9 @@ public class ProjectAuthService extends BaseService<PjAuth> {
*
*/
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);
}

View File

@ -183,7 +183,7 @@
<td>${pjAuth.gr!""}${pjAuth.usr!pjAuth.usrName}:(${pjAuth.usr})</td>
<td><#if "r"== pjAuth.rw>可读<#elseif "rw"== pjAuth.rw>可读可写<#else>没有权限</#if></td>
<@shiro.hasPermission name="svn.project:auth.manager">
<td><a href="javascript:if(confirm('确认删除?')){del('delete?pj=${pjAuth.pj}&res=${pjAuth.res}&gr=${pjAuth.gr}&usr=${pjAuth.usr}')}">删除</a></td>
<td><a href="javascript:if(confirm('确认删除?')){del('pjauth_delete?pj=${pjAuth.pj}&res=${pjAuth.res}&gr=${pjAuth.gr}&usr=${pjAuth.usr}')}">删除</a></td>
</@shiro.hasPermission>
</tr>
</#list>

View File

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<script src="${base}/resources/jquery-1.7.min.js" type="text/javascript"></script>
<span style="color:green;font-weight:bold;"><a href="${base}/pj">项目管理(${pj})</a> | 权限管理</span><br><br>
<span style="color:green;font-weight:bold;">项目管理(${pj}) | 权限管理</span><br><br>
<script type="text/javascript" src="${base}/resources/treeview/treeview.js"></script>
<link rel="stylesheet" href="${base}/resources/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="${base}/resources/treeview/treeview.css"></link>

View File

@ -14,6 +14,7 @@ $(function() {
<div class="box-positon">
<div class="rpos"><@s.m "global.position"/>: SVN项目组账号 - <@s.m "global.add"/></div>
<form class="ropt">
<input type="hidden" name="pj" id="pj" value="${obj}"/>
<input type="submit" value="<@s.m "global.backToList"/>" onclick="this.form.action='list.rk';" class="return-button"/>
</form>
<div class="clear"></div>

View File

@ -14,6 +14,7 @@ $(function() {
<div class="box-positon">
<div class="rpos"><@s.m "global.position"/>: OauthUser - <@s.m "global.edit"/></div>
<form class="ropt">
<input type="hidden" name="pj" id="pj" value="${obj.pj}"/>
<input type="submit" value="<@s.m "global.backToList"/>" onclick="this.form.action='list.rk';" class="return-button"/>
</form>
<div class="clear"></div>

View File

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

View File

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