mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-09 05:00:30 +08:00
feat: 分组添加访客权限
This commit is contained in:
parent
eef88fad8a
commit
9ec8aa73b8
@ -201,6 +201,7 @@ class MemberList extends Component {
|
||||
<Select value={ record.role+'-'+record.uid} className="select" onChange={this.changeUserRole}>
|
||||
<Option value={ 'owner-'+record.uid}>组长</Option>
|
||||
<Option value={'dev-'+record.uid}>开发者</Option>
|
||||
<Option value={'guest-'+record.uid}>访客</Option>
|
||||
</Select>
|
||||
<Popconfirm placement="topRight" title="你确定要删除吗? " onConfirm={this.deleteConfirm(record.uid)} okText="确定" cancelText="">
|
||||
<Button type="danger" icon="minus" className="btn-danger" />
|
||||
@ -213,6 +214,8 @@ class MemberList extends Component {
|
||||
return '组长';
|
||||
} else if (record.role === 'dev') {
|
||||
return '开发者';
|
||||
} else if (record.role === 'guest') {
|
||||
return '访客';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@ -222,6 +225,7 @@ class MemberList extends Component {
|
||||
let userinfo = this.state.userInfo;
|
||||
let ownerinfo = [];
|
||||
let devinfo = [];
|
||||
let guestinfo = [];
|
||||
for(let i = 0;i<userinfo.length;i++){
|
||||
if(userinfo[i].role === "owner"){
|
||||
ownerinfo.push(userinfo[i]);
|
||||
@ -229,8 +233,11 @@ class MemberList extends Component {
|
||||
if(userinfo[i].role === "dev"){
|
||||
devinfo.push(userinfo[i]);
|
||||
}
|
||||
if(userinfo[i].role === "guest"){
|
||||
guestinfo.push(userinfo[i]);
|
||||
}
|
||||
userinfo = [...ownerinfo,...devinfo];
|
||||
}
|
||||
userinfo = [...ownerinfo,...devinfo,...guestinfo];
|
||||
return (
|
||||
<div className="m-panel">
|
||||
<Modal
|
||||
@ -251,6 +258,7 @@ class MemberList extends Component {
|
||||
<Select size="large" defaultValue="dev" className="select" onChange={this.changeNewMemberRole}>
|
||||
<Option value="owner">组长</Option>
|
||||
<Option value="dev">开发者</Option>
|
||||
<Option value="guest">访客</Option>
|
||||
</Select>
|
||||
</Col>
|
||||
</Row>
|
||||
|
@ -127,7 +127,7 @@ class groupController extends baseController {
|
||||
* @foldnumber 10
|
||||
* @param {String} id 项目分组id
|
||||
* @param {String} member_uid 项目分组成员uid
|
||||
* @param {String} role 成员角色,owner or dev
|
||||
* @param {String} role 成员角色,owner or dev or guest
|
||||
* @returns {Object}
|
||||
* @example
|
||||
*/
|
||||
@ -145,7 +145,7 @@ class groupController extends baseController {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '分组id不能为空');
|
||||
}
|
||||
|
||||
params.role = params.role === 'owner' ? 'owner' : 'dev';
|
||||
params.role = ['owner', 'dev', 'guest'].find(v => v === params.role) || 'dev';
|
||||
|
||||
var check = await groupInst.checkMemberRepeat(params.id, params.member_uid);
|
||||
if (check > 0) {
|
||||
@ -197,7 +197,7 @@ class groupController extends baseController {
|
||||
return ctx.body = yapi.commons.resReturn(null, 405, '没有权限');
|
||||
}
|
||||
|
||||
params.role = params.role === 'owner' ? 'owner' : 'dev';
|
||||
params.role = ['owner', 'dev', 'guest'].find(v => v === params.role) || 'dev';
|
||||
|
||||
try {
|
||||
let result = await groupInst.changeMemberRole(params.id, params.member_uid, params.role);
|
||||
|
Loading…
Reference in New Issue
Block a user