Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

What does @AccessControl.authorizationCheck: #PRIVILEGED_ONLY mean?

friendlycoder
Participant
0 Likes
14,909

Hi all

I have a question regarding to following default CDS view:

@AbapCatalog.sqlViewName: 'IDFSUSERDETL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@EndUserText.label: 'User Details Basic View'
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #L
@VDM.viewType: #BASIC
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.lifecycle.contract.type:        #SAP_INTERNAL_API
define view I_DFS_MaintUserDetailsBasic as select from           usr02
    inner join             usr21     on usr02.bname = usr21.bname
    left outer to one join adrp      on  usr21.persnumber = adrp.persnumber
                                     and adrp.nation      = ''
                                     and adrp.date_from   = '00010101'
{
  key usr21.bname as UserID,
      usr02.gltgv as DfsObjectValdtyStartDate,
      usr02.gltgb as DfsObjectValdtyEndDate,
      adrp.name_first as FirstName,
      adrp.name_text as FullName
}
//where ustyp = 'A'

What does the annotation @AccessControl.authorizationCheck: #PRIVILEGED_ONLY mean? When I click on the Data Preview, it shows me an empty table:

I am pretty sure, it is because of the annotation @AccessControl.authorizationCheck: #PRIVILEGED_ONLY.

How to make the visible on the Preview Data?

Thanks

1 ACCEPTED SOLUTION
Read only

Jelena_Perfiljeva
Active Contributor
10,877

My first reaction was "ugh, why don't people just read the documentation" but a quick search revealed that this option seems to be largely undocumented for some reason. This SAP Help article (top link in Google) mentions that PRIVILEGED_ONLY is a possible value but has no explanation for it whatsoever.

ABAP documentation states:

"Privileged association (evaluated by SADL)."

And it's only when we drill down into SADL Consumption documentation, we can find:

"SADL is always integrated into a real concept - for example, a UI technology - but is not intended to be used by an application developer directly."

So, I'm guessing this answers your question: it's not feasible because this view is not meant to be called directly. I'm guessing you could copy it into a custom view and remove authorization check (just for testing purposes obviously, not for productive use) but it could be related to the private data protection under GDPR, so you might want to take a step back and reflect on what you're trying to do here.

Hi all

I have a question regarding to following default CDS view:

@AbapCatalog.sqlViewName: 'IDFSUSERDETL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@EndUserText.label: 'User Details Basic View'
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #L
@VDM.viewType: #BASIC
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.lifecycle.contract.type:        #SAP_INTERNAL_API
define view I_DFS_MaintUserDetailsBasic as select from           usr02
    inner join             usr21     on usr02.bname = usr21.bname
    left outer to one join adrp      on  usr21.persnumber = adrp.persnumber
                                     and adrp.nation      = ''
                                     and adrp.date_from   = '00010101'
{
  key usr21.bname as UserID,
      usr02.gltgv as DfsObjectValdtyStartDate,
      usr02.gltgb as DfsObjectValdtyEndDate,
      adrp.name_first as FirstName,
      adrp.name_text as FullName
}
//where ustyp = 'A'

What does the annotation @AccessControl.authorizationCheck: #PRIVILEGED_ONLY mean? When I click on the Data Preview, it shows me an empty table:

I am pretty sure, it is because of the annotation @AccessControl.authorizationCheck: #PRIVILEGED_ONLY.

How to make the visible on the Preview Data?

Thanks

3 REPLIES 3
Read only

Jelena_Perfiljeva
Active Contributor
10,878

My first reaction was "ugh, why don't people just read the documentation" but a quick search revealed that this option seems to be largely undocumented for some reason. This SAP Help article (top link in Google) mentions that PRIVILEGED_ONLY is a possible value but has no explanation for it whatsoever.

ABAP documentation states:

"Privileged association (evaluated by SADL)."

And it's only when we drill down into SADL Consumption documentation, we can find:

"SADL is always integrated into a real concept - for example, a UI technology - but is not intended to be used by an application developer directly."

So, I'm guessing this answers your question: it's not feasible because this view is not meant to be called directly. I'm guessing you could copy it into a custom view and remove authorization check (just for testing purposes obviously, not for productive use) but it could be related to the private data protection under GDPR, so you might want to take a step back and reflect on what you're trying to do here.

Read only

10,877

Hi,

I could find a BLOG here regarding this topic. There is mentioned the following:

"is used when the data should be blocked completely from a CDS view entity. The data can be accessed using specific annotation in the CDS view which is trying to access data from a CDS view protected by a DCL0.The annotation included in CDS view is @AccessConrtol.authorizatonCheck: #PRIVILEGED_ONLY"

In the view containing this association to your default view you can define privileged associations as described here.

@AccessControl.privilegedAssociations: [ _myassociation ]

For development tasks to see the content of the table in ADT you can open the SQL console and add behind the FROM clause 'WITH PRIVILEGED ACCESS' example: FROM MY_TABLE WITH PRIVILEGED ACCESS

Best regards.

Read only

0 Likes
10,877

Like Steve mentioned, in ADT we can add 'With Privileged Access' in the SQL console to see data and bypass SADL check. More in note 2725274 - Access to CDS Entities is unconditionally blocked by CDS Access Control.