Merge pull request #2337 from loadchange/develop_1.2.0

fix: repair resource
This commit is contained in:
Peter Zhu 2020-02-04 08:45:29 +08:00 committed by GitHub
commit fe45fa687f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 2246 additions and 1496 deletions

View File

@ -570,6 +570,9 @@ const I18N_CONF = {
operation: 'Operation',
deletePermission: 'Delete',
deletePermissionTip: 'Do you want to delete this permission?',
readOnly: 'read only',
writeOnly: 'write only',
readWrite: 'Read and write',
},
NewPermissions: {
addPermission: 'Add Permission',

View File

@ -567,6 +567,9 @@ const I18N_CONF = {
operation: '操作',
deletePermission: '删除',
deletePermissionTip: '是否要删除该权限',
readOnly: '只读',
writeOnly: '只写',
readWrite: '读写',
},
NewPermissions: {
addPermission: '添加权限',

View File

@ -62,6 +62,15 @@ class PermissionsManagement extends React.Component {
this.setState({ createPermissionVisible: false });
}
getActionText(action) {
const { locale } = this.props;
return {
r: `${locale.readOnly} (r)`,
w: `${locale.writeOnly} (w)`,
rw: `${locale.readWrite} (rw)`,
}[action];
}
render() {
const { permissions, locale } = this.props;
const { loading, pageSize, pageNo, createPermissionVisible } = this.state;
@ -76,7 +85,11 @@ class PermissionsManagement extends React.Component {
<Table dataSource={permissions.pageItems} loading={loading} maxBodyHeight={476} fixedHeader>
<Table.Column title={locale.role} dataIndex="role" />
<Table.Column title={locale.resource} dataIndex="resource" />
<Table.Column title={locale.action} dataIndex="action" />
<Table.Column
title={locale.action}
dataIndex="action"
cell={action => this.getActionText(action)}
/>
<Table.Column
title={locale.operation}
cell={(value, index, record) => (

View File

@ -107,7 +107,9 @@ const getPermissions = params => dispatch =>
* @param {*} param0
*/
const createPermission = ([role, resource, action]) =>
request.post('v1/auth/permissions', { role, resource, action }).then(res => successMsg(res));
request
.post('v1/auth/permissions', { role, resource: `${resource}:*:*`, action })
.then(res => successMsg(res));
/**
* 删除权限

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long