fix: role assignments list should include matched policies

This commit is contained in:
Qiu Jian
2019-07-25 02:26:39 +08:00
parent 90d6adff23
commit c18359def4
12 changed files with 107 additions and 25 deletions
+4
View File
@@ -24,6 +24,7 @@ import (
)
type BaseActionListOptions struct {
Scope string `help:"scope" choices:"project|domain|system"`
Since string `help:"Show logs since specific date" metavar:"DATETIME"`
Until string `help:"Show logs until specific date" metavar:"DATETIME"`
Limit int64 `help:"Limit number of logs" default:"20"`
@@ -59,6 +60,9 @@ func doActionList(s *mcclient.ClientSession, args *ActionListOptions) error {
if len(args.Search) > 0 {
params.Add(jsonutils.NewString(args.Search), "search")
}
if len(args.Scope) > 0 {
params.Add(jsonutils.NewString(args.Scope), "scope")
}
if len(args.Since) > 0 {
params.Add(jsonutils.NewString(args.Since), "since")
}
+4
View File
@@ -23,6 +23,7 @@ import (
)
type BaseEventListOptions struct {
Scope string `help:"scope" choices:"project|domain|system"`
Since string `help:"Show logs since specific date" metavar:"DATETIME"`
Until string `help:"Show logs until specific date" metavar:"DATETIME"`
Limit int64 `help:"Limit number of logs" default:"20"`
@@ -91,6 +92,9 @@ func doEventList(man modules.ResourceManager, s *mcclient.ClientSession, args *E
if len(args.Action) > 0 {
params.Add(jsonutils.NewStringArray(args.Action), "action")
}
if len(args.Scope) > 0 {
params.Add(jsonutils.NewString(args.Scope), "scope")
}
logs, err := man.List(s, params)
if err != nil {
return err
+4
View File
@@ -25,6 +25,7 @@ func init() {
type RoleAssignmentsOptions struct {
Effective bool `help:"Include role assignment of group members"`
System bool `help:"Include system user account"`
Policy bool `help:"Show matched policies"`
Domain string `help:"Role assignments for domain"`
User string `help:"For user"`
UserDomain string `help:"Domain for user"`
@@ -46,6 +47,9 @@ func init() {
if args.System {
query.Add(jsonutils.JSONNull, "include_system")
}
if args.Policy {
query.Add(jsonutils.JSONNull, "include_policies")
}
if len(args.Domain) > 0 {
domainId, err := modules.Domains.GetId(s, args.Domain, nil)
if err != nil {