code: def my_permissions(args: Namespace) -> None:
      session = setup_session(args)
      resp = bindings.get_GetPermissionsSummary(session)
      if args.json:
          determined.cli.render.print_json(resp.to_json())
          return
  
      role_id_to_permissions: Dict[int, Set[bindings.v1Permission]] = {}
      for r in resp.roles:
          if r.permissions is not None and r.roleId is not None:
              role_id_to_permissions[r.roleId] = set(r.permissions)
  
      scope_id_to_permissions: Dict[
          int, Set[bindings.v1Permission]
      ] = {}
      for a in resp.assignments:
          if a.roleId is None:
              raise api.errors.BadResponseException(
                  "expected roleId to be provided"
              )
  
          if a.scopeCluster:
              if 0 not in scope_id_to_permissions:
                  scope_id_to_permissions[0] = set()
              scope_id_to_permissions[0].update(
                  role_id_to_permissions[a.roleId]
              )
  
          if a.scopeWorkspaceIds is None:
              a.scopeWorkspaceIds = []
          for wid in a.scopeWorkspaceIds:
              if wid not in scope_id_to_permissions:
                  scope_id_to_permissions[wid] = set()
              scope_id_to_permissions[wid].update(
                  role_id_to_permissions[a.roleId]
              )
  
      if len(scope_id_to_permissions) == 0:
          print("no permissions assigned")
          return
      for wid, perms in scope_id_to_permissions.items():
          if wid == 0:
              print("global permissions assigned")
          else:
              workspace_name = bindings.get_GetWorkspace(
                  session, id=wid
              ).workspace.name
              print(
                  f"permissions assigned over workspace '{workspace_name}' with ID '{wid}'"
              )
  
          render.render_objects(
              v1PermissionHeaders,
              [
                  render.unmarshal(v1PermissionHeaders, p.to_json())
                  for p in perms
              ],
          )
          print()
  
file_path: determined/harness/determined/cli/rbac.py
imports: from argparse import Namespace
  from collections import namedtuple
  from typing import Any, Dict, List, Set, Tuple
  import determined.cli.render
  from determined.cli import default_pagination_args, render, require_feature_flag, setup_session
  from determined.common import api
  from determined.common.api import authentication, bindings
  from determined.common.declarative_argparse import Arg, Cmd
label_desc: Use image node_id 1 for calling a global function with example usage: my_permissions(args) without return types