cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Access $user.attr in a CDS projection

T1mey
Active Participant
327

Hello CAP experts,

I have a list of attributes coming from our IDP. Now I wanna like limit the list of overall "LDAPGroups" to the one's the user has.

 

    entity LDAPGroups as
        projection on app.LDAPGroups
        where ldapDn IN ($user.LDAPGroups);
 
The thing is  that the compiler complains:
 
Error: No value found for variable “$user.LDAPGroups”. Use option ‘variableReplacements’ to specify a value for “$user.LDAPGroups”
 
I tried to use the 
 
session_context('$user.LDAPGroups')
 
in various combinations... but no luck with it. Anybody an idea how I can solve this?
 
 

Accepted Solutions (1)

Accepted Solutions (1)

T1mey
Active Participant

Found it by myself... This does the trick.

 

 @restrict: [
        {
            grant: [ 'READ' ],
            where: 'ldapDn IN ($user.LDAP_Groups)'
        }
    ]
    @readonly
    entity LDAPGroups as
        projection on app.LDAPGroups;

Answers (0)