アプリケーションロール:コンシューマーが同じデータの各種ビューを共有できるようにする¶
プロバイダーは、アプリケーションロールを Declarative Native App に含めることで、コンシューマーエクスペリエンスを向上させることができます。アプリケーションロールは、Declarative Native App のコンテキスト内で作成された認証情報です。アプリケーションロールの情報については、アプリケーションロールについて をご参照ください。
アプリケーションロールはアプリケーションのセキュリティを分離するので、アプリケーションの特定のセキュリティ認証情報を、より広範なコンシューマーの組織のセキュリティモデル内で管理する必要がありません。 アプリケーションロールを使用すると、プロバイダーはアプリケーションリソースへのアクセスを簡単に制御できます。コンシューマーアカウントは、シンプルな SQL GRANT ステートメントを使用して、アプリケーションのロジックとデータへのアクセスを付与できます。
たとえば、アプリケーションが Operations アプリケーションロールを使用してログテーブルにアクセスする場合、コンシューマーはアプリケーションのコンテキスト外でそのアプリケーションロールを維持する必要はありません。知っておく必要があるのは、Operations アプリケーションロールを使用してサポートチームとアプリケーションを共有できるということだけです。
Using the manifest file, you define application roles, and assign them to content in the app. When the consumer installs the app, they can share the content with their organization members by assigning the application roles to their account roles and users. Consumers can also create hierarchies of application roles by assigning application roles to other application roles.
アプリケーションロールにより、コンシューマーは組織のメンバーとさまざまな方法でデータを共有できます。たとえば、1つのアプリに、データの完全なビューを含むノートブックと、フィルタリングされたビューを含むノートブックという、データを表示する2つのノートブックを含めることができます。
これで、コンシューマーアプリの所有者は、フィルタリングされたビューをチームと共有することを選択できる一方、自分自身は完全なビューにアクセス可能なままです。
アプリケーションロールを使用してデータベースリソースへのアクセスを許可すると、子リソースは親リソースのロールを継承します。たとえば、アプリケーションロールをスキーマに割り当てると、そのスキーマのすべてのテーブルとビューがそのロールを継承します。データベースにアプリケーションロールを割り当てると、そのデータベースのすべてのスキーマ、テーブル、およびビューがロールを継承します。
マニフェストファイルのコンテンツにアプリケーションロールを割り当てる¶
In the manifest file, in the top-level roles field, define the available application roles, for example,
sales,marketing, andoperations.roles: - sales: comment: "The sales role provides access to the filtered view of the sales data." - marketing: comment: "The marketing role provides access to the filtered view of the marketing data." - operations: comment: "The operations role provides access to the full view of the data, including logs."
Copyリストを使用して、マニフェストファイルのコンテンツにアプリのロールを割り当てます。例:
roles: [sales, support]- customer_table: roles: [sales,marketing] # Accessible to sales and marketing, app owners
Copyテーブルを追加するには、ロールを
<named table>.rolesと、テーブルが存在する<named schema>.rolesの両方に追加します。schemas: - sales_table: roles: [sales] tables: - sales_table: roles: [sales]
Copyビューを追加するには、ロールを
<named view>.rolesと、ビューが存在する<named schema>.rolesの両方に追加します。schemas: - sales_view: roles: [sales] views: - sales_view: roles: [sales]
Copyテーブルのフィルタリングされたビューを追加する場合は、基になるテーブルを追加しないでください。これにより、ユーザーがフィルター処理されていないデータにアクセスすることを防ぎます。
ノートブックを含めるには、ロールを
<named notebook>.rolesに追加し、ノートブックで参照されるテーブルとビュー(およびその基になるスキーマ)を追加します。notebooks: - SALES_NB: main_file: ALL-DATA.ipynb roles: [sales] comment: Accessible to sales and app owners, references full view of the sales data
Copyテーブルのフィルタリングされたビューを参照するノートブックを追加する場合は、基になるテーブルを追加しないでください。これにより、ユーザーによるフィルター処理されていないデータへのアクセスを防ぎます。
To give an object no app roles, either leave the field empty (
[]) or omit it. These objects are only accessible by the app owner and roles with granted IMPORTED PRIVILEGES.
- my_schema: roles: [] # Accessible to app owners onlyCopy
マニフェストファイルの例:
roles:
- sales:
comment: "The sales role provides access to the filtered view of the sales data."
- marketing:
comment: "The marketing role provides access to the filtered view of the marketing data."
- operations:
comment: "The operations role provides access to the full view of the log data."
application_content:
notebooks:
- SALES_NB:
main_file: ALL-DATA.ipynb
roles: [sales]
comment: Accessible to sales and app owners, references full view of the sales data
- MARKETING_NB:
main_file: FILTERED.ipynb
roles: [marketing] #
comment: Accessible to marketing and app owners, references filtered view of the marketing data
shared_content:
databases:
- my_database:
schemas:
- my_schema:
roles: [] # Accessible to app owners
tables:
- sales_table:
roles: [sales] # Accessible to sales, app owners
- marketing_table:
roles: [marketing] # Accessible to marketing, app owners
- customer_table:
roles: [sales,marketing] # Accessible to sales and marketing, app owners
- logs_table:
roles: [operations] # Accessible to operations and app owners
views:
- sales_view:
roles: [sales] # Accessible to sales and app owners
- marketing_view:
roles: [marketing] # Accessible to marketing and app owners
- customer_view:
roles: [sales,marketing] # Accessible to sales, marketing, and app owners
- operations_view:
roles: [operations] # Accessible to operations and app owners
その後、コンシューマーがアプリをインストールすると、ノートブック、テーブル、ビューの両方にアクセスできるようになります。
運用ビューをサポートチームと共有するには、operations アプリケーションロールをサポートチームの組織ロールに付与します。
GRANT APPLICATION ROLE customer_app.operations TO ROLE support_team_west;
support_team_west ロールを持つコンシューマーチームメンバーは logs テーブルを表示できますが、Snowsight の**Available Notebooks** タブのノートブックは表示できず、sales および customers のテーブルとビューにもアクセスできません。
salesビューを営業チームと共有するには、sales アプリケーションロールを営業組織のロールに付与します。
GRANT APPLICATION ROLE customer_app.sales TO ROLE sales_team_east;
sales_team_east ロールを持つコンシューマーチームのメンバーは、Snowsight の Available Notebooks タブのノートブックを表示できます。logs テーブルは表示できませんが、sales および customers のテーブルとビューにはアクセスできます。
For more information about how consumers share roles, see アプリへの共有アクセス.