(ctx: click.Context, verbose: bool, tags: list[str])
| 41 | @tagsOption |
| 42 | @click.pass_context |
| 43 | def feast_permissions_list_command(ctx: click.Context, verbose: bool, tags: list[str]): |
| 44 | from tabulate import tabulate |
| 45 | |
| 46 | table: list[Any] = [] |
| 47 | tags_filter = utils.tags_list_to_dict(tags) |
| 48 | |
| 49 | store = create_feature_store(ctx) |
| 50 | |
| 51 | permissions = store.list_permissions(tags=tags_filter) |
| 52 | |
| 53 | root_node = Node("permissions") |
| 54 | roles: set[str] = set() |
| 55 | |
| 56 | for p in permissions: |
| 57 | policy = p.policy |
| 58 | if not verbose: |
| 59 | cli_utils.handle_not_verbose_permissions_command(p, policy, table) |
| 60 | else: |
| 61 | if isinstance(policy, RoleBasedPolicy) and len(policy.get_roles()) > 0: |
| 62 | roles = set(policy.get_roles()) |
| 63 | permission_node = Node( |
| 64 | p.name + " " + str(list(roles)), parent=root_node |
| 65 | ) |
| 66 | else: |
| 67 | permission_node = Node(p.name, parent=root_node) |
| 68 | |
| 69 | for feast_type in p.types: |
| 70 | if feast_type in [ |
| 71 | FeatureView, |
| 72 | OnDemandFeatureView, |
| 73 | BatchFeatureView, |
| 74 | StreamFeatureView, |
| 75 | ]: |
| 76 | cli_utils.handle_fv_verbose_permissions_command( |
| 77 | feast_type, # type: ignore[arg-type] |
| 78 | p, |
| 79 | permission_node, |
| 80 | store, |
| 81 | tags_filter, |
| 82 | ) |
| 83 | elif feast_type == Entity: |
| 84 | cli_utils.handle_entity_verbose_permissions_command( |
| 85 | feast_type, # type: ignore[arg-type] |
| 86 | p, |
| 87 | permission_node, |
| 88 | store, |
| 89 | tags_filter, |
| 90 | ) |
| 91 | elif feast_type == FeatureService: |
| 92 | cli_utils.handle_fs_verbose_permissions_command( |
| 93 | feast_type, # type: ignore[arg-type] |
| 94 | p, |
| 95 | permission_node, |
| 96 | store, |
| 97 | tags_filter, |
| 98 | ) |
| 99 | elif feast_type == DataSource: |
| 100 | cli_utils.handle_ds_verbose_permissions_command( |
nothing calls this directly
no test coverage detected