ENT Creating Analytic Privileges in SAP HANA Studio
ENT Creating Analytic Privileges in SAP HANA Studio
This technical brieng paper explains the Analytic Privilege functionality that comes under User Management of SAP HANA and aims to provide a high level understanding of SAP HANA Analytic Privileges including how to create, design and assign them.
Analytic Privileges are used in the SAP HANA database to provide ne-grained control of what data particular users can see for analytic use. They provide the ability for row-level authorization, based on ltering the values in one or more columns. All Attribute Views, Analytic Views, and Calculation Views, which have been designed in the information modeler and have been activated from the information modeler of the SAP HANA studio, are automatically supported by the Analytic Privilege mechanism. [1]
The following steps will demonstrate the granting of Analytic Privileges to users CAL_USR and CAL_USR_2 in order to allow reporting of the Analytic View (AN_EFASHION), restricting access to only show data for the STATE California.
www.entota.com
Prerequisites / Assumptions
It is recommended that the reader of this document has implemented the following: SAP HANA Database has already been set up and congured and is reachable from the SAP HANA Studio. Data has been loaded into the SAP HANA Database and created the applicable Attribute and Analytic Views from the efashion tutorial. [2] Modelling privileges are present for the authenticating user when creating the Analytic Privilege. SYSTEM privileges are present for the authenticating user when creating users, systems and assign roles / privileges. It is assumed that the reader of this document is familiar with: SAP HANA Database Administrator (Version 1.50). SAP HANA Studio (Version 1.0.29) and the components within e.g. Packages etc. NOTE: Analytic Privileges can only be activated once. If there is a need to change the Analytic Privilege after it has been successfully activated, it must be deleted and re-created from scratch.
www.entota.com
Once the SAP HANA Studio has successfully launched, connect to a SAP HANA System ensuring that: The authenticating user has a minimum of Modelling privileges present. Note: This is required to create, dene and activate the Analytic Privilege. The Modeler view is selected.
www.entota.com
www.entota.com
Enter an appropriate name and description e.g. AP_EFASHION_STATE_CALI. Click Next. NOTE: The naming convention for Analytic Privileges should only contain alphabets (a-z, A-Z), number (0-9) or underscores (_).
Select the required Information Model to dene the Analytic Privilege for. Click Finish. NOTE: For the purposes of this demonstration, an Analytic View is selected; however, Analytic Privileges can be applied to Attribute, Analytic and Calculation Views within SAP HANA Studio.
www.entota.com
www.entota.com
3.1 Adding Filters Under Associated Attributes Restrictions click Add Select the desired attribute, in this case STATE under the AT_OUTLET and click OK.
3.2 Adding Restrictions Under Assign Restrictions click the Add button (This increases the counter for the number of restrictions for STATE in Associated Attributes Restrictions section). Click into the Value eld in and click the ellipses icon. In the search window, search for California by typing (or partially typing) the value and clicking Find or by clicking Find to display all possible values. Select California from the search list and click OK.
www.entota.com
3.3 Activating Once the Analytic Privilege has been created, it must be saved and validated. Click the Save and Validate and Save and Activate icons.
A success message will appear under the Current tab of the Job Log. NOTE: The following window is displayed if the authenticating user has privileges higher than a Modeling user/role i.e. SYSTEM. This screen will allow the user to add or remove other inactive Analytic Privileges. Select the application Analytic Privileges and click Activate.
www.entota.com
www.entota.com
4.2 Method 2: Creating a New Role An alternative method is to create a new Role e.g. CAL_USERS and add the role to applicable users. Within SAP HANA it is recommended practise to use roles to manage authorisation. A role is a collection of privileges and can be granted to either a user or another role (nesting roles). All the privileges granted directly or indirectly to a user are combined. This means whenever a user tries to access an object, the system performs an authorisation check using the user, the users roles, and directly allocated privileges. It is not possible to explicitly deny privileges. This means that the system does not need to check all the users role. As soon as the requested privilege has been found, the system aborts the check and grants access.[1] This directly affects the view or result of your data and is a common reason why Analytic Privileges appear not to work as some indirect route may still exist to allow the action. To create a new role navigate to Catalog > Authorization > Roles right click and click New Role.
www.entota.com
10
Enter a name for the role e.g.ROLE_CAL and assign the following roles / privileges. NOTE: The naming convention for SAP HANA Roles should not contain spaces or special characters except (_). Granted Roles NONE Parted Roles NONE SQL Privilege _SYS_BI Execute With EXECUTE, SELECT, INSERT and UPDATE (not grantable to others) _SYS_BIC Execute With EXECUTE and SELECT (not grantable to others) REPOSITORY_REST (SYS) With EXECUTE (not grantable to others) Analytic Privilege AP_EFASHION_STATE_CALI (or any other Analytic Privilege that has been set up and activated) System Privilege NONE Package Privilege NAME OF PACKAGE - REPO.READ (not grantable to others) e.g. nr-efashion NOTE: Only apply ROOT Package if the Analytic Privilege is required across different packages. In some cases SAP HANA Studio has been known to not nd packages that actually exist. In this case ensure that the System node being used is not held within sub-folders in the Navigation panel. 4.2.1 Add a Role to a User Log on to the system and create a new user e.g. CAL_USR_2 or select an existing user. Add the new Role (CAL_USERS) to the user under Granted Roles and click Deploy.
www.entota.com
11
www.entota.com
12
5.2 Verify Results Once connection to the new system has been established, navigate to Content > nr-efashion > Analytic View Right click AN_EFASHION and click Data Preview from the context menu.
Verify that the data contains only records where the STATE = California.
www.entota.com
13
References [1] SAP HANA Security Guide (Including SAP HANA Database Security), SAP HANA Appliance Software SPS 04 Public Document version 1.1 24/04/2012. http://help.sap.com/hana/hana1_sec_en.pdf [2] Introduction to SAP HANA for Developers - A Pocketbook of Tutorials, Version 2.0 December 29, 2011. https://www.experiencesaphana.com/docs/DOC-1138
This concludes the steps required in order to create, dene and apply Analytic Privileges with SAP HANA Studio.
www.entota.com
14
Acronyms
DS: SAP Data service IM: Information Management
www.entota.com
15
About ENTOTA
ENTOTA is one of the largest specialist SAP Data Services consultancies providing best of breed solutions in Data Migration, Data Governance, Data Integration and Data Warehousing. Formed by some of the most experienced SAP Information Management specialists in the industry our sole focus is to help customers solve complex data challenges using SAP Data Services and related Information Management software.
We are a SAP Global Best Practice development partner and have played an active role in both the development and deployment of the SAP Data Migration framework. Our unrivalled depth of knowledge and unique approach is driven from years of project experience and a deep understanding of how data impacts business process. This combination of deep technical experience, innovative methodology, pre-built templates and commercial know means that your project will start delivering value from day one. To nd out more simply visit www.entota.com or email [email protected]
www.twitter.com/entota
www.linkedin.com/company/entota