Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Bosn committed Feb 3, 2016
2 parents 4d9647d + aa8b6ae commit 8578386
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 15 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ RAP通过GUI工具帮助WEB工程师更高效的管理接口文档,同时通

<img src="http://gtms04.alicdn.com/tps/i4/TB19tgUKVXXXXXAXXXXAhCB5VXX-1222-646.png" width="600" />

### Architect
* Hibernate5 + Spring4 + Struts2
* MySQL
* Redis
* Velocity

### Why we use RAP?
* Enterprise level application. More than 350+ corporations including Alibaba Group are using RAP to manage their important API Docs!
Expand Down Expand Up @@ -43,6 +38,12 @@ RAP通过GUI工具帮助WEB工程师更高效的管理接口文档,同时通
* 我想快速上手RAP使用方法 => [视频教程](http://thx.github.io/RAP/study.html)
* 我要反馈问题 => [Issues](http://github.com/thx/RAP/issues)

### Architect
* Framework: Hibernate5 + Spring4 + Struts2
* Store: MySQL5 + Redis3
* Front End: Velocity + jQuery + qUnit
* Deploy: Tomcat + Docker
* CI: Travis

## 订阅RAP更新?

Expand All @@ -51,7 +52,7 @@ RAP通过GUI工具帮助WEB工程师更高效的管理接口文档,同时通

## About

@version v0.14.0 (in development)
@version v0.14.1
@author @bosn @wangjeaf
@director @limu @xinglie
@update Oct. 13th 2015
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>groupId</groupId>
<artifactId>RAP</artifactId>
<version>0.14.0-SNAPSHOT</version>
<version>0.14.1-SNAPSHOT</version>
<packaging>war</packaging>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,12 @@ public int getTeamIdByProjectId(int id) {

Query query = currentSession().createSQLQuery(sql.toString());
query.setInteger("id", id);
return (Integer) query.uniqueResult();
Object resultObj = query.uniqueResult();
if (resultObj == null) {
return 0;
} else {
return (Integer) resultObj;
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,12 @@ public interface OrganizationMgr {
*/
int getActionNumOfCorporation(int corpId);

/**
* as titles
*
* @param curUserId
* @param plId
* @return
*/
boolean canUserManageProductionLineList(int curUserId, int plId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,15 @@ public boolean canUserManageProject(int userId, int projectId) {

User user = accountMgr.getUser(userId);
boolean canAccess = false;
int corpId = organizationDao.getTeamIdByProjectId(projectId);
int roleId = organizationDao.getUserRoleInCorp(userId, corpId);
Project project = projectMgr.getProjectSummary(projectId);
if (user.isUserInRole("admin")) {
canAccess = true;
} else if (project.getUserId() == userId) {
canAccess = true;
} else if (Role.isAdmin(roleId)) {
canAccess = true;
} else {
List<Integer> memberIdList = projectMgr.getMemberIdsOfProject(projectId);
if (memberIdList != null) {
Expand Down Expand Up @@ -290,7 +294,7 @@ public boolean canUserAccessProductionLine(int userId, int plId) {
public boolean canUserManageProductionLine(int userId, int plId) {
ProductionLine pl = this.getProductionLine(plId);
int corpId = pl.getCorporationId();
return canUserManageCorp(userId, corpId);
return canUserManageProductionLineList(userId, corpId);
}


Expand Down Expand Up @@ -417,4 +421,12 @@ public int getProjectNumOfCorporation(int corpId) {
public int getActionNumOfCorporation(int corpId) {
return organizationDao.getActionNumOfCorporation(corpId);
}

public boolean canUserManageProductionLineList(int userId, int corpId) {
if (canUserManageCorp(userId, corpId)) {
return true;
}
Corporation c = getCorporation(corpId);
return c.getAccessType() == Corporation.PUBLIC_ACCESS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public String create() {
plsLogin();
return JSON_ERROR;
}
if (!organizationMgr.canUserManageCorp(getCurUserId(), corpId)) {
if (!organizationMgr.canUserManageProductionLineList(getCurUserId(), corpId)) {
setErrMsg(ACCESS_DENY);
return JSON_ERROR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,16 @@ public String create() {
item.indexOf("(")).trim() : item.trim();
if (!account.equals("")) {
memberAccountList.add(account);
organizationMgr.addTeamMembers(getCurUserId(), organizationMgr.getTeamIdByProjectId(project.getId()), account);
}
}
project.setMemberAccountList(memberAccountList);
int projectId = projectMgr.addProject(project);
project = projectMgr.getProject(projectId);

for (String account : memberAccountList) {
organizationMgr.addTeamMembers(getCurUserId(), organizationMgr.getTeamIdByProjectId(project.getId()), account);
}

Map<String, Object> result = new HashMap<String, Object>();
result.put("id", project.getId());
result.put("name", project.getName());
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/org/home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ $(function () {
}
var text = $(this).find('[value=' + plId + ']').text();
fillSelectAsync('org.home.grouplist', {
productLineId: plId
productlineId: plId
}, $('#option-list-tmpl').text(), '.project-target .group', function () {
showCreateGroupBtn(plId, text);
});
Expand Down Expand Up @@ -321,7 +321,7 @@ $(function () {
}
var modal = $(this);
$.post($.route('org.group.create'), {
productLineId: PL_ID,
productlineId: PL_ID,
name: inputer.val().trim()
}, function (data) {
var groups = data.groups;
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/org/home/index.vm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
{{/users}}
<input class="form-control accounts-inputer" placeholder="添加项目成员"/>
<span class="user-loading">项目成员列表加载中,请稍候~ </span>
<span class="glyphicon glyphicon-question-sign tip" title="如果该用户没有登录/注册过RAP,系统中就没有TA的信息。请TA先登录一下RAP吧。匹配时请可以输入TA的花名或帐号(域帐号)">找不到TA?</span>
<span class="glyphicon glyphicon-question-sign tip" title="公开团队RAP系统所有用户都可以搜到,如果是一般的私有团队,必须是团队成员才可以加入到项目成员里.如果找不到,请叫团队的管理员,先将该用户添加为团队成员.">找不到TA?</span>
<div class="accounts-con"></div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/tcom/template.rap.vm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><i class="iconlogo mi-rap"></i> <span class="logo-text"><span id="rap-logo-text">RAP</span> v0.<span
style="">14.0</span><span
style="">14.<span style="color:#999;">1</span></span><span
style="color:#cc0000;font-size:10px;">&nbsp;&nbsp;beta</span></span></a>
</div>
<div class="collapse navbar-collapse" id="global-navbar">
Expand Down

0 comments on commit 8578386

Please sign in to comment.