feat: expose application name via Appearance API (#9886)

This commit is contained in:
Marcin Tojek
2023-09-27 17:02:18 +02:00
committed by GitHub
parent 68738771b9
commit cb5f8df4c2
18 changed files with 212 additions and 21 deletions
+12
View File
@@ -851,6 +851,11 @@ func (q *querier) GetAppSecurityKey(ctx context.Context) (string, error) {
return q.db.GetAppSecurityKey(ctx)
}
func (q *querier) GetApplicationName(ctx context.Context) (string, error) {
// No authz checks
return q.db.GetApplicationName(ctx)
}
func (q *querier) GetAuditLogsOffset(ctx context.Context, arg database.GetAuditLogsOffsetParams) ([]database.GetAuditLogsOffsetRow, error) {
// To optimize audit logs, we only check the global audit log permission once.
// This is because we expect a large unbounded set of audit logs, and applying a SQL
@@ -2808,6 +2813,13 @@ func (q *querier) UpsertAppSecurityKey(ctx context.Context, data string) error {
return q.db.UpsertAppSecurityKey(ctx, data)
}
func (q *querier) UpsertApplicationName(ctx context.Context, value string) error {
if err := q.authorizeContext(ctx, rbac.ActionCreate, rbac.ResourceDeploymentValues); err != nil {
return err
}
return q.db.UpsertApplicationName(ctx, value)
}
func (q *querier) UpsertDefaultProxy(ctx context.Context, arg database.UpsertDefaultProxyParams) error {
if err := q.authorizeContext(ctx, rbac.ActionUpdate, rbac.ResourceSystem); err != nil {
return err