fix: fix policy for all modules

Add prefix to policy

Change-Id: I492f2215af5d02284ce6e24137e190eab5bb355a
This commit is contained in:
xusongfu 2022-06-29 16:05:27 +08:00
parent c27c84cafe
commit 3ed9d74791
146 changed files with 390 additions and 139 deletions

View File

@ -17,6 +17,7 @@ import checkItemPolicy, { systemRoleIsReader } from 'resources/skyline/policy';
export async function checkAllowed({ export async function checkAllowed({
item, item,
policy, policy,
aliasPolicy,
allowed, allowed,
containerProps, containerProps,
actionName, actionName,
@ -27,6 +28,7 @@ export async function checkAllowed({
const { enableSystemReader } = action || {}; const { enableSystemReader } = action || {};
const policyResult = checkItemPolicy({ const policyResult = checkItemPolicy({
policy, policy,
aliasPolicy,
item, item,
actionName, actionName,
isAdminPage, isAdminPage,
@ -57,6 +59,7 @@ export async function getAllowedResults({
const result = checkAllowed({ const result = checkAllowed({
item: data, item: data,
policy: key ? it[key].policy : it.policy, policy: key ? it[key].policy : it.policy,
aliasPolicy: key ? it[key].aliasPolicy : it.aliasPolicy,
allowed: key ? it[key].allowed : it.allowed, allowed: key ? it[key].allowed : it.allowed,
containerProps, containerProps,
actionName: key ? it[key].title : it.title, actionName: key ? it[key].title : it.title,
@ -72,11 +75,16 @@ export async function getAllowedResults({
export function getPolicyResults({ actions, extra, isAdminPage }) { export function getPolicyResults({ actions, extra, isAdminPage }) {
return actions.map((it) => { return actions.map((it) => {
const { policy, title, enableSystemReader } = it; const { policy, aliasPolicy, title, enableSystemReader } = it;
if (isAdminPage && !enableSystemReader && systemRoleIsReader()) { if (isAdminPage && !enableSystemReader && systemRoleIsReader()) {
return false; return false;
} }
const result = checkItemPolicy({ policy, actionName: title, extra }); const result = checkItemPolicy({
policy,
aliasPolicy,
actionName: title,
extra,
});
return result; return result;
}); });
} }

View File

@ -91,6 +91,8 @@ export default class ConfirmAction {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
policy = ''; policy = '';
aliasPolicy = '';
unescape = (message) => unescapeHtml(message); unescape = (message) => unescapeHtml(message);
getItemId = (data) => data.id; getItemId = (data) => data.id;

View File

@ -28,6 +28,10 @@ export default class FormAction extends BaseForm {
static path = '/'; static path = '/';
static policy = '';
static aliasPolicy = '';
static allowed() { static allowed() {
return Promise.resolve(); return Promise.resolve();
} }

View File

@ -26,6 +26,10 @@ export default class ModalAction extends BaseForm {
static isDanger = false; static isDanger = false;
static policy = '';
static aliasPolicy = '';
get name() { get name() {
return t('Edit'); return t('Edit');
} }

View File

@ -27,6 +27,10 @@ export default class StepAction extends StepForm {
static path = '/'; static path = '/';
static policy = '';
static aliasPolicy = '';
static get allowed() { static get allowed() {
return Promise.resolve(); return Promise.resolve();
} }

View File

@ -124,6 +124,10 @@ export default class BaseList extends React.Component {
return ''; return '';
} }
get aliasPolicy() {
return '';
}
get name() { get name() {
return ''; return '';
} }
@ -620,7 +624,13 @@ export default class BaseList extends React.Component {
if (this.endpointError) { if (this.endpointError) {
return; return;
} }
if (!checkItemPolicy({ policy: this.policy, actionName: this.name })) { if (
!checkItemPolicy({
policy: this.policy,
aliasPolicy: this.aliasPolicy,
actionName: this.name,
})
) {
const error = { const error = {
message: t("You don't have access to get {name}.", { message: t("You don't have access to get {name}.", {
name: this.name.toLowerCase(), name: this.name.toLowerCase(),

View File

@ -62,6 +62,14 @@ export default class DetailBase extends React.Component {
return this.props.match.params.id; return this.props.match.params.id;
} }
get policy() {
return '';
}
get aliasPolicy() {
return '';
}
get name() { get name() {
return ''; return '';
} }
@ -252,7 +260,13 @@ export default class DetailBase extends React.Component {
getRouteProps = () => ({}); getRouteProps = () => ({});
fetchDataWithPolicy = (silent, params) => { fetchDataWithPolicy = (silent, params) => {
if (!checkItemPolicy({ policy: this.policy, actionName: this.name })) { if (
!checkItemPolicy({
policy: this.policy,
aliasPolicy: this.aliasPolicy,
actionName: this.name,
})
) {
const error = { const error = {
message: t("You don't have access to get {name}.", { message: t("You don't have access to get {name}.", {
name: this.name.toLowerCase(), name: this.name.toLowerCase(),

View File

@ -176,7 +176,6 @@
"Auto Scaling": "Auto Scaling", "Auto Scaling": "Auto Scaling",
"Auto allocate mac address": "Auto allocate mac address", "Auto allocate mac address": "Auto allocate mac address",
"Auto scaling feature will be enabled": "Auto scaling feature will be enabled", "Auto scaling feature will be enabled": "Auto scaling feature will be enabled",
"Automatic backup": "Automatic backup",
"Automatically Assigned Address": "Automatically Assigned Address", "Automatically Assigned Address": "Automatically Assigned Address",
"Automatically repair unhealhty nodes": "Automatically repair unhealhty nodes", "Automatically repair unhealhty nodes": "Automatically repair unhealhty nodes",
"Availability Zone": "Availability Zone", "Availability Zone": "Availability Zone",
@ -1366,7 +1365,6 @@
"Management": "Management", "Management": "Management",
"Management Reason": "Management Reason", "Management Reason": "Management Reason",
"Manu": "Manu", "Manu": "Manu",
"Manual backup": "Manual backup",
"Manual input": "Manual input", "Manual input": "Manual input",
"Manually Assigned Address": "Manually Assigned Address", "Manually Assigned Address": "Manually Assigned Address",
"Manually Specify": "Manually Specify", "Manually Specify": "Manually Specify",

View File

@ -176,7 +176,6 @@
"Auto Scaling": "自动缩放", "Auto Scaling": "自动缩放",
"Auto allocate mac address": "自动分配MAC地址", "Auto allocate mac address": "自动分配MAC地址",
"Auto scaling feature will be enabled": "将启用自动缩放功能", "Auto scaling feature will be enabled": "将启用自动缩放功能",
"Automatic backup": "自动备份",
"Automatically Assigned Address": "自动分配地址", "Automatically Assigned Address": "自动分配地址",
"Automatically repair unhealhty nodes": "自动修复不健康的节点", "Automatically repair unhealhty nodes": "自动修复不健康的节点",
"Availability Zone": "可用域", "Availability Zone": "可用域",
@ -1366,7 +1365,6 @@
"Management": "维护", "Management": "维护",
"Management Reason": "维护原因", "Management Reason": "维护原因",
"Manu": "手动", "Manu": "手动",
"Manual backup": "手动备份",
"Manual input": "手动输入", "Manual input": "手动输入",
"Manually Assigned Address": "手动分配地址", "Manually Assigned Address": "手动分配地址",
"Manually Specify": "手动指定", "Manually Specify": "手动指定",

View File

@ -25,7 +25,7 @@ export class HypervisorDetail extends Base {
} }
get policy() { get policy() {
return 'os_compute_api:os-hypervisors'; return 'os_compute_api:os-hypervisors:show';
} }
get listUrl() { get listUrl() {

View File

@ -26,7 +26,7 @@ export class Hypervisors extends Base {
} }
get policy() { get policy() {
return 'os_compute_api:os-hypervisors'; return 'os_compute_api:os-hypervisors:list';
} }
get name() { get name() {

View File

@ -16,6 +16,10 @@ export class ActionLog extends Base {
return 'request_id'; return 'request_id';
} }
get policy() {
return 'os_compute_api:os-instance-actions:list';
}
getColumns = () => actionColumn(this); getColumns = () => actionColumn(this);
get hideSearch() { get hideSearch() {

View File

@ -37,7 +37,7 @@ export default class Delete extends ConfirmAction {
return true; return true;
} }
policy = 'os_compute_api:os-deferred-delete'; policy = 'os_compute_api:os-deferred-delete:force';
allowedCheckFunc = (item) => { allowedCheckFunc = (item) => {
if (!item) { if (!item) {

View File

@ -52,7 +52,7 @@ export default class SoftDelete extends ConfirmAction {
policy = [ policy = [
'os_compute_api:servers:delete', 'os_compute_api:servers:delete',
'os_compute_api:os-deferred-delete', 'os_compute_api:os-deferred-delete:force',
]; ];
onChangeType(choosed, data) { onChangeType(choosed, data) {

View File

@ -32,6 +32,10 @@ export class CinderService extends Base {
return t('cinder services'); return t('cinder services');
} }
get rowKey() {
return 'binary';
}
get hasTab() { get hasTab() {
return true; return true;
} }

View File

@ -24,7 +24,11 @@ export class HeatService extends Base {
} }
get policy() { get policy() {
return 'services:index'; return 'service:index';
}
get aliasPolicy() {
return 'heat:service:index';
} }
get name() { get name() {

View File

@ -30,7 +30,7 @@ export class ClusterTemplateDetail extends Base {
} }
get policy() { get policy() {
return 'container-infra:clustertemplate:detail'; return 'clustertemplate:detail';
} }
get actionConfigs() { get actionConfigs() {

View File

@ -34,7 +34,7 @@ export default class Delete extends ConfirmAction {
return t('Delete'); return t('Delete');
} }
policy = 'container-infra:clustertemplate:delete'; policy = 'clustertemplate:delete';
allowedCheckFunc = () => true; allowedCheckFunc = () => true;

View File

@ -29,7 +29,7 @@ export class Edit extends Base {
return this.getRoutePath('clusterTemplate'); return this.getRoutePath('clusterTemplate');
} }
static policy = 'container-infra:clustertemplate:update'; static policy = 'clustertemplate:update';
static path = (item) => { static path = (item) => {
const key = 'containerInfraUpdateClusterTemplate'; const key = 'containerInfraUpdateClusterTemplate';

View File

@ -31,7 +31,7 @@ export class StepCreate extends StepAction {
static path = '/container-infra/cluster-template/create'; static path = '/container-infra/cluster-template/create';
static policy = 'container-infra:clustertemplate:create'; static policy = 'clustertemplate:create';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);

View File

@ -27,7 +27,7 @@ export class ClusterTemplates extends Base {
} }
get policy() { get policy() {
return 'container-infra:clustertemplate:get_all'; return 'clustertemplate:get_all';
} }
get actionConfigs() { get actionConfigs() {

View File

@ -34,7 +34,7 @@ export class ClustersDetail extends Base {
} }
get policy() { get policy() {
return 'container-infra:cluster:detail'; return 'cluster:detail';
} }
get actionConfigs() { get actionConfigs() {

View File

@ -36,7 +36,7 @@ export default class DeleteClusters extends ConfirmAction {
return true; return true;
} }
policy = 'container-infra:cluster:delete'; policy = 'cluster:delete';
allowedCheckFunc = () => true; allowedCheckFunc = () => true;

View File

@ -23,7 +23,7 @@ export class Resize extends ModalAction {
static title = t('Resize Cluster'); static title = t('Resize Cluster');
policy = 'container-infra:cluster:resize'; policy = 'cluster:resize';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);

View File

@ -30,7 +30,7 @@ export class StepCreate extends StepAction {
static path = '/container-infra/clusters/create'; static path = '/container-infra/clusters/create';
static policy = 'container-infra:cluster:create'; static policy = 'cluster:create';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);

View File

@ -29,7 +29,7 @@ export class Clusters extends Base {
} }
get policy() { get policy() {
return 'container-infra:cluster:get_all'; return 'cluster:get_all';
} }
get actionConfigs() { get actionConfigs() {

View File

@ -32,7 +32,7 @@ export class CapsulesDetail extends Base {
} }
get policy() { get policy() {
return 'container:capsule:get_one_all_projects'; return 'capsule:get_one_all_projects';
} }
get detailInfos() { get detailInfos() {

View File

@ -38,7 +38,7 @@ export class Create extends ModalAction {
return t('Create Capsule'); return t('Create Capsule');
} }
static policy = 'container:capsule:create'; static policy = 'capsule:create';
get formItems() { get formItems() {
return [ return [

View File

@ -34,7 +34,7 @@ export default class DeleteCapsule extends ConfirmAction {
return true; return true;
} }
policy = 'container:capsule:delete'; policy = 'capsule:delete';
allowedCheckFunc = () => true; allowedCheckFunc = () => true;

View File

@ -29,7 +29,7 @@ export class Capsules extends Base {
} }
get policy() { get policy() {
return 'container:capsule:get_all'; return 'capsule:get_all';
} }
get actionConfigs() { get actionConfigs() {

View File

@ -31,7 +31,7 @@ export class ContainerDetail extends Base {
} }
get policy() { get policy() {
return 'container:container:get_one'; return 'container:get_one';
} }
get actionConfigs() { get actionConfigs() {

View File

@ -37,7 +37,9 @@ export default class DeleteContainer extends ConfirmAction {
return t('Delete'); return t('Delete');
} }
policy = 'container:container:delete'; policy = 'container:delete';
aliasPolicy = 'zun:container:delete';
allowedCheckFunc = (item) => checkItemAction(item, 'delete'); allowedCheckFunc = (item) => checkItemAction(item, 'delete');

View File

@ -22,7 +22,9 @@ export class EditContainer extends ModalAction {
static buttonText = t('Edit'); static buttonText = t('Edit');
static policy = 'container:container:update'; static policy = 'container:update';
static aliasPolicy = 'zun:container:update';
static allowed = (item) => checkItemAction(item, 'update'); static allowed = (item) => checkItemAction(item, 'update');

View File

@ -25,7 +25,9 @@ export class ExecuteCommandContainer extends ModalAction {
static buttonText = t('Execute Command'); static buttonText = t('Execute Command');
static policy = 'container:container:execute'; static policy = 'container:execute';
static aliasPolicy = 'zun:container:execute';
static allowed = (item) => checkItemAction(item, 'execute'); static allowed = (item) => checkItemAction(item, 'execute');

View File

@ -31,7 +31,9 @@ export default class ForceDeleteContainer extends ConfirmAction {
return t('Force Delete'); return t('Force Delete');
} }
policy = 'container:container:delete_force'; policy = 'container:delete_force';
aliasPolicy = 'zun:container:delete_force';
allowedCheckFunc = (item) => checkItemAction(item, 'delete_force'); allowedCheckFunc = (item) => checkItemAction(item, 'delete_force');

View File

@ -22,7 +22,9 @@ export class KillContainer extends ModalAction {
static buttonText = t('Kill'); static buttonText = t('Kill');
static policy = 'container:container:kill'; static policy = 'container:kill';
static aliasPolicy = 'zun:container:kill';
static allowed = (item) => checkItemAction(item, 'kill'); static allowed = (item) => checkItemAction(item, 'kill');

View File

@ -31,7 +31,9 @@ export default class PauseContainer extends ConfirmAction {
return t('Pause'); return t('Pause');
} }
policy = 'container:container:pause'; policy = 'container:pause';
aliasPolicy = 'zun:container:pause';
allowedCheckFunc = (item) => checkItemAction(item, 'pause'); allowedCheckFunc = (item) => checkItemAction(item, 'pause');

View File

@ -31,7 +31,9 @@ export default class RebootContainer extends ConfirmAction {
return t('Reboot'); return t('Reboot');
} }
policy = 'container:container:reboot'; policy = 'container:reboot';
aliasPolicy = 'zun:container:reboot';
allowedCheckFunc = (item) => checkItemAction(item, 'reboot'); allowedCheckFunc = (item) => checkItemAction(item, 'reboot');

View File

@ -22,7 +22,9 @@ export class RebuildContainer extends ModalAction {
static buttonText = t('Rebuild'); static buttonText = t('Rebuild');
static policy = 'container:container:rebuild'; static policy = 'container:rebuild';
aliasPolicy = 'zun:container:rebuild';
static allowed = (item) => checkItemAction(item, 'rebuild'); static allowed = (item) => checkItemAction(item, 'rebuild');

View File

@ -31,7 +31,9 @@ export default class StartContainer extends ConfirmAction {
return t('Start'); return t('Start');
} }
policy = 'container:container:start'; policy = 'container:start';
aliasPolicy = 'zun:container:start';
allowedCheckFunc = (item) => checkItemAction(item, 'start'); allowedCheckFunc = (item) => checkItemAction(item, 'start');

View File

@ -30,7 +30,9 @@ export class StepCreate extends StepAction {
static path = '/container/containers/create'; static path = '/container/containers/create';
static policy = 'container:container:create'; static policy = 'container:create';
static aliasPolicy = 'zun:container:create';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);

View File

@ -33,7 +33,9 @@ export default class StopContainer extends ConfirmAction {
return t('Stop'); return t('Stop');
} }
policy = 'container:container:stop'; policy = 'container:stop';
aliasPolicy = 'zun:container:stop';
allowedCheckFunc = (item) => checkItemAction(item, 'stop'); allowedCheckFunc = (item) => checkItemAction(item, 'stop');

View File

@ -33,7 +33,9 @@ export default class UnpauseContainer extends ConfirmAction {
return t('Unpause'); return t('Unpause');
} }
policy = 'container:container:unpause'; policy = 'container:unpause';
aliasPolicy = 'zun:container:unpause';
allowedCheckFunc = (item) => checkItemAction(item, 'unpause'); allowedCheckFunc = (item) => checkItemAction(item, 'unpause');

View File

@ -29,7 +29,7 @@ export class Containers extends Base {
} }
get policy() { get policy() {
return 'container:container:get_all'; return 'container:get_all';
} }
get actionConfigs() { get actionConfigs() {

View File

@ -29,7 +29,7 @@ export class HostsDetail extends Base {
} }
get policy() { get policy() {
return 'container:host:get'; return 'host:get';
} }
get detailInfos() { get detailInfos() {

View File

@ -29,7 +29,7 @@ export class Hosts extends Base {
} }
get policy() { get policy() {
return 'container:host:get_all'; return 'host:get_all';
} }
getColumns = () => [ getColumns = () => [

View File

@ -31,7 +31,7 @@ export class BackupsDetail extends Base {
} }
get policy() { get policy() {
return 'trove:backup:show'; return 'backup:show';
} }
get detailInfos() { get detailInfos() {

View File

@ -39,7 +39,9 @@ export class Create extends ModalAction {
return t('Create Backups'); return t('Create Backups');
} }
static policy = 'trove:backup:create'; static policy = 'backup:create';
static aliasPolicy = 'trove:backup:create';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);

View File

@ -34,7 +34,7 @@ export default class Delete extends ConfirmAction {
allowedCheckFunction = () => true; allowedCheckFunction = () => true;
policy = 'trove:instance:delete'; policy = 'instance:delete';
onSubmit = (item) => { onSubmit = (item) => {
return globalBackupsStore.delete({ id: item.id }); return globalBackupsStore.delete({ id: item.id });

View File

@ -32,7 +32,7 @@ export class Backups extends Base {
} }
get policy() { get policy() {
return 'trove:backup:index'; return 'backup:index';
} }
get searchFilters() { get searchFilters() {

View File

@ -33,7 +33,7 @@ export class ConfigurationsDetail extends Base {
} }
get policy() { get policy() {
return 'trove:configuration:show'; return 'configuration:show';
} }
get detailInfos() { get detailInfos() {

View File

@ -41,7 +41,7 @@ export class Create extends ModalAction {
return t('Create Configurations'); return t('Create Configurations');
} }
static policy = 'trove:configuration:create'; static policy = 'configuration:create';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);

View File

@ -34,7 +34,7 @@ export default class Delete extends ConfirmAction {
allowedCheckFunction = () => true; allowedCheckFunction = () => true;
policy = 'trove:instance:delete'; policy = 'instance:delete';
onSubmit = (item) => { onSubmit = (item) => {
return globalConfigurationsStore.delete({ id: item.id }); return globalConfigurationsStore.delete({ id: item.id });

View File

@ -32,7 +32,7 @@ export class Configurations extends Base {
} }
get policy() { get policy() {
return 'trove:configuration:index'; return 'configuration:index';
} }
get searchFilters() { get searchFilters() {

View File

@ -26,7 +26,7 @@ export class Backups extends Base {
} }
get policy() { get policy() {
return 'trove:instance:backups'; return 'instance:backups';
} }
getColumns = () => { getColumns = () => {

View File

@ -29,7 +29,7 @@ export class DatabaseCreate extends ModalAction {
return t('Create Database'); return t('Create Database');
} }
static policy = 'trove:instance:extension:database:create'; static policy = 'instance:extension:database:create';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);

View File

@ -38,7 +38,7 @@ export default class DatabaseDelete extends ConfirmAction {
allowedCheckFunction = () => true; allowedCheckFunction = () => true;
policy = 'trove:instance:extension:database:delete'; policy = 'instance:extension:database:delete';
onSubmit = (item) => { onSubmit = (item) => {
const { id } = this.containerProps.detail; const { id } = this.containerProps.detail;

View File

@ -31,6 +31,10 @@ export class Databases extends Base {
} }
get policy() { get policy() {
return 'instance:detail';
}
get aliasPolicy() {
return 'trove:instance:detail'; return 'trove:instance:detail';
} }

View File

@ -26,7 +26,7 @@ export class Logs extends Base {
} }
get policy() { get policy() {
return 'trove:instance:guest_log_list'; return 'instance:guest_log_list';
} }
getColumns = () => { getColumns = () => {

View File

@ -33,7 +33,7 @@ export class UserCreate extends ModalAction {
return t('Create User'); return t('Create User');
} }
static policy = 'trove:instance:extension:user:create'; static policy = 'instance:extension:user:create';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);

View File

@ -38,7 +38,7 @@ export default class UserDelete extends ConfirmAction {
allowedCheckFunction = () => true; allowedCheckFunction = () => true;
policy = 'trove:instance:extension:user:delete'; policy = 'instance:extension:user:delete';
onSubmit = (item) => { onSubmit = (item) => {
const { id } = this.containerProps.detail; const { id } = this.containerProps.detail;

View File

@ -38,7 +38,7 @@ export class Users extends Base {
} }
get policy() { get policy() {
return 'trove:instance:extension:user:index'; return 'instance:extension:user:index';
} }
get hideCustom() { get hideCustom() {

View File

@ -33,6 +33,10 @@ export class InstancesDetail extends Base {
} }
get policy() { get policy() {
return 'instance:detail';
}
get aliasPolicy() {
return 'trove:instance:detail'; return 'trove:instance:detail';
} }

View File

@ -34,7 +34,7 @@ export default class Delete extends ConfirmAction {
allowedCheckFunction = () => true; allowedCheckFunction = () => true;
policy = 'trove:instance:delete'; policy = 'instance:delete';
onSubmit = (item) => { onSubmit = (item) => {
return globalInstancesStore.delete({ id: item.id }); return globalInstancesStore.delete({ id: item.id });

View File

@ -31,7 +31,7 @@ export class StepCreate extends StepAction {
static path = '/database/instances/create'; static path = '/database/instances/create';
static policy = 'trove:instance:create'; static policy = 'instance:create';
static allowed() { static allowed() {
return Promise.resolve(true); return Promise.resolve(true);

View File

@ -33,6 +33,10 @@ export class Instances extends Base {
} }
get policy() { get policy() {
return 'instance:index';
}
get aliasPolicy() {
return 'trove:instance:index'; return 'trove:instance:index';
} }

View File

@ -27,6 +27,10 @@ export class Event extends Base {
return 'events:index'; return 'events:index';
} }
get aliasPolicy() {
return 'heat:events:index';
}
get name() { get name() {
return t('stack events'); return t('stack events');
} }

View File

@ -36,7 +36,7 @@ export default class Delete extends ConfirmAction {
return true; return true;
} }
policy = 'os_compute_api:os-deferred-delete'; policy = 'os_compute_api:os-deferred-delete:force';
allowedCheckFunc = (item) => { allowedCheckFunc = (item) => {
if (!item) { if (!item) {

View File

@ -36,7 +36,7 @@ export default class Recover extends ConfirmAction {
return true; return true;
} }
policy = 'os_compute_api:os-deferred-delete'; policy = 'os_compute_api:os-deferred-delete:restore';
allowedCheckFunc = (item) => { allowedCheckFunc = (item) => {
if (!item) { if (!item) {

View File

@ -36,6 +36,10 @@ export class Certificate extends Base {
} }
get policy() { get policy() {
return ['containers:get', 'secrets:get'];
}
get aliasPolicy() {
return ['barbican:containers:get', 'barbican:secrets:get']; return ['barbican:containers:get', 'barbican:secrets:get'];
} }

View File

@ -25,6 +25,10 @@ export class Detail extends Base {
} }
get policy() { get policy() {
return 'container:get';
}
get aliasPolicy() {
return 'barbican:container:get'; return 'barbican:container:get';
} }

View File

@ -25,7 +25,7 @@ export class Detail extends Base {
} }
get policy() { get policy() {
return 'barbican:secret:get'; return 'secret:get';
} }
get name() { get name() {

View File

@ -30,7 +30,7 @@ export class CreateAction extends ModalAction {
static title = t('Create Certificate'); static title = t('Create Certificate');
static policy = ['barbican:secrets:post', 'barbican:containers:post']; static policy = ['secrets:post', 'containers:post'];
init() { init() {
this.store = globalContainersStore; this.store = globalContainersStore;

View File

@ -36,7 +36,9 @@ export default class DeleteAction extends ConfirmAction {
return t('delete certificate'); return t('delete certificate');
} }
policy = ['barbican:secret:delete', 'barbican:container:delete']; policy = ['secret:delete', 'container:delete'];
aliasPolicy = ['barbican:secret:delete', 'barbican:container:delete'];
allowedCheckFunc = (item) => !item.listener; allowedCheckFunc = (item) => !item.listener;

View File

@ -36,7 +36,7 @@ export default class DeleteAction extends ConfirmAction {
return t('delete certificate'); return t('delete certificate');
} }
policy = 'barbican:secret:delete'; policy = 'secret:delete';
allowedCheckFunc = (item) => !item.listener; allowedCheckFunc = (item) => !item.listener;

View File

@ -28,6 +28,10 @@ export class QoSPolicyDetail extends Base {
return 'get_policy'; return 'get_policy';
} }
get aliasPolicy() {
return 'neutron:get_policy';
}
get listUrl() { get listUrl() {
return this.getRoutePath('networkQos'); return this.getRoutePath('networkQos');
} }

View File

@ -66,6 +66,10 @@ export class QoSPolicy extends Base {
return 'get_policy'; return 'get_policy';
} }
get aliasPolicy() {
return 'neutron:get_policy';
}
get name() { get name() {
return t('QoS policies'); return t('QoS policies');
} }

View File

@ -22,14 +22,14 @@ export class Create extends ModalAction {
static title = t('Create QoS Policy'); static title = t('Create QoS Policy');
policy = () => 'create_policy';
get name() { get name() {
return t('Create QoS Policy'); return t('Create QoS Policy');
} }
static policy = 'create_policy'; static policy = 'create_policy';
static aliasPolicy = 'neutron:create_policy';
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);
init() { init() {

View File

@ -38,6 +38,8 @@ export default class DeleteAction extends ConfirmAction {
policy = 'delete_policy'; policy = 'delete_policy';
aliasPolicy = 'neutron:delete_policy';
allowedCheckFunc = (item) => { allowedCheckFunc = (item) => {
if (!item) { if (!item) {
return true; return true;

View File

@ -29,6 +29,8 @@ export class Edit extends ModalAction {
static policy = 'update_policy'; static policy = 'update_policy';
static aliasPolicy = 'neutron:update_policy';
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);
init() { init() {

View File

@ -35,6 +35,8 @@ export class Create extends ModalAction {
static policy = 'create_endpoint_group'; static policy = 'create_endpoint_group';
static aliasPolicy = 'neutron:create_endpoint_group';
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);
get name() { get name() {

View File

@ -41,6 +41,8 @@ export default class DeleteAction extends ConfirmAction {
policy = 'delete_endpoint_group'; policy = 'delete_endpoint_group';
aliasPolicy = 'neutron:delete_endpoint_group';
allowedCheckFunc = (item) => { allowedCheckFunc = (item) => {
if (!item) { if (!item) {
return true; return true;

View File

@ -25,6 +25,8 @@ export class Edit extends ModalAction {
static policy = 'update_endpoint_group'; static policy = 'update_endpoint_group';
static aliasPolicy = 'neutron:update_endpoint_group';
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);
get defaultValue() { get defaultValue() {

View File

@ -40,6 +40,10 @@ export class EndpointGroup extends Base {
return 'get_endpoint_group'; return 'get_endpoint_group';
} }
get aliasPolicy() {
return 'neutron:get_endpoint_group';
}
get name() { get name() {
return t('vpn endpoint groups'); return t('vpn endpoint groups');
} }

View File

@ -51,7 +51,7 @@ export class Create extends ModalAction {
this.store = globalShareAccessRuleStore; this.store = globalShareAccessRuleStore;
} }
static policy = 'manila:share:allow_access'; static policy = 'share:allow_access';
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);

View File

@ -36,7 +36,7 @@ export default class Delete extends ConfirmAction {
return t('Delete Share Access Rule'); return t('Delete Share Access Rule');
} }
policy = 'manila:share:deny_access'; policy = 'share:deny_access';
onSubmit = (data, containerProps) => { onSubmit = (data, containerProps) => {
const { detail: { id } = {} } = containerProps; const { detail: { id } = {} } = containerProps;

View File

@ -39,8 +39,8 @@ export class ManageMetadata extends ModalAction {
} }
static policy = [ static policy = [
'manila:share_access_metadata:update', 'share_access_metadata:update',
'manila:share_access_metadata:delete', 'share_access_metadata:delete',
]; ];
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);

View File

@ -25,7 +25,7 @@ export class ShareAccessRule extends Base {
} }
get policy() { get policy() {
return 'manila:share_access_rule:index'; return 'share_access_rule:index';
} }
get name() { get name() {

View File

@ -25,7 +25,7 @@ export class Create extends ModalAction {
return t('Create Share Metadata'); return t('Create Share Metadata');
} }
static policy = 'manila:share:update_share_metadata'; static policy = 'share:update_share_metadata';
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);

View File

@ -36,7 +36,7 @@ export default class Delete extends ConfirmAction {
return t('Delete Share Metadata'); return t('Delete Share Metadata');
} }
policy = 'manila:share:delete_share_metadata'; policy = 'share:delete_share_metadata';
allowedCheckFunc = () => true; allowedCheckFunc = () => true;

View File

@ -40,7 +40,7 @@ export class Edit extends ModalAction {
return defaultValue; return defaultValue;
} }
static policy = 'manila:share:update_share_metadata'; static policy = 'share:update_share_metadata';
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);

View File

@ -24,7 +24,7 @@ export class Metadata extends Base {
} }
get policy() { get policy() {
return 'manila:share:get_share_metadata'; return 'share:get_share_metadata';
} }
get name() { get name() {

View File

@ -27,7 +27,7 @@ export class Detail extends Base {
} }
get policy() { get policy() {
return 'manila:share:get'; return 'share:get';
} }
get listUrl() { get listUrl() {

View File

@ -70,7 +70,7 @@ export class Create extends FormAction {
this.state.shareGroups = []; this.state.shareGroups = [];
} }
static policy = 'manila:share:create'; static policy = 'share:create';
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);

View File

@ -36,7 +36,7 @@ export default class Delete extends ConfirmAction {
return t('Delete Share'); return t('Delete Share');
} }
policy = 'manila:share:delete'; policy = 'share:delete';
allowedCheckFunc = (item) => { allowedCheckFunc = (item) => {
return this.isAdminPage || item.isMine; return this.isAdminPage || item.isMine;

View File

@ -32,7 +32,7 @@ export class Edit extends ModalAction {
return value; return value;
} }
static policy = 'manila:share:update'; static policy = 'share:update';
static allowed = (item) => Promise.resolve(item.isMine); static allowed = (item) => Promise.resolve(item.isMine);

View File

@ -34,7 +34,7 @@ export class ExtendShare extends ModalAction {
return value; return value;
} }
static policy = 'manila:share:extend'; static policy = 'share:extend';
static allowed = (item) => Promise.resolve(item.isMine); static allowed = (item) => Promise.resolve(item.isMine);

View File

@ -36,7 +36,7 @@ export class ManageAccessRule extends FormAction {
return t('Manage Access Rule'); return t('Manage Access Rule');
} }
static policy = 'manila:share_access_rule:index'; static policy = 'share_access_rule:index';
static allowed = (item) => Promise.resolve(item.isMine); static allowed = (item) => Promise.resolve(item.isMine);
} }

View File

@ -36,7 +36,7 @@ export class ManageMetadata extends FormAction {
return t('Manage Metadata'); return t('Manage Metadata');
} }
static policy = 'manila:share:update_share_metadata'; static policy = 'share:update_share_metadata';
static allowed = (item) => Promise.resolve(item.isMine); static allowed = (item) => Promise.resolve(item.isMine);
} }

View File

@ -36,7 +36,7 @@ export class ResetStatus extends ModalAction {
return value; return value;
} }
static policy = 'manila:share:reset_status'; static policy = 'share:reset_status';
static allowed = () => Promise.resolve(true); static allowed = () => Promise.resolve(true);

Some files were not shown because too many files have changed in this diff Show More