feat: 支持任何人都可以添加分组,只有管理员才能修改项目是否公开

This commit is contained in:
hellosean1025 2018-10-12 16:30:03 +08:00 committed by gaoxiaolin.gao
parent 85235d6422
commit cdb3d3dd02
5 changed files with 23 additions and 19 deletions

View File

@ -191,10 +191,10 @@ class ProjectList extends Component {
<span className="radio-desc">只有组长和项目开发者可以索引并查看项目信息</span>
</Radio>
<br />
<Radio value="public" className="radio">
{/* <Radio value="public" className="radio">
<Icon type="unlock" />公开<br />
<span className="radio-desc">任何人都可以索引并查看项目信息</span>
</Radio>
</Radio> */}
</RadioGroup>
)}
</FormItem>

View File

@ -221,17 +221,12 @@ export default class GroupList extends Component {
<div className="curr-group">
<div className="curr-group-name">
<span className="name">{currGroup.group_name}</span>
{/* this.props.curUserRole === "admin" || this.props.curUserRoleInGroup === 'owner' ? (menu) : '' */}
{/* 只有超级管理员能添加分组 */
this.props.curUserRole === 'admin' ? (
<Tooltip title="添加分组">
<a className="editSet">
<Icon className="btn" type="folder-add" onClick={this.showModal} />
</a>
</Tooltip>
) : (
''
)}
<Tooltip title="添加分组">
<a className="editSet">
<Icon className="btn" type="folder-add" onClick={this.showModal} />
</a>
</Tooltip>
</div>
<div className="curr-group-desc">简介: {currGroup.group_desc}</div>
</div>

View File

@ -459,10 +459,11 @@ class ProjectMessage extends Component {
<span className="radio-desc">只有组长和项目开发者可以索引并查看项目信息</span>
</Radio>
<br />
<Radio value="public" className="radio">
{projectMsg.role === 'admin' && <Radio value="public" className="radio">
<Icon type="unlock" />公开<br />
<span className="radio-desc">任何人都可以索引并查看项目信息</span>
</Radio>
</Radio>}
</RadioGroup>
)}
</FormItem>

View File

@ -64,7 +64,7 @@
"mockjs": "1.0.1-beta3",
"moment": "^2.19.3",
"mongodb": "^3.1.8",
"mongoose": "^5.3.2",
"mongoose": "5.3.2",
"mongoose-auto-increment": "5.0.1",
"moox": "^1.0.2",
"nodemailer": "4.0.1",

View File

@ -125,12 +125,20 @@ class groupController extends baseController {
async add(ctx) {
let params = ctx.params;
if (this.getRole() !== 'admin') {
return (ctx.body = yapi.commons.resReturn(null, 401, '没有权限'));
}
// 新版每个人都有权限添加分组
// if (this.getRole() !== 'admin') {
// return (ctx.body = yapi.commons.resReturn(null, 401, '没有权限'));
// }
let owners = [];
if(params.owner_uids.length === 0){
params.owner_uids.push(
this.getUid()
)
}
if (params.owner_uids) {
for (let i = 0, len = params.owner_uids.length; i < len; i++) {
let id = params.owner_uids[i];