mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
Deleted namespace client counts is now shown when queried from admin namespace CE changes (#29432)
* adding ce changes from vault-33413-ent * add changelog
This commit is contained in:
3
changelog/29432.txt
Normal file
3
changelog/29432.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
activity: Show activity records from clients created in deleted namespaces when activity log is queried from admin namespace.
|
||||
```
|
||||
@@ -1801,8 +1801,9 @@ func (c *Core) ActivityLogInjectResponse(ctx context.Context, pq *activity.Preco
|
||||
|
||||
func (a *ActivityLog) includeInResponse(query *namespace.Namespace, record *namespace.Namespace) bool {
|
||||
if record == nil {
|
||||
// Deleted namespace, only include in root queries
|
||||
return query.ID == namespace.RootNamespaceID
|
||||
// Deleted namespace, only include in root or admin namespace (if configured) queries
|
||||
adminNsPath := namespace.Canonicalize(a.core.administrativeNamespacePath())
|
||||
return query.ID == namespace.RootNamespaceID || (adminNsPath != "" && query.Path == adminNsPath)
|
||||
}
|
||||
return record.HasParent(query)
|
||||
}
|
||||
|
||||
@@ -1922,7 +1922,8 @@ func (f *fakeResponseWriter) WriteHeader(statusCode int) {
|
||||
// their parents.
|
||||
func TestActivityLog_IncludeNamespace(t *testing.T) {
|
||||
root := namespace.RootNamespace
|
||||
a := &ActivityLog{}
|
||||
core, _, _ := TestCoreUnsealed(t)
|
||||
a := core.activityLog
|
||||
|
||||
nsA := &namespace.Namespace{
|
||||
ID: "aaaaa",
|
||||
|
||||
@@ -3629,6 +3629,15 @@ func (c *Core) LogFormat() string {
|
||||
return conf.(*server.Config).LogFormat
|
||||
}
|
||||
|
||||
// administrativeNamespacePath returns the configured administrative namespace path.
|
||||
func (c *Core) administrativeNamespacePath() string {
|
||||
conf := c.rawConfig.Load()
|
||||
if conf == nil {
|
||||
return ""
|
||||
}
|
||||
return conf.(*server.Config).AdministrativeNamespacePath
|
||||
}
|
||||
|
||||
// LogLevel returns the log level provided by level provided by config, CLI flag, or env
|
||||
func (c *Core) LogLevel() string {
|
||||
return c.logLevel
|
||||
|
||||
@@ -3753,3 +3753,16 @@ func TestCore_IsRemovedFromCluster(t *testing.T) {
|
||||
t.Fatalf("expected removed to be false and ok to be true, got removed: %v, ok: %v", removed, ok)
|
||||
}
|
||||
}
|
||||
|
||||
// Test_administrativeNamespacePath verifies if administrativeNamespacePath function returns the configured administrative namespace path
|
||||
func Test_administrativeNamespacePath(t *testing.T) {
|
||||
adminNamespacePath := "admin"
|
||||
coreConfig := &CoreConfig{
|
||||
RawConfig: &server.Config{
|
||||
SharedConfig: &configutil.SharedConfig{AdministrativeNamespacePath: adminNamespacePath},
|
||||
},
|
||||
AdministrativeNamespacePath: adminNamespacePath,
|
||||
}
|
||||
core, _, _ := TestCoreUnsealedWithConfig(t, coreConfig)
|
||||
require.Equal(t, core.administrativeNamespacePath(), adminNamespacePath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user