SDI with SPA component

Avatar

Avatar
Validate 1
Level 1
navjots90210021
Level 1

Like

1 like

Total Posts

14 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
navjots90210021
Level 1

Like

1 like

Total Posts

14 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
navjots90210021
Level 1

23-01-2020

All data to react (frontend) comes via .model.json, which contains all info of the page. If I want to have a component that should not be cached, rather gets called on every request and then .model.json should always gets updated content, how we can do that ? 

Use case is : On each request, I want to check whether the user is allowed for particular action and then pass that true/false to the model.json so that react does not render the component (want to achieve CUG at component level )

 

Do not wish to create a servlet as this info is required before page rendering and ajax call would delay rendering.

 

Also, can we still add HTL on component in AEM that been mapped with React so that data attributes can be read by react component during rendering ? And then use SDI on that component ?

 

Any pointers ? @Jörg_Hoh 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

22-02-2020

Hi,

I wouldn't do that this way, because it can open a security hole. Just call the models.json and let the server-side implementation all the rest. If the user has enough permissions, the "secured" data is included in the model, otherwise it's omitted (or a flag set to false). 

And yes, CUG is working with requests to model.json as well.

Answers (1)

Answers (1)

Avatar

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
MVP
Singaiah_Chintalapudi
MVP

Likes

131 likes

Total Posts

234 posts

Correct reply

39 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
Singaiah_Chintalapudi
MVP

29-03-2021

Just a thought: Perform a thorough testing with the SDI. I would prefer writing a schedulers or other approaches instead of using SDI.