policies.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package identity
  15. import (
  16. "context"
  17. "fmt"
  18. "io/ioutil"
  19. "strings"
  20. "time"
  21. "yunion.io/x/jsonutils"
  22. "yunion.io/x/log"
  23. "yunion.io/x/pkg/util/rbacscope"
  24. "yunion.io/x/pkg/util/shellutils"
  25. "yunion.io/x/onecloud/cmd/climc/shell"
  26. api "yunion.io/x/onecloud/pkg/apis/identity"
  27. "yunion.io/x/onecloud/pkg/cloudcommon/consts"
  28. "yunion.io/x/onecloud/pkg/cloudcommon/policy"
  29. "yunion.io/x/onecloud/pkg/mcclient"
  30. "yunion.io/x/onecloud/pkg/mcclient/auth"
  31. modules "yunion.io/x/onecloud/pkg/mcclient/modules/identity"
  32. baseoptions "yunion.io/x/onecloud/pkg/mcclient/options"
  33. options "yunion.io/x/onecloud/pkg/mcclient/options/identity"
  34. "yunion.io/x/onecloud/pkg/util/fileutils2"
  35. "yunion.io/x/onecloud/pkg/util/rbacutils"
  36. "yunion.io/x/onecloud/pkg/util/tagutils"
  37. )
  38. func createPolicy(s *mcclient.ClientSession, name string, genName string, policy string, domain string, enabled bool, disabled bool, desc string, scope string, isSystem *bool, objectags, projecttags, domaintags tagutils.TTagSet, orgNodeId []string) error {
  39. params := jsonutils.NewDict()
  40. if len(genName) > 0 {
  41. params.Add(jsonutils.NewString(genName), "generate_name")
  42. params.Add(jsonutils.NewString(genName), "type")
  43. } else if len(name) > 0 {
  44. params.Add(jsonutils.NewString(name), "name")
  45. params.Add(jsonutils.NewString(name), "type")
  46. } else {
  47. return fmt.Errorf("mising name")
  48. }
  49. params.Add(jsonutils.NewString(policy), "policy")
  50. if len(domain) > 0 {
  51. params.Add(jsonutils.NewString(domain), "project_domain_id")
  52. }
  53. if enabled {
  54. params.Add(jsonutils.JSONTrue, "enabled")
  55. } else if disabled {
  56. params.Add(jsonutils.JSONFalse, "enabled")
  57. }
  58. if len(desc) > 0 {
  59. params.Add(jsonutils.NewString(desc), "description")
  60. }
  61. if len(scope) > 0 {
  62. params.Add(jsonutils.NewString(scope), "scope")
  63. }
  64. if isSystem != nil {
  65. if *isSystem {
  66. params.Add(jsonutils.JSONTrue, "is_system")
  67. } else {
  68. params.Add(jsonutils.JSONFalse, "is_system")
  69. }
  70. }
  71. if len(objectags) > 0 {
  72. params.Add(jsonutils.Marshal(objectags), "object_tags")
  73. }
  74. if len(projecttags) > 0 {
  75. params.Add(jsonutils.Marshal(projecttags), "project_tags")
  76. }
  77. if len(domaintags) > 0 {
  78. params.Add(jsonutils.Marshal(domaintags), "domain_tags")
  79. }
  80. if len(orgNodeId) > 0 {
  81. params.Add(jsonutils.NewStringArray(orgNodeId), "org_node_id")
  82. }
  83. result, err := modules.Policies.Create(s, params)
  84. if err != nil {
  85. return err
  86. }
  87. printObject(result)
  88. return nil
  89. }
  90. func createPolicyFromJson(s *mcclient.ClientSession, old jsonutils.JSONObject, argsName, genName, argsDomain, argsScope string) error {
  91. policy, _ := old.GetString("policy")
  92. enabled, _ := old.Bool("enabled")
  93. desc, _ := old.GetString("description")
  94. scope, _ := old.GetString("scope")
  95. if len(argsScope) > 0 {
  96. scope = argsScope
  97. }
  98. isSystem, _ := old.Bool("is_system")
  99. var objectTags, projectTags, domainTags tagutils.TTagSet
  100. if old.Contains("object_tags") {
  101. objectTags = make(tagutils.TTagSet, 0)
  102. old.Unmarshal(&objectTags, "object_tags")
  103. }
  104. if old.Contains("project_tags") {
  105. projectTags = make(tagutils.TTagSet, 0)
  106. old.Unmarshal(&projectTags, "project_tags")
  107. }
  108. if old.Contains("domain_tags") {
  109. domainTags = make(tagutils.TTagSet, 0)
  110. old.Unmarshal(&domainTags, "domain_tags")
  111. }
  112. var nodeIds []string
  113. if old.Contains("org_node_id") {
  114. nodeIds = make([]string, 0)
  115. old.Unmarshal(&nodeIds, "org_node_id")
  116. }
  117. return createPolicy(s, argsName, genName, policy, argsDomain, enabled, !enabled, desc, scope, &isSystem, objectTags, projectTags, domainTags, nodeIds)
  118. }
  119. func init() {
  120. cmd := shell.NewResourceCmd(&modules.Policies)
  121. cmd.List(&options.PolicyListOptions{})
  122. cmd.Perform("user-metadata", &baseoptions.ResourceMetadataOptions{})
  123. cmd.Perform("set-user-metadata", &baseoptions.ResourceMetadataOptions{})
  124. cmd.GetProperty(&options.PolicyGetPropertyTagValuePairOptions{})
  125. cmd.GetProperty(&options.PolicyGetPropertyTagValueTreeOptions{})
  126. cmd.GetProperty(&options.PolicyGetPropertyDomainTagValuePairOptions{})
  127. cmd.GetProperty(&options.PolicyGetPropertyDomainTagValueTreeOptions{})
  128. type PolicyCreateOptions struct {
  129. Domain string `help:"domain of the policy"`
  130. NAME string `help:"name of the policy"`
  131. FILE string `help:"path to policy file"`
  132. Enabled bool `help:"create policy enabled"`
  133. Disabled bool `help:"create policy disabled"`
  134. Desc string `help:"policy description"`
  135. Scope string `help:"scope of policy"`
  136. IsSystem *bool `help:"create system policy" negative:"no-system"`
  137. ProjectTags string `help:"project tags"`
  138. DomainTags string `help:"domain tags"`
  139. ObjectTags string `help:"object tags"`
  140. OrgNodeId []string `help:"node ids of organiazation tree node"`
  141. }
  142. R(&PolicyCreateOptions{}, "policy-create", "Create a new policy", func(s *mcclient.ClientSession, args *PolicyCreateOptions) error {
  143. policyBytes, err := ioutil.ReadFile(args.FILE)
  144. if err != nil {
  145. return err
  146. }
  147. objectTags := baseoptions.SplitTag(args.ObjectTags)
  148. projectTags := baseoptions.SplitTag(args.ProjectTags)
  149. domainTags := baseoptions.SplitTag(args.DomainTags)
  150. return createPolicy(s, args.NAME, "", string(policyBytes), args.Domain, args.Enabled, args.Disabled, args.Desc, args.Scope, args.IsSystem, objectTags, projectTags, domainTags, args.OrgNodeId)
  151. })
  152. type PolicyExportOptions struct {
  153. ID string `json:"id"`
  154. }
  155. R(&PolicyExportOptions{}, "policy-export", "Export a policy", func(s *mcclient.ClientSession, args *PolicyExportOptions) error {
  156. ret, err := modules.Policies.Get(s, args.ID, nil)
  157. if err != nil {
  158. return err
  159. }
  160. fmt.Println(ret.PrettyString())
  161. return nil
  162. })
  163. type PolicyImportOptions struct {
  164. FILE string `json:"id"`
  165. Domain string `help:"domain of the policy"`
  166. }
  167. R(&PolicyImportOptions{}, "policy-import", "Import a policy", func(s *mcclient.ClientSession, args *PolicyImportOptions) error {
  168. cont, err := ioutil.ReadFile(args.FILE)
  169. if err != nil {
  170. return err
  171. }
  172. jsonCont, err := jsonutils.Parse(cont)
  173. if err != nil {
  174. return err
  175. }
  176. name, _ := jsonCont.GetString("name")
  177. return createPolicyFromJson(s, jsonCont, "", name, args.Domain, "")
  178. })
  179. type PolicyCloneOptions struct {
  180. Scope string `help:"scope of policy"`
  181. Domain string `help:"domain of the policy"`
  182. OLD string `help:"name or id of the old policy"`
  183. NAME string `help:"name of the policy"`
  184. }
  185. R(&PolicyCloneOptions{}, "policy-clone", "Clone a policy", func(s *mcclient.ClientSession, args *PolicyCloneOptions) error {
  186. old, err := modules.Policies.Get(s, args.OLD, nil)
  187. if err != nil {
  188. return err
  189. }
  190. return createPolicyFromJson(s, old, args.NAME, "", args.Domain, args.Scope)
  191. })
  192. type PolicyPatchOptions struct {
  193. ID string `help:"ID of policy"`
  194. File string `help:"path to policy file"`
  195. Type string `help:"policy type"`
  196. Enabled bool `help:"update policy enabled"`
  197. Disabled bool `help:"update policy disabled"`
  198. Desc string `help:"Description"`
  199. IsSystem bool `help:"is_system"`
  200. IsNotSystem bool `help:"negative is_system"`
  201. TagsAction string `help:"how to update tags" choices:"add|remove|replace"`
  202. ProjectTags string `help:"project tags"`
  203. DomainTags string `help:"domain tags"`
  204. ObjectTags string `help:"object tags"`
  205. OrgNodeId []string `help:"node ids of organiazation tree node"`
  206. }
  207. updateFunc := func(s *mcclient.ClientSession, args *PolicyPatchOptions) error {
  208. policyId, err := modules.Policies.GetId(s, args.ID, nil)
  209. if err != nil {
  210. return err
  211. }
  212. params := jsonutils.NewDict()
  213. if len(args.Type) > 0 {
  214. params.Add(jsonutils.NewString(args.Type), "type")
  215. }
  216. if len(args.File) > 0 {
  217. policyBytes, err := ioutil.ReadFile(args.File)
  218. if err != nil {
  219. return err
  220. }
  221. params.Add(jsonutils.NewString(string(policyBytes)), "policy")
  222. }
  223. if args.Enabled {
  224. params.Add(jsonutils.JSONTrue, "enabled")
  225. } else if args.Disabled {
  226. params.Add(jsonutils.JSONFalse, "enabled")
  227. }
  228. if len(args.Desc) > 0 {
  229. params.Add(jsonutils.NewString(args.Desc), "description")
  230. }
  231. if args.IsSystem {
  232. params.Add(jsonutils.JSONTrue, "is_system")
  233. }
  234. if args.IsNotSystem {
  235. params.Add(jsonutils.JSONFalse, "is_system")
  236. }
  237. if len(args.ObjectTags) > 0 {
  238. tags := baseoptions.SplitTag(args.ObjectTags)
  239. params.Add(jsonutils.Marshal(tags), "object_tags")
  240. }
  241. if len(args.ProjectTags) > 0 {
  242. tags := baseoptions.SplitTag(args.ProjectTags)
  243. params.Add(jsonutils.Marshal(tags), "project_tags")
  244. }
  245. if len(args.DomainTags) > 0 {
  246. tags := baseoptions.SplitTag(args.DomainTags)
  247. params.Add(jsonutils.Marshal(tags), "domain_tags")
  248. }
  249. if len(args.TagsAction) > 0 {
  250. params.Add(jsonutils.NewString(args.TagsAction), "tag_update_policy")
  251. }
  252. if len(args.OrgNodeId) > 0 {
  253. params.Add(jsonutils.NewStringArray(args.OrgNodeId), "org_node_id")
  254. }
  255. result, err := modules.Policies.Update(s, policyId, params)
  256. if err != nil {
  257. return err
  258. }
  259. printObject(result)
  260. return nil
  261. }
  262. R(&PolicyPatchOptions{}, "policy-patch", "Patch policy", updateFunc)
  263. R(&PolicyPatchOptions{}, "policy-update", "Update policy", updateFunc)
  264. type PolicyPublicOptions struct {
  265. ID string `help:"ID of policy to update" json:"-"`
  266. Scope string `help:"sharing scope" choices:"system|domain"`
  267. SharedDomains []string `help:"share to domains"`
  268. }
  269. R(&PolicyPublicOptions{}, "policy-public", "Mark a policy public", func(s *mcclient.ClientSession, args *PolicyPublicOptions) error {
  270. params := jsonutils.Marshal(args)
  271. result, err := modules.Policies.PerformAction(s, args.ID, "public", params)
  272. if err != nil {
  273. return err
  274. }
  275. printObject(result)
  276. return nil
  277. })
  278. type PolicyPrivateOptions struct {
  279. ID string `help:"ID of policy to update" json:"-"`
  280. }
  281. R(&PolicyPrivateOptions{}, "policy-private", "Mark a policy private", func(s *mcclient.ClientSession, args *PolicyPrivateOptions) error {
  282. result, err := modules.Policies.PerformAction(s, args.ID, "private", nil)
  283. if err != nil {
  284. return err
  285. }
  286. printObject(result)
  287. return nil
  288. })
  289. type PolicyDeleteOptions struct {
  290. ID string `help:"ID of policy"`
  291. }
  292. R(&PolicyDeleteOptions{}, "policy-delete", "Delete policy", func(s *mcclient.ClientSession, args *PolicyDeleteOptions) error {
  293. policyId, err := modules.Policies.GetId(s, args.ID, nil)
  294. if err != nil {
  295. return err
  296. }
  297. result, err := modules.Policies.Delete(s, policyId, nil)
  298. if err != nil {
  299. return err
  300. }
  301. printObject(result)
  302. return nil
  303. })
  304. type PolicyShowOptions struct {
  305. ID string `help:"ID of policy"`
  306. Format string `help:"policy format, default yaml" default:"yaml" choices:"yaml|json"`
  307. Save string `help:"save policy data into a file"`
  308. }
  309. R(&PolicyShowOptions{}, "policy-show", "Show policy", func(s *mcclient.ClientSession, args *PolicyShowOptions) error {
  310. query := jsonutils.NewDict()
  311. query.Add(jsonutils.NewString(args.Format), "format")
  312. result, err := modules.Policies.Get(s, args.ID, query)
  313. if err != nil {
  314. return err
  315. }
  316. printObject(result)
  317. if len(args.Save) > 0 {
  318. if args.Format == "yaml" {
  319. yaml, _ := result.GetString("policy")
  320. fileutils2.FilePutContents(args.Save, yaml, false)
  321. } else {
  322. p, _ := result.Get("policy")
  323. fileutils2.FilePutContents(args.Save, p.PrettyString(), false)
  324. }
  325. }
  326. return nil
  327. })
  328. type PolicyEditOptions struct {
  329. ID string `help:"ID of policy"`
  330. }
  331. R(&PolicyEditOptions{}, "policy-edit", "Edit and update policy", func(s *mcclient.ClientSession, args *PolicyEditOptions) error {
  332. query := jsonutils.NewDict()
  333. query.Add(jsonutils.NewString("yaml"), "format")
  334. result, err := modules.Policies.Get(s, args.ID, query)
  335. if err != nil {
  336. return err
  337. }
  338. policyId, err := result.GetString("id")
  339. if err != nil {
  340. return err
  341. }
  342. yaml, err := result.GetString("policy")
  343. if err != nil {
  344. return err
  345. }
  346. yaml, err = shellutils.Edit(yaml)
  347. if err != nil {
  348. return err
  349. }
  350. params := jsonutils.NewDict()
  351. params.Add(jsonutils.NewString(yaml), "policy")
  352. result, err = modules.Policies.Patch(s, policyId, params)
  353. if err != nil {
  354. return err
  355. }
  356. printObject(result)
  357. return nil
  358. })
  359. type PolicyBindRoleOptions struct {
  360. POLICY string `json:"-" help:"policy Id or name"`
  361. api.PolicyBindRoleInput
  362. }
  363. R(&PolicyBindRoleOptions{}, "policy-bind-role", "Policy bind role", func(s *mcclient.ClientSession, args *PolicyBindRoleOptions) error {
  364. params := jsonutils.Marshal(args)
  365. log.Debugf("params: %s", params)
  366. result, err := modules.Policies.PerformAction(s, args.POLICY, "bind-role", params)
  367. if err != nil {
  368. return err
  369. }
  370. printObject(result)
  371. return nil
  372. })
  373. type PolicyAdminCapableOptions struct {
  374. User string `help:"For user"`
  375. UserDomain string `help:"Domain for user"`
  376. Project string `help:"Role assignments for project"`
  377. ProjectDomain string `help:"Domain for project"`
  378. Role []string `help:"Role name list"`
  379. RoleId []string `help:"Role Id list"`
  380. }
  381. R(&PolicyAdminCapableOptions{}, "policy-admin-capable", "Check admin capable", func(s *mcclient.ClientSession, args *PolicyAdminCapableOptions) error {
  382. auth.InitFromClientSession(s)
  383. policy.EnableGlobalRbac(15*time.Second, false, 1)
  384. var token mcclient.TokenCredential
  385. if len(args.User) > 0 {
  386. token = &mcclient.SSimpleToken{
  387. Domain: args.UserDomain,
  388. User: args.User,
  389. Project: args.Project,
  390. ProjectDomain: args.ProjectDomain,
  391. Roles: strings.Join(args.Role, ","),
  392. RoleIds: strings.Join(args.RoleId, ","),
  393. }
  394. } else {
  395. token = s.GetToken()
  396. }
  397. fmt.Println("Token", token)
  398. for _, scope := range []rbacscope.TRbacScope{
  399. rbacscope.ScopeSystem,
  400. rbacscope.ScopeDomain,
  401. rbacscope.ScopeProject,
  402. rbacscope.ScopeUser,
  403. rbacscope.ScopeNone,
  404. } {
  405. fmt.Printf("%s: ", scope)
  406. capable := policy.PolicyManager.IsScopeCapable(token, scope)
  407. fmt.Println(capable)
  408. }
  409. return nil
  410. })
  411. type PolicyExplainOptions struct {
  412. User string `help:"For user"`
  413. UserDomain string `help:"Domain for user"`
  414. Project string `help:"Role assignments for project"`
  415. Role []string `help:"Roles"`
  416. RoleId []string `help:"Role Id list"`
  417. Request []string `help:"explain request, in format of key:scope:service:resource:action:extra"`
  418. Name string `help:"policy name"`
  419. Debug bool `help:"enable RBAC debug"`
  420. ProjectDomain string `help:"Domain name"`
  421. Ip string `help:"login IP"`
  422. }
  423. R(&PolicyExplainOptions{}, "policy-explain", "Explain policy result", func(s *mcclient.ClientSession, args *PolicyExplainOptions) error {
  424. err := log.SetLogLevelByString(log.Logger(), "debug")
  425. if err != nil {
  426. log.Fatalf("Set log level %q: %v", "debug", err)
  427. }
  428. if args.Debug {
  429. rbacutils.ShowMatchRuleDebug = true
  430. }
  431. auth.InitFromClientSession(s)
  432. policy.EnableGlobalRbac(15*time.Second, false, 1)
  433. if args.Debug {
  434. consts.EnableRbacDebug()
  435. }
  436. req := jsonutils.NewDict()
  437. for i := 0; i < len(args.Request); i += 1 {
  438. parts := strings.Split(args.Request[i], ":")
  439. if len(parts) < 3 {
  440. return fmt.Errorf("invalid request, should be in the form of key:[system|domain|project]:service[:resource:action:extra]")
  441. }
  442. key := parts[0]
  443. data := make([]jsonutils.JSONObject, 0)
  444. for i := 1; i < len(parts); i += 1 {
  445. data = append(data, jsonutils.NewString(parts[i]))
  446. }
  447. req.Add(jsonutils.NewArray(data...), key)
  448. }
  449. fmt.Println("Request:", req.String())
  450. var token mcclient.TokenCredential
  451. if len(args.User) > 0 {
  452. usrParams := jsonutils.NewDict()
  453. if len(args.UserDomain) > 0 {
  454. usrDom, err := modules.Domains.Get(s, args.UserDomain, nil)
  455. if err != nil {
  456. return fmt.Errorf("search user domain %s fail %s", args.UserDomain, err)
  457. }
  458. usrDomId, _ := usrDom.Get("id")
  459. usrParams.Add(usrDomId, "domain_id")
  460. }
  461. usr, err := modules.UsersV3.Get(s, args.User, usrParams)
  462. if err != nil {
  463. return fmt.Errorf("search user %s fail %s", args.User, err)
  464. }
  465. usrId, _ := usr.GetString("id")
  466. usrName, _ := usr.GetString("name")
  467. usrDomId, _ := usr.GetString("domain_id")
  468. usrDom, _ := usr.GetString("domain")
  469. projParams := jsonutils.NewDict()
  470. if len(args.ProjectDomain) > 0 {
  471. projDom, err := modules.Domains.Get(s, args.ProjectDomain, nil)
  472. if err != nil {
  473. return fmt.Errorf("search project domain %s fail %s", args.ProjectDomain, err)
  474. }
  475. projDomId, _ := projDom.Get("id")
  476. projParams.Add(projDomId, "domain_id")
  477. }
  478. proj, err := modules.Projects.Get(s, args.Project, projParams)
  479. if err != nil {
  480. return fmt.Errorf("search project %s fail %s", args.Project, err)
  481. }
  482. projId, _ := proj.GetString("id")
  483. projName, _ := proj.GetString("name")
  484. projDom, _ := proj.GetString("domain")
  485. projDomId, _ := proj.GetString("domain_id")
  486. token = &mcclient.SSimpleToken{
  487. Domain: usrDom,
  488. DomainId: usrDomId,
  489. User: usrName,
  490. UserId: usrId,
  491. Project: projName,
  492. ProjectId: projId,
  493. ProjectDomain: projDom,
  494. ProjectDomainId: projDomId,
  495. Roles: strings.Join(args.Role, ","),
  496. RoleIds: strings.Join(args.RoleId, ","),
  497. Context: mcclient.SAuthContext{
  498. Ip: args.Ip,
  499. },
  500. Token: "faketoken",
  501. }
  502. } else {
  503. token = s.GetToken()
  504. }
  505. result, err := policy.ExplainRpc(context.Background(), token, req, args.Name)
  506. if err != nil {
  507. return err
  508. }
  509. printObject(result)
  510. /*for _, r := range args.Role {
  511. fmt.Println("role", r, "matched policies:", policy.PolicyManager.RoleMatchPolicies(r))
  512. }
  513. fmt.Println("userCred:", token)
  514. for _, scope := range []rbacutils.TRbacScope{
  515. rbacutils.ScopeSystem,
  516. rbacutils.ScopeDomain,
  517. rbacutils.ScopeProject,
  518. rbacutils.ScopeUser,
  519. rbacutils.ScopeNone,
  520. } {
  521. m := policy.PolicyManager.MatchedPolicyNames(scope, token)
  522. fmt.Println("matched", scope, "policies:", m)
  523. }
  524. fmt.Println("all_policies", policy.PolicyManager.AllPolicies())*/
  525. return nil
  526. })
  527. }