3
0

Add namespace/module/chart rbac and add permissions button to specific chart

This commit is contained in:
Jože Fortun
2024-10-03 13:42:37 +02:00
parent bd380bd186
commit 696ab44a8b
11 changed files with 97 additions and 52 deletions

View File

@@ -23,12 +23,21 @@
no-body
class="shadow-sm"
>
<b-card-header class="d-flex py-3 align-items-center border-bottom">
<b-card-header class="d-flex py-3 align-items-center border-bottom gap-1">
<export
v-if="chart.canExportChart"
slot="header"
:list="[chart]"
type="chart"
class="float-right"
/>
<c-permissions-button
v-if="namespace.canGrant"
:title="chart.name || chart.handle || chart.chartID"
:target="chart.name || chart.handle || chart.chartID"
:resource="`corteza::compose:chart/${namespace.namespaceID}/${chart.chartID}`"
:button-label="$t('general.label.permissions')"
class="btn-lg"
/>
</b-card-header>

View File

@@ -61,6 +61,7 @@
/>
<export
v-if="namespace.canExportChart"
:list="charts"
type="chart"
/>

View File

@@ -88,6 +88,7 @@
</b-button>
<export
v-if="module.canExportModule"
:list="[module]"
type="module"
class="mr-1"

View File

@@ -52,6 +52,7 @@
/>
<export
v-if="namespace.canExportModule"
:list="modules"
type="module"
/>

View File

@@ -63,6 +63,7 @@
#header
>
<b-btn
v-if="namespace.canExportNamespace"
data-test-id="button-export-namespace"
variant="light"
size="lg"

View File

@@ -40,6 +40,7 @@ export class BaseChart {
public canUpdateChart = false
public canDeleteChart = false
public canGrant = false
public canExportChart = false
public config: ChartConfig = {}
@@ -106,7 +107,7 @@ export class BaseChart {
Apply(this, c, CortezaID, 'chartID', 'namespaceID')
Apply(this, c, String, 'name', 'handle')
Apply(this, c, ISO8601Date, 'createdAt', 'updatedAt', 'deletedAt')
Apply(this, c, Boolean, 'canUpdateChart', 'canDeleteChart', 'canGrant')
Apply(this, c, Boolean, 'canUpdateChart', 'canDeleteChart', 'canGrant', 'canExportChart')
Apply(this, c, Object, 'config')
if (typeof c.config === 'object') {

View File

@@ -187,6 +187,7 @@ export class Module {
public canUpdateModule = false;
public canDeleteModule = false;
public canExportModule = false;
public canCreateRecord = false;
public canCreateOwnedRecord = false;
public canGrant = false;
@@ -250,6 +251,7 @@ export class Module {
Apply(this, m, Boolean,
'canUpdateModule',
'canDeleteModule',
'canExportModule',
'canCreateRecord',
'canCreateOwnedRecord',
'canGrant',

View File

@@ -49,7 +49,10 @@ export class Namespace {
public canUpdateNamespace = false
public canManageNamespace = false
public canCloneNamespace = false
public canExportNamespace = false
public canGrant = false
public canExportChart = false
public canExportModule = false
constructor (i?: PartialNamespace) {
this.apply(i)
@@ -77,14 +80,17 @@ export class Namespace {
Apply(this, n, ISO8601Date, 'createdAt', 'updatedAt', 'deletedAt')
Apply(this, n, Boolean,
'canCreateChart',
'canCreateModule',
'canCreatePage',
'canDeleteNamespace',
'canUpdateNamespace',
'canManageNamespace',
'canCloneNamespace',
'canExportNamespace',
'canGrant',
'canCreateModule',
'canExportModule',
'canCreatePage',
'canCreateChart',
'canExportChart',
)
}

View File

@@ -507,6 +507,8 @@ resources:
title: Create charts under any namespace
charts.search:
title: List and search charts under any namespace
charts.export:
title: Export charts under any namespace
delete:
title: Delete any namespace
manage:
@@ -515,6 +517,8 @@ resources:
title: Create modules under any namespace
modules.search:
title: List and search modules under any namespace
modules.export:
title: Export modules under any namespace
page.create:
title: Create pages under any namespace
pages.search:
@@ -523,6 +527,8 @@ resources:
title: Access any namespace
update:
title: Update any namespace
export:
title: Export any namespace
page:
label: Pages
operations:

View File

@@ -18,6 +18,7 @@ general:
title: Label
add: Add
count: Count
permissions: Permissions
value: Value
placeholder:
handle: handle (a - z, 0 - 9, underscore, dash)

View File

@@ -41,6 +41,68 @@ ui:
resources:
compose:
namespace:
all: all namespaces
specific: namespace "{{target}}"
tooltip: Namespace permissions
operations:
read:
description: ""
specific: Read namespace "{{target}}"
title: Read any namespace
update:
description: ""
specific: Update namespace "{{target}}"
title: Update any namespace
delete:
description: ""
specific: Delete namespace "{{target}}"
title: Delete any namespace
manage:
description: Allow access to namespace's admin pages
specific: Manage namespace "{{target}}"
title: Manage any namespace
export:
description: ""
specific: Export namespace "{{target}}"
title: Export any namespace
module.create:
description: ""
specific: Create modules under namespace "{{target}}"
title: Create modules under any namespace
modules.export:
description: ""
specific: Export modules in namespace "{{target}}"
title: Export modules in any namespace
modules.search:
description: ""
specific: List and search modules under namespace "{{target}}"
title: List and search modules under any namespace
page.create:
description: ""
specific: Create pages under namespace "{{target}}"
title: Create pages under any namespace
pages.search:
description: ""
specific: List and search pages under namespace "{{target}}"
title: List and search pages under any namespace
pages.export:
description: ""
specific: Export pages in namespace "{{target}}"
title: Export pages in any namespace
chart.create:
description: ""
specific: Create charts under namespace "{{target}}"
title: Create charts under any namespace
charts.search:
description: ""
specific: List and search charts under namespace "{{target}}"
title: List and search charts under any namespace
charts.export:
description: ""
specific: Export charts in namespace "{{target}}"
title: Export charts in any namespace
chart:
all: all charts
specific: chart "{{target}}"
@@ -107,52 +169,6 @@ resources:
title: Update record field values of any module
all-specific: Update record field values of module "{{ target }}"
namespace:
all: all namespaces
specific: namespace "{{target}}"
tooltip: Namespace permissions
operations:
chart.create:
description: ""
specific: Create charts under namespace "{{target}}"
title: Create charts under any namespace
charts.search:
description: ""
specific: List and search charts under namespace "{{target}}"
title: List and search charts under any namespace
delete:
description: ""
specific: Delete namespace "{{target}}"
title: Delete any namespace
manage:
description: Allow access to namespace's admin pages
specific: Manage namespace "{{target}}"
title: Manage any namespace
module.create:
description: ""
specific: Create modules under namespace "{{target}}"
title: Create modules under any namespace
modules.search:
description: ""
specific: List and search modules under namespace "{{target}}"
title: List and search modules under any namespace
page.create:
description: ""
specific: Create pages under namespace "{{target}}"
title: Create pages under any namespace
pages.search:
description: ""
specific: List and search pages under namespace "{{target}}"
title: List and search pages under any namespace
read:
description: ""
specific: Read namespace "{{target}}"
title: Read any namespace
update:
description: ""
specific: Update namespace "{{target}}"
title: Update any namespace
page:
all: all pages
specific: page "{{target}}"