Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Access Plugin through URL

More
2 years 7 months ago #228238 by tassoman
Replied by tassoman on topic Access Plugin through URL
Ciao Denis, how to check if the current request plugin url is requested during the same session of the previous request?

I need to access the session, I guess... So I need the framework's singleton? Is there some way to check?

Maybe Yii::app()->getSession() ?

«All your survey answers are belong to us »

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
2 years 7 months ago #228242 by DenisChenu
Replied by DenisChenu on topic Access Plugin through URL
Permission ? Or just session ?

I test a lot if Survey session is set (with current id) to avoid some bad request.

gitlab.com/SondagesPro/QuestionSettingsT...ExtraSurvey.php#L593
App()->getSession()->get("survey_{$sid}") for example

I save plugin data in "survey_{$sid}" if i need to be resetted withn current survey or in my own session.

See gitlab.com/SondagesPro/QuestionSettingsT...sheetSurvey.php#L949

Session created during question view

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

More
2 years 7 months ago #228244 by tassoman
Replied by tassoman on topic Access Plugin through URL
Yes, you got it. I'm trying to add a controller who lets download answers in a custom PDF on the way (without saving it inside filesystem).
So I need to check the request is coming from the same client who answered before.
I've collected (sid+rid+seed) from afterSurveyComplete then I want to check that parameters with current session.

I've tried App()->getSession()->get("survey_{$sid}") but i get NULL value :|
Is it for 5.x LS? I'm still at 3.X

«All your survey answers are belong to us »

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
2 years 7 months ago #228257 by DenisChenu
Replied by DenisChenu on topic Access Plugin through URL
Session is resetted at end of submission.
After aftgerSurveyComplete

Then save right in you own session var :
gitlab.com/SondagesPro/ExportAndStats/pd...r/pdfReport.php#L535

gitlab.com/SondagesPro/ExportAndStats/pd...r/pdfReport.php#L444

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: tassoman

Please Log in to join the conversation.

More
2 years 7 months ago #228271 by tassoman
Replied by tassoman on topic Access Plugin through URL
Good point! I was forgotting about session expiration. So that I need to serialize my parameters inside a new session parameter and check for it inside the NewDirectController.
It's a very bad deal to pass them inside a GET parameter. Never do it.

«All your survey answers are belong to us »

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose