Skip to content

Commit

Permalink
Redo export RBAC rules
Browse files Browse the repository at this point in the history
  • Loading branch information
tjerman committed Oct 3, 2024
1 parent d6013d4 commit fea7750
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 76 deletions.
1 change: 0 additions & 1 deletion server/compose/chart.cue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ chart: {
"read": {}
"update": {}
"delete": {}
"export": description: "Access to export charts"
}
}

Expand Down
1 change: 0 additions & 1 deletion server/compose/module.cue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ module: {
"read": {}
"update": {}
"delete": {}
"export": description: "Access to export modules"
"record.create": description: "Create record"
"owned-record.create": description: "Create record with custom owner"
"records.search": description: "List, search or filter records"
Expand Down
1 change: 0 additions & 1 deletion server/compose/namespace.cue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ namespace: {
"charts.export": description: "Export charts on namespace"
"page.create": description: "Create page on namespace"
"pages.search": description: "List, search or filter pages on namespace"
"pages.export": description: "Export pages on namespace"
}
}

Expand Down
1 change: 0 additions & 1 deletion server/compose/page.cue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ page: {
"read": {}
"update": {}
"delete": {}
"export": description: "Access to export pages"
"page-layout.create": description: "Create page layout on namespace"
"page-layouts.search": description: "List, search or filter page layouts on namespace"
}
Expand Down
3 changes: 0 additions & 3 deletions server/compose/rest/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type (

CanGrant bool `json:"canGrant"`
CanUpdateChart bool `json:"canUpdateChart"`
CanExportChart bool `json:"canExportChart"`
CanDeleteChart bool `json:"canDeleteChart"`
}

Expand All @@ -43,7 +42,6 @@ type (
CanGrant(context.Context) bool

CanUpdateChart(context.Context, *types.Chart) bool
CanExportChart(context.Context, *types.Chart) bool
CanDeleteChart(context.Context, *types.Chart) bool
}
)
Expand Down Expand Up @@ -156,7 +154,6 @@ func (ctrl Chart) makePayload(ctx context.Context, c *types.Chart, err error) (*
CanGrant: ctrl.ac.CanGrant(ctx),

CanUpdateChart: ctrl.ac.CanUpdateChart(ctx, c),
CanExportChart: ctrl.ac.CanExportChart(ctx, c),
CanDeleteChart: ctrl.ac.CanDeleteChart(ctx, c),
}, nil
}
Expand Down
4 changes: 0 additions & 4 deletions server/compose/rest/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type (
Fields []*moduleFieldPayload `json:"fields"`

CanGrant bool `json:"canGrant"`
CanExport bool `json:"canExport"`
CanUpdateModule bool `json:"canUpdateModule"`
CanDeleteModule bool `json:"canDeleteModule"`
CanCreateRecord bool `json:"canCreateRecord"`
Expand All @@ -48,7 +47,6 @@ type (
moduleAccessController interface {
CanGrant(context.Context) bool

CanExportModule(context.Context, *types.Module) bool
CanUpdateModule(context.Context, *types.Module) bool
CanDeleteModule(context.Context, *types.Module) bool
CanCreateRecordOnModule(context.Context, *types.Module) bool
Expand Down Expand Up @@ -191,8 +189,6 @@ func (ctrl Module) makePayload(ctx context.Context, m *types.Module, err error)

CanGrant: ctrl.ac.CanGrant(ctx),

CanExport: ctrl.ac.CanExportModule(ctx, m),

CanUpdateModule: ctrl.ac.CanUpdateModule(ctx, m),
CanDeleteModule: ctrl.ac.CanDeleteModule(ctx, m),

Expand Down
17 changes: 7 additions & 10 deletions server/compose/rest/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ type (
CanDeleteNamespace bool `json:"canDeleteNamespace"`
CanManageNamespace bool `json:"canManageNamespace"`
CanCreateModule bool `json:"canCreateModule"`
CanExportModule bool `json:"canExportModule"`
CanExportModules bool `json:"canExportModules"`
CanCreateChart bool `json:"canCreateChart"`
CanExportChart bool `json:"canExportChart"`
CanExportCharts bool `json:"canExportCharts"`
CanCreatePage bool `json:"canCreatePage"`
CanExportPage bool `json:"canExportPage"`
}

namespaceSetPayload struct {
Expand Down Expand Up @@ -85,7 +84,6 @@ type (
CanCreateChartOnNamespace(context.Context, *types.Namespace) bool
CanExportChartsOnNamespace(context.Context, *types.Namespace) bool
CanCreatePageOnNamespace(context.Context, *types.Namespace) bool
CanExportPagesOnNamespace(context.Context, *types.Namespace) bool
}
)

Expand Down Expand Up @@ -364,12 +362,11 @@ func (ctrl Namespace) makePayload(ctx context.Context, ns *types.Namespace, err
CanDeleteNamespace: ctrl.ac.CanDeleteNamespace(ctx, ns),
CanManageNamespace: ctrl.ac.CanManageNamespace(ctx, ns),

CanCreateModule: ctrl.ac.CanCreateModuleOnNamespace(ctx, ns),
CanExportModule: ctrl.ac.CanExportModulesOnNamespace(ctx, ns),
CanCreateChart: ctrl.ac.CanCreateChartOnNamespace(ctx, ns),
CanExportChart: ctrl.ac.CanExportChartsOnNamespace(ctx, ns),
CanCreatePage: ctrl.ac.CanCreatePageOnNamespace(ctx, ns),
CanExportPage: ctrl.ac.CanExportPagesOnNamespace(ctx, ns),
CanCreateModule: ctrl.ac.CanCreateModuleOnNamespace(ctx, ns),
CanExportModules: ctrl.ac.CanExportModulesOnNamespace(ctx, ns),
CanCreateChart: ctrl.ac.CanCreateChartOnNamespace(ctx, ns),
CanExportCharts: ctrl.ac.CanExportChartsOnNamespace(ctx, ns),
CanCreatePage: ctrl.ac.CanCreatePageOnNamespace(ctx, ns),
}, nil
}

Expand Down
3 changes: 0 additions & 3 deletions server/compose/rest/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type (
Children []*pagePayload `json:"children,omitempty"`

CanGrant bool `json:"canGrant"`
CanExportPage bool `json:"canExportPage"`
CanUpdatePage bool `json:"canUpdatePage"`
CanDeletePage bool `json:"canDeletePage"`
}
Expand Down Expand Up @@ -61,7 +60,6 @@ type (
CanGrant(context.Context) bool

CanUpdatePage(context.Context, *types.Page) bool
CanExportPage(context.Context, *types.Page) bool
CanDeletePage(context.Context, *types.Page) bool
}
)
Expand Down Expand Up @@ -275,7 +273,6 @@ func (ctrl Page) makePayload(ctx context.Context, c *types.Page, err error) (*pa
CanGrant: ctrl.ac.CanGrant(ctx),

CanUpdatePage: ctrl.ac.CanUpdatePage(ctx, c),
CanExportPage: ctrl.ac.CanExportPage(ctx, c),
CanDeletePage: ctrl.ac.CanDeletePage(ctx, c),
}, nil
}
Expand Down
52 changes: 0 additions & 52 deletions server/compose/service/access_control.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fea7750

Please sign in to comment.