Sunteți pe pagina 1din 17

Technical Paper

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

1 Opening SAP HANA Studio


Launch SAP HANA Studio by navigating to: Start > All Programs > SAP HANA Studio.

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

2 Create Analytic Privilege


Right click the applicable Package under Content and click New > Analytic Privilege. NOTE: If a package does not exist create a new package by right clicking Content, click New > Package The naming convention for SAP HANA Packages should only contain lowercase alphabets (a-z), number (0-9) and up to 9 dots (.) Dots must not be the last character in a package name.

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

3 Dene Analytic Privilege


Once the Information Model(s) have been selected the following screen is presented. There are 3 main areas of interest (labelled 1-3) in the diagram on this page. 1 Reference Models Select additional views for which this privilege should be valid (optional). 2 Associated Attributes Restrictions Select attributes on which a restriction shall be dened (All elds from the views selected in Section 1 will be shown). 3 Assign Restrictions Dene value restrictions for the attributes selected in Section 2. NOTE: Although this section is labelled Assign Restrictions the actual action is to provide an allowance e.g. - A restriction prevents an action where it is granted by default - An allowance enables an action where it is denied by default

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

4 Assigning Analytic Privilege


There are 2 methods to achieve this; create a user with specic privileges or by creating a Role and applying the role to a user. For further information regarding privileges provided below please see References [1] NOTE: Assigning Analytic Privileges is done as administrator task (i.e. SYSTEM or user with relevant permissions to grant privileges and creating users/roles). 4.1 Method 1: Creating a user with specic privileges Log on as a SYSTEM user. Create a new user called CAL_USR and assign the following roles and privileges. NOTE: The naming convention for SAP HANA Roles should not contain spaces or special characters except (_). Granted Roles Public 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.

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

5 Consuming Analytic Privilege


This section will detail how to check that the user can read from Analytic View AN_EFASHION as expected within SAP HANA Studio. NOTE: There are various other ways to consume data from a SAP HANA database (Microsoft Excel, SAP BusinessObjects BI Clients etc.) which are not covered in this document. 5.1 Add new system for user Log on as a SYSTEM user. Create a new user called CAL_USR and assign the following roles and privileges. 1 Under the Navigator section right click the white space and click Add System 2 Enter Hostname, Instance number and Description (Description is optional). Click Next. 3 Enter CAL_USR and password created above as the authenticated user. Click Next. 4 Click Finish.

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

Condentiality, Liability & Copyright


This document shall be treated as condential. This document is only to be used and copied within the client company and in relation to the intended activity. The information and methodology in this document are proprietary to ENTOTA. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of ENTOTA. The information contained herein may be changed without prior notice. ENTOTA assumes no responsibility for errors or omissions in this document. ENTOTA does not warrant the accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, tness for a particular purpose, or non-infringement. ENTOTA shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence. The statutory liability for personal injury and defective products is not affected. ENTOTA has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages.

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 info@entota.com

www.twitter.com/entota

www.linkedin.com/company/entota

S-ar putea să vă placă și