mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
add ns path to granting_policies (#20522)
This commit is contained in:
committed by
GitHub
parent
570a33b6a6
commit
dee7fd839e
@@ -150,9 +150,10 @@ func (f *AuditFormatter) FormatRequest(ctx context.Context, w io.Writer, config
|
|||||||
|
|
||||||
for _, p := range auth.PolicyResults.GrantingPolicies {
|
for _, p := range auth.PolicyResults.GrantingPolicies {
|
||||||
reqEntry.Auth.PolicyResults.GrantingPolicies = append(reqEntry.Auth.PolicyResults.GrantingPolicies, PolicyInfo{
|
reqEntry.Auth.PolicyResults.GrantingPolicies = append(reqEntry.Auth.PolicyResults.GrantingPolicies, PolicyInfo{
|
||||||
Name: p.Name,
|
Name: p.Name,
|
||||||
NamespaceId: p.NamespaceId,
|
NamespaceId: p.NamespaceId,
|
||||||
Type: p.Type,
|
NamespacePath: p.NamespacePath,
|
||||||
|
Type: p.Type,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -367,9 +368,10 @@ func (f *AuditFormatter) FormatResponse(ctx context.Context, w io.Writer, config
|
|||||||
|
|
||||||
for _, p := range auth.PolicyResults.GrantingPolicies {
|
for _, p := range auth.PolicyResults.GrantingPolicies {
|
||||||
respEntry.Auth.PolicyResults.GrantingPolicies = append(respEntry.Auth.PolicyResults.GrantingPolicies, PolicyInfo{
|
respEntry.Auth.PolicyResults.GrantingPolicies = append(respEntry.Auth.PolicyResults.GrantingPolicies, PolicyInfo{
|
||||||
Name: p.Name,
|
Name: p.Name,
|
||||||
NamespaceId: p.NamespaceId,
|
NamespaceId: p.NamespaceId,
|
||||||
Type: p.Type,
|
NamespacePath: p.NamespacePath,
|
||||||
|
Type: p.Type,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -475,9 +477,10 @@ type AuditPolicyResults struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PolicyInfo struct {
|
type PolicyInfo struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
NamespaceId string `json:"namespace_id,omitempty"`
|
NamespaceId string `json:"namespace_id,omitempty"`
|
||||||
Type string `json:"type"`
|
NamespacePath string `json:"namespace_path,omitempty"`
|
||||||
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuditSecret struct {
|
type AuditSecret struct {
|
||||||
|
|||||||
@@ -126,7 +126,8 @@ type PolicyResults struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PolicyInfo struct {
|
type PolicyInfo struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
NamespaceId string `json:"namespace_id"`
|
NamespaceId string `json:"namespace_id"`
|
||||||
Type string `json:"type"`
|
NamespacePath string `json:"namespace_path"`
|
||||||
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,9 +341,10 @@ func (a *ACL) AllowOperation(ctx context.Context, req *logical.Request, capCheck
|
|||||||
ret.RootPrivs = true
|
ret.RootPrivs = true
|
||||||
ret.IsRoot = true
|
ret.IsRoot = true
|
||||||
ret.GrantingPolicies = []logical.PolicyInfo{{
|
ret.GrantingPolicies = []logical.PolicyInfo{{
|
||||||
Name: "root",
|
Name: "root",
|
||||||
NamespaceId: "root",
|
NamespaceId: "root",
|
||||||
Type: "acl",
|
NamespacePath: "",
|
||||||
|
Type: "acl",
|
||||||
}}
|
}}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -874,14 +874,16 @@ func TestACLGrantingPolicies(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
policyInfo := logical.PolicyInfo{
|
policyInfo := logical.PolicyInfo{
|
||||||
Name: "granting_policy",
|
Name: "granting_policy",
|
||||||
NamespaceId: "root",
|
NamespaceId: "root",
|
||||||
Type: "acl",
|
NamespacePath: "",
|
||||||
|
Type: "acl",
|
||||||
}
|
}
|
||||||
mergedInfo := logical.PolicyInfo{
|
mergedInfo := logical.PolicyInfo{
|
||||||
Name: "granting_policy_merged",
|
Name: "granting_policy_merged",
|
||||||
NamespaceId: "root",
|
NamespaceId: "root",
|
||||||
Type: "acl",
|
NamespacePath: "",
|
||||||
|
Type: "acl",
|
||||||
}
|
}
|
||||||
|
|
||||||
tcases := []tcase{
|
tcases := []tcase{
|
||||||
|
|||||||
@@ -269,9 +269,10 @@ func addGrantingPoliciesToMap(m map[uint32][]logical.PolicyInfo, policy *Policy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
m[capability] = append(m[capability], logical.PolicyInfo{
|
m[capability] = append(m[capability], logical.PolicyInfo{
|
||||||
Name: policy.Name,
|
Name: policy.Name,
|
||||||
NamespaceId: policy.namespace.ID,
|
NamespaceId: policy.namespace.ID,
|
||||||
Type: "acl",
|
NamespacePath: policy.namespace.Path,
|
||||||
|
Type: "acl",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user