Merge branch 'master' into evaluation

This commit is contained in:
jelhan 2015-08-19 11:14:08 +02:00
commit 839695b224
6 changed files with 27 additions and 5 deletions

View file

@ -84,8 +84,8 @@ class Datahandler {
// check expiration date
if (
!empty($poll_data->poll->expirationDate) &&
self::isExpired($poll_data->poll->expirationDate)
!empty($poll_data->poll->serverExpirationDate) &&
self::isExpired($poll_data->poll->serverExpirationDate)
) {
$this->deletePoll($poll_id);
return false;
@ -122,6 +122,13 @@ class Datahandler {
}
}
}
// do not include properties prefixed by server in response
foreach ($poll_data->poll as $key => $value) {
if(strpos($key, "server") === 0) {
unset($poll_data->poll->$key);
}
}
return json_encode($poll_data);
}

View file

@ -44,7 +44,7 @@ while(false !== ($poll_dir = readdir($data_folder_handler))) {
$polls_processed ++;
if(datahandler::isExpired($poll_data->poll->expirationDate)) {
if(datahandler::isExpired($poll_data->poll->serverExpirationDate)) {
$datahandler = new datahandler();
$datahandler->deletePoll($poll_dir);

View file

@ -13,7 +13,8 @@ $pollData = [
"encryptedAnonymousUser" => "{\"iv\":\"Rv75z29GDIbZ/RGRs+uq0Q==\",\"v\":1,\"iter\":1000,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"salt\":\"3GQYS4Ils60=\",\"ct\":\"/7sj+sLWPYOWJgvslg==\"}",
"encryptedIsDateTime" => "{\"iv\":\"noz0JF1Uzv74e27gMu55Kw==\",\"v\":1,\"iter\":1000,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"salt\":\"3GQYS4Ils60=\",\"ct\":\"Igefluift7+Wedo1Cw==\"}",
"encryptedTimezone" => "{\"iv\":\"/sBs7oP15FsJ7qSUSHvewA==\",\"v\":1,\"iter\":1000,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"salt\":\"3GQYS4Ils60=\",\"ct\":\"TqJBGIjSGIcVsQ==\"}",
"expirationDate" => "2015-11-01T17:57:03.713Z",
"encryptedExpirationDate" => "{\"iv\":\"Jmclqi7ZDjKZ1O9t6HgkyQ==\",\"v\":1,\"iter\":1000,\"ks\":128,\"ts\":64,\"mode\":\"ccm\",\"adata\":\"\",\"cipher\":\"aes\",\"salt\":\"CnrCEy2AX1c=\",\"ct\":\"jg0bpNknoJcB4CAumtSEjyRNy845vzbfM6QQeNx0M60ZAw==\"}",
"serverExpirationDate" => "2015-11-01T17:57:03.713Z",
"version" => "v0.3.0+d26cd827"
]
];
@ -25,5 +26,10 @@ $I->wantTo('get an existing poll');
$I->sendGET('/polls/' . $pollId);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
unset($pollData["poll"]["serverExpirationDate"]);
$I->seeResponseContainsJson($pollData);
$I->seeResponseContainsJson(["poll" => ["id" => $pollId]]);
$I->dontSeeResponseJsonMatchesJsonPath('poll.serverExpirationDate');

View file

@ -144,6 +144,10 @@ export default Ember.Controller.extend({
this.set('model.timezone', '');
}
}.observes('model.isDateTime', 'model.isFindADate'),
syncExpirationDate: function() {
this.set('model.serverExpirationDate', this.get('model.expirationDate'));
}.observes('model.expirationDate'),
/*
* validate if a given time string is in valid format

View file

@ -39,7 +39,11 @@ export default DS.Model.extend({
encryptedTimezone : DS.attr('string'),
timezone : Ember.computed.encrypted('encryptedTimezone', 'string'),
expirationDate : DS.attr('string'),
encryptedExpirationDate : DS.attr('string'),
expirationDate : Ember.computed.encrypted('encryptedExpirationDate', 'string'),
// store expiration date unencrypted on create
serverExpirationDate : DS.attr('string'),
version : DS.attr('string'),

View file

@ -39,6 +39,7 @@
"ember-cli-moment-shim": "0.6.0",
"ember-cli-pretender": "0.3.2",
"ember-cli-qunit": "0.3.13",
"ember-cli-sri": "1.0.3",
"ember-cli-uglify": "^1.0.1",
"ember-data": "1.0.0-beta.18",
"ember-disable-proxy-controllers": "^1.0.0",