View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
11388Feature requestsRemoteControlpublic2016-06-16 13:25
Reporterfrederikprijck Assigned To 
PrioritynoneSeverityfeature 
Status newResolutionopen 
Summary11388: Get participant information using token
Description

The RPC has serval methods regarding participants, all of them require a iTokenId in order to execute the desired query.

This can be useful because we can use these methods before a token has been assigned to the participant. (DB record is inserted with a blank token and updated later when a token is generated).

However, sometimes it can be useful to use the actual token (when it's available) instead of the tokenId.

Example:
We have a page, outside limesurvey in our own application, where a user can enter a token.
To be able to show information about the participant to which this token belongs to, we need to be able to call the RPC (get_participant_properties) with this token.
However, it's impossible using today's RPC due to only using the iTokenId.

A possible solution could be to add a new RPC method: get_participant_properties_by_token with the following code:
https://gist.github.com/frederikprijck/fe7580909eb6fb54ceecd857b609ca08

This code is a copy of the existing get_participant_properties, replacing a single line (https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/remotecontrol/remotecontrol_handle.php#L1646) with https://gist.github.com/frederikprijck/fe7580909eb6fb54ceecd857b609ca08#file-gistfile1-txt-L22

I don't like code duplication, so we need to figure a way to avoid code duplication without, possibly, impacting the existing get_participant_properties method.

Maybe there are other solutions? Feel free to discuss!

TagsNo tags attached.
Bug heat4
Story point estimate
Users affected %

Users monitoring this issue

There are no users monitoring this issue.

Activities

frederikprijck

frederikprijck

2016-06-15 17:41

reporter   ~39612

BTW: I can PR this whenever we come to an agreement, I just prefer to discuss this before creating a PR which possible gets rejected.

DenisChenu

DenisChenu

2016-06-16 09:32

developer   ~39616

I think we don't have actually a RC specialist/user in Dev : https://github.com/LimeSurvey/LimeSurvey/commits/master/application/helpers/remotecontrol

DenisChenu

DenisChenu

2016-06-16 09:39

developer   ~39617

PS : you're right for codeDuplication, we have a lot.

Maybe add some private fucntion:

checkSurveysExist($iSurveyId)
checkTokensExist($iSurveyId)
checkPermisssion(????) : just like model ?

Each of this private function throw error directly , then : for the gist :
checkPermisssion(response);
checkPermisssion(token);
checkSurveysExist($iSurveyId);
checkTokensExist($iSurveyId);
/ We get it : because errors are not throw : OK do the real function /

But it's just an idea, and it's completely different issue ;)

frederikprijck

frederikprijck

2016-06-16 13:25

reporter   ~39628

https://github.com/LimeSurvey/LimeSurvey/pull/508

Issue History

Date Modified Username Field Change
2016-06-15 17:40 frederikprijck New Issue
2016-06-15 17:41 frederikprijck Note Added: 39612
2016-06-16 09:32 DenisChenu Note Added: 39616
2016-06-16 09:39 DenisChenu Note Added: 39617
2016-06-16 13:25 frederikprijck Note Added: 39628