...
Code Block |
---|
CREATE OR REPLACE ROLE data_strategy '' GRANT CONNECT, METADATA, EXECUTE ON test; CREATE OR REPLACE ROLE iam '' GRANT CONNECT, METADATA, EXECUTE ON test; CREATE OR REPLACE ROLE read_test '' GRANT CONNECT, METADATA, EXECUTE ON test; CREATE OR REPLACE ROLE general '' GRANT CONNECT, METADATA, EXECUTE ON test; CREATE OR REPLACE TAG rls_dept DESCRIPTION = 'Used to tag views that should have RLS applied based on department'; CREATE OR REPLACE GLOBAL_SECURITY_POLICY rls_hide_all DESCRIPTION = 'Hides all rows for RLS-enabled views' ENABLED = TRUE AUDIENCE ( NOT_IN ROLES (data_strategy, iam, read_test) ) ELEMENTS ( COLUMNS TAGGED ANY (rls_dept) ) RESTRICTION ( FILTER = '0=1' REJECT ); CREATE OR REPLACE GLOBAL_SECURITY_POLICY rls_dept_data_strategy DESCRIPTION = 'RLS department policy for data strategy' ENABLED = TRUE AUDIENCE ( ANY ROLES (data_strategy) ) ELEMENTS ( COLUMNS TAGGED ANY (rls_dept) ) RESTRICTION ( FILTER = 'rls_dept = ''DS''' REJECT ); CREATE OR REPLACE GLOBAL_SECURITY_POLICY rls_dept_iam DESCRIPTION = 'RLS department policy for data strategy' ENABLED = TRUE AUDIENCE ( ANY ROLES (iam) ) ELEMENTS ( COLUMNS TAGGED ANY (rls_dept) ) RESTRICTION ( FILTER = 'rls_dept = ''IAM''' REJECT ); CREATE OR REPLACE GLOBAL_SECURITY_POLICY rls_dept_mask_confidential DESCRIPTION = 'Applies confidential CLS to department-based RLS views' ENABLED = TRUE AUDIENCE ( NOT_IN ROLES (data_strategy, iam) ) ELEMENTS ( VIEWS TAGGED ANY (rls_dept) ) RESTRICTION ( FILTER = '' MASKING ANY (confidential) WITH (HIDE) (numbers WITH DEFAULT, datetimes WITH DEFAULT, texts WITH DEFAULT) ); CREATE OR REPLACE GLOBAL_SECURITY_POLICY rls_dept_mask_restricted DESCRIPTION = 'Applies confidential CLS to department-based RLS views' ENABLED = TRUE AUDIENCE ( ANYNOT_IN ROLES (data_strategyiam) ) ELEMENTS ( VIEWS TAGGED ANY (rls_dept) ) RESTRICTION ( FILTER = '' MASKING ANY (restricted) WITH (HIDE) (numbers WITH DEFAULT, datetimes WITH DEFAULT, texts WITH DEFAULT) ); |
...
This can be expanded upon by leveraging user attributes from LDAP/SAML: https://community.denodo.com/kb/en/view/document/How%20to%20implement%20ABAC%20Capabilities%20with%20Global%20Security%20Policies
...
Note that if you have multiple data sources, users will be prompted for credentials for each data source. Thankfully Tableau can remember passwords for each user and data source and it’s recommended that users do this. Note that Tableau hashes credentials for a data source based on the server name NOT the data source name. Because of this, if you have multiple data sources based on the same server, Tableau will use the last set of credentials you enter for that server.
...
The above approach does require that data sources be Live. Because of this, all views should be optimized and cached to ensure adequate performance.
...