Merge "fix: Fix for checkPolicy function change"
This commit is contained in:
commit
96d3924fbc
@ -46,6 +46,8 @@ export default class EditSubnet extends ModalAction {
|
|||||||
return t('Edit Subnet');
|
return t('Edit Subnet');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static buttonText = t('Edit');
|
||||||
|
|
||||||
get subnet() {
|
get subnet() {
|
||||||
return this.props.item;
|
return this.props.item;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import globalNetworkStore from 'stores/neutron/network';
|
|||||||
import globalProjectStore from 'stores/keystone/project';
|
import globalProjectStore from 'stores/keystone/project';
|
||||||
import { isEmpty, isFunction } from 'lodash';
|
import { isEmpty, isFunction } from 'lodash';
|
||||||
import Notify from 'components/Notify';
|
import Notify from 'components/Notify';
|
||||||
import checkPolicy from 'resources/policy';
|
import { checkPolicyRule } from 'resources/policy';
|
||||||
import globalNeutronStore from 'stores/neutron/neutron';
|
import globalNeutronStore from 'stores/neutron/neutron';
|
||||||
import networkUtil from './networkUtil';
|
import networkUtil from './networkUtil';
|
||||||
|
|
||||||
@ -58,10 +58,7 @@ export default class CreateNetwork extends ModalAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get isSystemAdmin() {
|
get isSystemAdmin() {
|
||||||
return checkPolicy({
|
return checkPolicyRule('skyline:system_admin');
|
||||||
rules: ['skyline:system_admin'],
|
|
||||||
every: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get defaultValue() {
|
get defaultValue() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import { ModalAction } from 'containers/Action';
|
import { ModalAction } from 'containers/Action';
|
||||||
import globalNetworkStore from 'stores/neutron/network';
|
import globalNetworkStore from 'stores/neutron/network';
|
||||||
import checkPolicy, { checkPolicyRule } from 'resources/policy';
|
import { checkPolicyRule } from 'resources/policy';
|
||||||
import globalRootStore from 'stores/root';
|
import globalRootStore from 'stores/root';
|
||||||
import { getYesNoList } from 'utils/index';
|
import { getYesNoList } from 'utils/index';
|
||||||
|
|
||||||
@ -39,10 +39,7 @@ export default class Edit extends ModalAction {
|
|||||||
|
|
||||||
static allowed = (item) => {
|
static allowed = (item) => {
|
||||||
const rootStore = globalRootStore;
|
const rootStore = globalRootStore;
|
||||||
if (
|
if (!this.isSystemAdmin && item.project_id !== rootStore.user.project.id) {
|
||||||
!checkPolicyRule('skyline:system_admin') &&
|
|
||||||
item.project_id !== rootStore.user.project.id
|
|
||||||
) {
|
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
@ -62,10 +59,7 @@ export default class Edit extends ModalAction {
|
|||||||
};
|
};
|
||||||
|
|
||||||
get isSystemAdmin() {
|
get isSystemAdmin() {
|
||||||
return checkPolicy({
|
return checkPolicyRule('skyline:system_admin');
|
||||||
rules: ['skyline:system_admin'],
|
|
||||||
every: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get formItems() {
|
get formItems() {
|
||||||
|
Loading…
Reference in New Issue
Block a user