mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: recode project-role rpc handle to support group role assignment
results by user or project
This commit is contained in:
@@ -23,20 +23,25 @@ import (
|
||||
|
||||
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"`
|
||||
Group string `help:"For group"`
|
||||
GroupDomain string `help:"Domain for group"`
|
||||
Project string `help:"Role assignments for project"`
|
||||
ProjectDomain string `help:"Domain for project"`
|
||||
Role string `help:"Role assignments for role"`
|
||||
RoleDomain string `help:"Domain for role"`
|
||||
Limit int64 `help:"maximal returned number of rows"`
|
||||
Offset int64 `help:"offset index of returned results"`
|
||||
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"`
|
||||
Group string `help:"For group"`
|
||||
GroupDomain string `help:"Domain for group"`
|
||||
Project string `help:"Role assignments for project"`
|
||||
ProjectDomain string `help:"Domain for project"`
|
||||
Role string `help:"Role assignments for role"`
|
||||
RoleDomain string `help:"Domain for role"`
|
||||
Limit int64 `help:"maximal returned number of rows"`
|
||||
Offset int64 `help:"offset index of returned results"`
|
||||
Users []string `help:"fitler by users id or name"`
|
||||
Groups []string `help:"fitler by users id or name"`
|
||||
Roles []string `help:"fitler by users id or name"`
|
||||
Projects []string `help:"fitler by users id or name"`
|
||||
Domains []string `help:"fitler by users id or name"`
|
||||
}
|
||||
R(&RoleAssignmentsOptions{}, "role-assignments", "List all role assignments", func(s *mcclient.ClientSession, args *RoleAssignmentsOptions) error {
|
||||
query := jsonutils.NewDict()
|
||||
@@ -85,6 +90,21 @@ func init() {
|
||||
}
|
||||
query.Add(jsonutils.NewString(rid), "role", "id")
|
||||
}
|
||||
if len(args.Users) > 0 {
|
||||
query.Add(jsonutils.NewStringArray(args.Users), "users")
|
||||
}
|
||||
if len(args.Groups) > 0 {
|
||||
query.Add(jsonutils.NewStringArray(args.Groups), "groups")
|
||||
}
|
||||
if len(args.Roles) > 0 {
|
||||
query.Add(jsonutils.NewStringArray(args.Roles), "roles")
|
||||
}
|
||||
if len(args.Projects) > 0 {
|
||||
query.Add(jsonutils.NewStringArray(args.Projects), "projects")
|
||||
}
|
||||
if len(args.Domains) > 0 {
|
||||
query.Add(jsonutils.NewStringArray(args.Domains), "domains")
|
||||
}
|
||||
if args.Limit > 0 {
|
||||
query.Add(jsonutils.NewInt(args.Limit), "limit")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user