change function names
This commit is contained in:
parent
76b65c5dea
commit
45ac40cc85
|
@ -103,8 +103,8 @@ App::post('/v1/account')
|
||||||
'emailVerification' => false,
|
'emailVerification' => false,
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'password' => Auth::passwordHash($password),
|
'password' => Auth::passwordHash($password),
|
||||||
'passwordUpdate' => DateTime::getCurrentDateTime(),
|
'passwordUpdate' => DateTime::now(),
|
||||||
'registration' => DateTime::getCurrentDateTime(),
|
'registration' => DateTime::now(),
|
||||||
'reset' => false,
|
'reset' => false,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'prefs' => new \stdClass(),
|
'prefs' => new \stdClass(),
|
||||||
|
@ -176,7 +176,7 @@ App::post('/v1/account/sessions/email')
|
||||||
|
|
||||||
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
||||||
$record = $geodb->get($request->getIP());
|
$record = $geodb->get($request->getIP());
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
||||||
$secret = Auth::tokenGenerator();
|
$secret = Auth::tokenGenerator();
|
||||||
$session = new Document(array_merge(
|
$session = new Document(array_merge(
|
||||||
[
|
[
|
||||||
|
@ -485,7 +485,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
|
||||||
'status' => true, // Email should already be authenticated by OAuth2 provider
|
'status' => true, // Email should already be authenticated by OAuth2 provider
|
||||||
'password' => Auth::passwordHash(Auth::passwordGenerator()),
|
'password' => Auth::passwordHash(Auth::passwordGenerator()),
|
||||||
'passwordUpdate' => null,
|
'passwordUpdate' => null,
|
||||||
'registration' => DateTime::getCurrentDateTime(),
|
'registration' => DateTime::now(),
|
||||||
'reset' => false,
|
'reset' => false,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'prefs' => new \stdClass(),
|
'prefs' => new \stdClass(),
|
||||||
|
@ -508,7 +508,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
|
||||||
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
||||||
$record = $geodb->get($request->getIP());
|
$record = $geodb->get($request->getIP());
|
||||||
$secret = Auth::tokenGenerator();
|
$secret = Auth::tokenGenerator();
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
||||||
|
|
||||||
$session = new Document(array_merge([
|
$session = new Document(array_merge([
|
||||||
'$id' => $dbForProject->getId(),
|
'$id' => $dbForProject->getId(),
|
||||||
|
@ -518,7 +518,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
|
||||||
'providerUid' => $oauth2ID,
|
'providerUid' => $oauth2ID,
|
||||||
'providerAccessToken' => $accessToken,
|
'providerAccessToken' => $accessToken,
|
||||||
'providerRefreshToken' => $refreshToken,
|
'providerRefreshToken' => $refreshToken,
|
||||||
'providerAccessTokenExpiry' => DateTime::dateAddSeconds(new \DateTime(), (int)$accessTokenExpiry),
|
'providerAccessTokenExpiry' => DateTime::addSeconds(new \DateTime(), (int)$accessTokenExpiry),
|
||||||
'secret' => Auth::hash($secret), // One way hash encryption to protect DB leak
|
'secret' => Auth::hash($secret), // One way hash encryption to protect DB leak
|
||||||
'expire' => $expire,
|
'expire' => $expire,
|
||||||
'userAgent' => $request->getUserAgent('UNKNOWN'),
|
'userAgent' => $request->getUserAgent('UNKNOWN'),
|
||||||
|
@ -651,7 +651,7 @@ App::post('/v1/account/sessions/magic-url')
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'password' => null,
|
'password' => null,
|
||||||
'passwordUpdate' => null,
|
'passwordUpdate' => null,
|
||||||
'registration' => DateTime::getCurrentDateTime(),
|
'registration' => DateTime::now(),
|
||||||
'reset' => false,
|
'reset' => false,
|
||||||
'prefs' => new \stdClass(),
|
'prefs' => new \stdClass(),
|
||||||
'sessions' => null,
|
'sessions' => null,
|
||||||
|
@ -662,7 +662,7 @@ App::post('/v1/account/sessions/magic-url')
|
||||||
}
|
}
|
||||||
|
|
||||||
$loginSecret = Auth::tokenGenerator();
|
$loginSecret = Auth::tokenGenerator();
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
|
||||||
|
|
||||||
$token = new Document([
|
$token = new Document([
|
||||||
'$id' => $dbForProject->getId(),
|
'$id' => $dbForProject->getId(),
|
||||||
|
@ -762,7 +762,7 @@ App::put('/v1/account/sessions/magic-url')
|
||||||
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
||||||
$record = $geodb->get($request->getIP());
|
$record = $geodb->get($request->getIP());
|
||||||
$secret = Auth::tokenGenerator();
|
$secret = Auth::tokenGenerator();
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
||||||
|
|
||||||
$session = new Document(array_merge(
|
$session = new Document(array_merge(
|
||||||
[
|
[
|
||||||
|
@ -894,7 +894,7 @@ App::post('/v1/account/sessions/phone')
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'password' => null,
|
'password' => null,
|
||||||
'passwordUpdate' => null,
|
'passwordUpdate' => null,
|
||||||
'registration' => DateTime::getCurrentDateTime(),
|
'registration' => DateTime::now(),
|
||||||
'reset' => false,
|
'reset' => false,
|
||||||
'prefs' => new \stdClass(),
|
'prefs' => new \stdClass(),
|
||||||
'sessions' => null,
|
'sessions' => null,
|
||||||
|
@ -905,7 +905,7 @@ App::post('/v1/account/sessions/phone')
|
||||||
}
|
}
|
||||||
|
|
||||||
$secret = $phone->generateSecretDigits();
|
$secret = $phone->generateSecretDigits();
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_PHONE);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_PHONE);
|
||||||
|
|
||||||
$token = new Document([
|
$token = new Document([
|
||||||
'$id' => $dbForProject->getId(),
|
'$id' => $dbForProject->getId(),
|
||||||
|
@ -992,7 +992,7 @@ App::put('/v1/account/sessions/phone')
|
||||||
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
||||||
$record = $geodb->get($request->getIP());
|
$record = $geodb->get($request->getIP());
|
||||||
$secret = Auth::tokenGenerator();
|
$secret = Auth::tokenGenerator();
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
||||||
|
|
||||||
$session = new Document(array_merge(
|
$session = new Document(array_merge(
|
||||||
[
|
[
|
||||||
|
@ -1120,7 +1120,7 @@ App::post('/v1/account/sessions/anonymous')
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'password' => null,
|
'password' => null,
|
||||||
'passwordUpdate' => null,
|
'passwordUpdate' => null,
|
||||||
'registration' => DateTime::getCurrentDateTime(),
|
'registration' => DateTime::now(),
|
||||||
'reset' => false,
|
'reset' => false,
|
||||||
'name' => null,
|
'name' => null,
|
||||||
'prefs' => new \stdClass(),
|
'prefs' => new \stdClass(),
|
||||||
|
@ -1135,7 +1135,7 @@ App::post('/v1/account/sessions/anonymous')
|
||||||
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
||||||
$record = $geodb->get($request->getIP());
|
$record = $geodb->get($request->getIP());
|
||||||
$secret = Auth::tokenGenerator();
|
$secret = Auth::tokenGenerator();
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
||||||
|
|
||||||
$session = new Document(array_merge(
|
$session = new Document(array_merge(
|
||||||
[
|
[
|
||||||
|
@ -1490,7 +1490,7 @@ App::patch('/v1/account/password')
|
||||||
$user->getId(),
|
$user->getId(),
|
||||||
$user
|
$user
|
||||||
->setAttribute('password', Auth::passwordHash($password))
|
->setAttribute('password', Auth::passwordHash($password))
|
||||||
->setAttribute('passwordUpdate', DateTime::getCurrentDateTime())
|
->setAttribute('passwordUpdate', DateTime::now())
|
||||||
);
|
);
|
||||||
|
|
||||||
$audits
|
$audits
|
||||||
|
@ -1821,7 +1821,7 @@ App::patch('/v1/account/sessions/:sessionId')
|
||||||
$session
|
$session
|
||||||
->setAttribute('providerAccessToken', $oauth2->getAccessToken(''))
|
->setAttribute('providerAccessToken', $oauth2->getAccessToken(''))
|
||||||
->setAttribute('providerRefreshToken', $oauth2->getRefreshToken(''))
|
->setAttribute('providerRefreshToken', $oauth2->getRefreshToken(''))
|
||||||
->setAttribute('providerAccessTokenExpiry', DateTime::dateAddSeconds(new \DateTime(), (int)$oauth2->getAccessTokenExpiry('')));
|
->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int)$oauth2->getAccessTokenExpiry('')));
|
||||||
|
|
||||||
$dbForProject->updateDocument('sessions', $sessionId, $session);
|
$dbForProject->updateDocument('sessions', $sessionId, $session);
|
||||||
|
|
||||||
|
@ -1964,7 +1964,7 @@ App::post('/v1/account/recovery')
|
||||||
throw new Exception('Invalid credentials. User is blocked', 401, Exception::USER_BLOCKED);
|
throw new Exception('Invalid credentials. User is blocked', 401, Exception::USER_BLOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_RECOVERY);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_RECOVERY);
|
||||||
|
|
||||||
$secret = Auth::tokenGenerator();
|
$secret = Auth::tokenGenerator();
|
||||||
$recovery = new Document([
|
$recovery = new Document([
|
||||||
|
@ -2065,7 +2065,7 @@ App::put('/v1/account/recovery')
|
||||||
|
|
||||||
$profile = $dbForProject->updateDocument('users', $profile->getId(), $profile
|
$profile = $dbForProject->updateDocument('users', $profile->getId(), $profile
|
||||||
->setAttribute('password', Auth::passwordHash($password))
|
->setAttribute('password', Auth::passwordHash($password))
|
||||||
->setAttribute('passwordUpdate', DateTime::getCurrentDateTime())
|
->setAttribute('passwordUpdate', DateTime::now())
|
||||||
->setAttribute('emailVerification', true));
|
->setAttribute('emailVerification', true));
|
||||||
|
|
||||||
$recoveryDocument = $dbForProject->getDocument('tokens', $recovery);
|
$recoveryDocument = $dbForProject->getDocument('tokens', $recovery);
|
||||||
|
@ -2124,7 +2124,7 @@ App::post('/v1/account/verification')
|
||||||
$isPrivilegedUser = Auth::isPrivilegedUser($roles);
|
$isPrivilegedUser = Auth::isPrivilegedUser($roles);
|
||||||
$isAppUser = Auth::isAppUser($roles);
|
$isAppUser = Auth::isAppUser($roles);
|
||||||
$verificationSecret = Auth::tokenGenerator();
|
$verificationSecret = Auth::tokenGenerator();
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
|
||||||
|
|
||||||
$verification = new Document([
|
$verification = new Document([
|
||||||
'$id' => $dbForProject->getId(),
|
'$id' => $dbForProject->getId(),
|
||||||
|
@ -2277,7 +2277,7 @@ App::post('/v1/account/verification/phone')
|
||||||
$isAppUser = Auth::isAppUser($roles);
|
$isAppUser = Auth::isAppUser($roles);
|
||||||
$verificationSecret = Auth::tokenGenerator();
|
$verificationSecret = Auth::tokenGenerator();
|
||||||
$secret = $phone->generateSecretDigits();
|
$secret = $phone->generateSecretDigits();
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
|
||||||
|
|
||||||
$verification = new Document([
|
$verification = new Document([
|
||||||
'$id' => $dbForProject->getId(),
|
'$id' => $dbForProject->getId(),
|
||||||
|
|
|
@ -2530,7 +2530,7 @@ App::get('/v1/databases/usage')
|
||||||
};
|
};
|
||||||
$stats[$metric][] = [
|
$stats[$metric][] = [
|
||||||
'value' => 0,
|
'value' => 0,
|
||||||
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
||||||
];
|
];
|
||||||
$backfill--;
|
$backfill--;
|
||||||
}
|
}
|
||||||
|
@ -2642,7 +2642,7 @@ App::get('/v1/databases/:databaseId/usage')
|
||||||
};
|
};
|
||||||
$stats[$metric][] = [
|
$stats[$metric][] = [
|
||||||
'value' => 0,
|
'value' => 0,
|
||||||
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
||||||
];
|
];
|
||||||
$backfill--;
|
$backfill--;
|
||||||
}
|
}
|
||||||
|
@ -2755,7 +2755,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/usage')
|
||||||
};
|
};
|
||||||
$stats[$metric][] = [
|
$stats[$metric][] = [
|
||||||
'value' => 0,
|
'value' => 0,
|
||||||
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
||||||
];
|
];
|
||||||
$backfill--;
|
$backfill--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ App::get('/v1/functions/:functionId/usage')
|
||||||
};
|
};
|
||||||
$stats[$metric][] = [
|
$stats[$metric][] = [
|
||||||
'value' => 0,
|
'value' => 0,
|
||||||
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
||||||
];
|
];
|
||||||
$backfill--;
|
$backfill--;
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ App::put('/v1/functions/:functionId')
|
||||||
|
|
||||||
$original = $function->getAttribute('schedule', '');
|
$original = $function->getAttribute('schedule', '');
|
||||||
$cron = (!empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
|
$cron = (!empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
|
||||||
$next = (!empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::dateFormat($cron->getNextRunDate()) : null;
|
$next = (!empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::format($cron->getNextRunDate()) : null;
|
||||||
|
|
||||||
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
||||||
'execute' => $execute,
|
'execute' => $execute,
|
||||||
|
@ -381,7 +381,7 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId')
|
||||||
|
|
||||||
$schedule = $function->getAttribute('schedule', '');
|
$schedule = $function->getAttribute('schedule', '');
|
||||||
$cron = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
|
$cron = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
|
||||||
$next = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::dateFormat($cron->getNextRunDate()) : null;
|
$next = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::format($cron->getNextRunDate()) : null;
|
||||||
|
|
||||||
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [
|
||||||
'deployment' => $deployment->getId(),
|
'deployment' => $deployment->getId(),
|
||||||
|
|
|
@ -315,7 +315,7 @@ App::get('/v1/projects/:projectId/usage')
|
||||||
};
|
};
|
||||||
$stats[$metric][] = [
|
$stats[$metric][] = [
|
||||||
'value' => 0,
|
'value' => 0,
|
||||||
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
||||||
];
|
];
|
||||||
$backfill--;
|
$backfill--;
|
||||||
}
|
}
|
||||||
|
@ -1246,7 +1246,7 @@ App::post('/v1/projects/:projectId/domains')
|
||||||
'$write' => ['role:all'],
|
'$write' => ['role:all'],
|
||||||
'projectInternalId' => $project->getInternalId(),
|
'projectInternalId' => $project->getInternalId(),
|
||||||
'projectId' => $project->getId(),
|
'projectId' => $project->getId(),
|
||||||
'updated' => DateTime::getCurrentDateTime(),
|
'updated' => DateTime::now(),
|
||||||
'domain' => $domain->get(),
|
'domain' => $domain->get(),
|
||||||
'tld' => $domain->getSuffix(),
|
'tld' => $domain->getSuffix(),
|
||||||
'registerable' => $domain->getRegisterable(),
|
'registerable' => $domain->getRegisterable(),
|
||||||
|
|
|
@ -1548,7 +1548,7 @@ App::get('/v1/storage/usage')
|
||||||
};
|
};
|
||||||
$stats[$metric][] = [
|
$stats[$metric][] = [
|
||||||
'value' => 0,
|
'value' => 0,
|
||||||
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
||||||
];
|
];
|
||||||
$backfill--;
|
$backfill--;
|
||||||
}
|
}
|
||||||
|
@ -1657,7 +1657,7 @@ App::get('/v1/storage/:bucketId/usage')
|
||||||
};
|
};
|
||||||
$stats[$metric][] = [
|
$stats[$metric][] = [
|
||||||
'value' => 0,
|
'value' => 0,
|
||||||
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
||||||
];
|
];
|
||||||
$backfill--;
|
$backfill--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,8 @@ App::post('/v1/teams')
|
||||||
'teamId' => $team->getId(),
|
'teamId' => $team->getId(),
|
||||||
'teamInternalId' => $team->getInternalId(),
|
'teamInternalId' => $team->getInternalId(),
|
||||||
'roles' => $roles,
|
'roles' => $roles,
|
||||||
'invited' => DateTime::getCurrentDateTime(),
|
'invited' => DateTime::now(),
|
||||||
'joined' => DateTime::getCurrentDateTime(),
|
'joined' => DateTime::now(),
|
||||||
'confirm' => true,
|
'confirm' => true,
|
||||||
'secret' => '',
|
'secret' => '',
|
||||||
'search' => implode(' ', [$membershipId, $user->getId()])
|
'search' => implode(' ', [$membershipId, $user->getId()])
|
||||||
|
@ -341,7 +341,7 @@ App::post('/v1/teams/:teamId/memberships')
|
||||||
* old password
|
* old password
|
||||||
*/
|
*/
|
||||||
'passwordUpdate' => null,
|
'passwordUpdate' => null,
|
||||||
'registration' => DateTime::getCurrentDateTime(),
|
'registration' => DateTime::now(),
|
||||||
'reset' => false,
|
'reset' => false,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'prefs' => new \stdClass(),
|
'prefs' => new \stdClass(),
|
||||||
|
@ -373,8 +373,8 @@ App::post('/v1/teams/:teamId/memberships')
|
||||||
'teamId' => $team->getId(),
|
'teamId' => $team->getId(),
|
||||||
'teamInternalId' => $team->getInternalId(),
|
'teamInternalId' => $team->getInternalId(),
|
||||||
'roles' => $roles,
|
'roles' => $roles,
|
||||||
'invited' => DateTime::getCurrentDateTime(),
|
'invited' => DateTime::now(),
|
||||||
'joined' => ($isPrivilegedUser || $isAppUser) ? DateTime::getCurrentDateTime() : null,
|
'joined' => ($isPrivilegedUser || $isAppUser) ? DateTime::now() : null,
|
||||||
'confirm' => ($isPrivilegedUser || $isAppUser),
|
'confirm' => ($isPrivilegedUser || $isAppUser),
|
||||||
'secret' => Auth::hash($secret),
|
'secret' => Auth::hash($secret),
|
||||||
'search' => implode(' ', [$membershipId, $invitee->getId()])
|
'search' => implode(' ', [$membershipId, $invitee->getId()])
|
||||||
|
@ -687,7 +687,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
|
||||||
}
|
}
|
||||||
|
|
||||||
$membership // Attach user to team
|
$membership // Attach user to team
|
||||||
->setAttribute('joined', DateTime::getCurrentDateTime())
|
->setAttribute('joined', DateTime::now())
|
||||||
->setAttribute('confirm', true)
|
->setAttribute('confirm', true)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
|
||||||
|
|
||||||
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
$detector = new Detector($request->getUserAgent('UNKNOWN'));
|
||||||
$record = $geodb->get($request->getIP());
|
$record = $geodb->get($request->getIP());
|
||||||
$expire = DateTime::dateAddSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_LOGIN_LONG);
|
||||||
$secret = Auth::tokenGenerator();
|
$secret = Auth::tokenGenerator();
|
||||||
$session = new Document(array_merge([
|
$session = new Document(array_merge([
|
||||||
'$id' => $dbForProject->getId(),
|
'$id' => $dbForProject->getId(),
|
||||||
|
|
|
@ -64,8 +64,8 @@ App::post('/v1/users')
|
||||||
'emailVerification' => false,
|
'emailVerification' => false,
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'password' => Auth::passwordHash($password),
|
'password' => Auth::passwordHash($password),
|
||||||
'passwordUpdate' => DateTime::getCurrentDateTime(),
|
'passwordUpdate' => DateTime::now(),
|
||||||
'registration' => DateTime::getCurrentDateTime(),
|
'registration' => DateTime::now(),
|
||||||
'reset' => false,
|
'reset' => false,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'prefs' => new \stdClass(),
|
'prefs' => new \stdClass(),
|
||||||
|
@ -551,7 +551,7 @@ App::patch('/v1/users/:userId/password')
|
||||||
|
|
||||||
$user
|
$user
|
||||||
->setAttribute('password', Auth::passwordHash($password))
|
->setAttribute('password', Auth::passwordHash($password))
|
||||||
->setAttribute('passwordUpdate', DateTime::getCurrentDateTime());
|
->setAttribute('passwordUpdate', DateTime::now());
|
||||||
|
|
||||||
$user = $dbForProject->updateDocument('users', $user->getId(), $user);
|
$user = $dbForProject->updateDocument('users', $user->getId(), $user);
|
||||||
|
|
||||||
|
@ -926,7 +926,7 @@ App::get('/v1/users/usage')
|
||||||
};
|
};
|
||||||
$stats[$metric][] = [
|
$stats[$metric][] = [
|
||||||
'value' => 0,
|
'value' => 0,
|
||||||
'date' => DateTime::dateAddSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
|
||||||
];
|
];
|
||||||
$backfill--;
|
$backfill--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ App::init(function (App $utopia, Request $request, Response $response, Document
|
||||||
|
|
||||||
$expire = $key->getAttribute('expire');
|
$expire = $key->getAttribute('expire');
|
||||||
|
|
||||||
if (!empty($expire) && $expire < DateTime::getCurrentDateTime()) {
|
if (!empty($expire) && $expire < DateTime::now()) {
|
||||||
throw new AppwriteException('Project key expired', 401, AppwriteException:: PROJECT_KEY_EXPIRED);
|
throw new AppwriteException('Project key expired', 401, AppwriteException:: PROJECT_KEY_EXPIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ App::post('/v1/runtimes')
|
||||||
$containerId = '';
|
$containerId = '';
|
||||||
$stdout = '';
|
$stdout = '';
|
||||||
$stderr = '';
|
$stderr = '';
|
||||||
$startTime = DateTime::getCurrentDateTime();
|
$startTime = DateTime::now();
|
||||||
$startTimeUnix = (new \DateTime($startTime))->getTimestamp();
|
$startTimeUnix = (new \DateTime($startTime))->getTimestamp();
|
||||||
$endTimeUnix = 0;
|
$endTimeUnix = 0;
|
||||||
$orchestration = $orchestrationPool->get();
|
$orchestration = $orchestrationPool->get();
|
||||||
|
@ -321,7 +321,7 @@ App::post('/v1/runtimes')
|
||||||
$stdout = 'Build Successful!';
|
$stdout = 'Build Successful!';
|
||||||
}
|
}
|
||||||
|
|
||||||
$endTime = DateTime::getCurrentDateTime();
|
$endTime = DateTime::now();
|
||||||
$endTimeUnix = (new \DateTime($endTime))->getTimestamp();
|
$endTimeUnix = (new \DateTime($endTime))->getTimestamp();
|
||||||
$duration = $endTimeUnix - $startTimeUnix;
|
$duration = $endTimeUnix - $startTimeUnix;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ $cli
|
||||||
{
|
{
|
||||||
(new Delete())
|
(new Delete())
|
||||||
->setType(DELETE_TYPE_EXECUTIONS)
|
->setType(DELETE_TYPE_EXECUTIONS)
|
||||||
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval))
|
->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * $interval))
|
||||||
->trigger();
|
->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ $cli
|
||||||
{
|
{
|
||||||
(new Delete())
|
(new Delete())
|
||||||
->setType(DELETE_TYPE_ABUSE)
|
->setType(DELETE_TYPE_ABUSE)
|
||||||
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval))
|
->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * $interval))
|
||||||
->trigger();
|
->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ $cli
|
||||||
{
|
{
|
||||||
(new Delete())
|
(new Delete())
|
||||||
->setType(DELETE_TYPE_AUDIT)
|
->setType(DELETE_TYPE_AUDIT)
|
||||||
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval))
|
->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * $interval))
|
||||||
->trigger();
|
->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ $cli
|
||||||
{
|
{
|
||||||
(new Delete())
|
(new Delete())
|
||||||
->setType(DELETE_TYPE_USAGE)
|
->setType(DELETE_TYPE_USAGE)
|
||||||
->setDateTime1d(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval1d))
|
->setDateTime1d(DateTime::addSeconds(new \DateTime(), -1 * $interval1d))
|
||||||
->setDateTime30m(DateTime::dateAddSeconds(new \DateTime(), -1 * $interval30m))
|
->setDateTime30m(DateTime::addSeconds(new \DateTime(), -1 * $interval30m))
|
||||||
->trigger();
|
->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ $cli
|
||||||
{
|
{
|
||||||
(new Delete())
|
(new Delete())
|
||||||
->setType(DELETE_TYPE_REALTIME)
|
->setType(DELETE_TYPE_REALTIME)
|
||||||
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -60))
|
->setDatetime(DateTime::addSeconds(new \DateTime(), -60))
|
||||||
->trigger();
|
->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,13 +99,13 @@ $cli
|
||||||
{
|
{
|
||||||
(new Delete())
|
(new Delete())
|
||||||
->setType(DELETE_TYPE_SESSIONS)
|
->setType(DELETE_TYPE_SESSIONS)
|
||||||
->setDatetime(DateTime::dateAddSeconds(new \DateTime(), -1 * Auth::TOKEN_EXPIRATION_LOGIN_LONG))
|
->setDatetime(DateTime::addSeconds(new \DateTime(), -1 * Auth::TOKEN_EXPIRATION_LOGIN_LONG))
|
||||||
->trigger();
|
->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
function renewCertificates($dbForConsole)
|
function renewCertificates($dbForConsole)
|
||||||
{
|
{
|
||||||
$time = DateTime::getCurrentDateTime();
|
$time = DateTime::now();
|
||||||
|
|
||||||
$certificates = $dbForConsole->find('certificates', [
|
$certificates = $dbForConsole->find('certificates', [
|
||||||
new Query('attempts', Query::TYPE_LESSEREQUAL, [5]), // Maximum 5 attempts
|
new Query('attempts', Query::TYPE_LESSEREQUAL, [5]), // Maximum 5 attempts
|
||||||
|
@ -140,7 +140,7 @@ $cli
|
||||||
Console::loop(function () use ($interval, $executionLogsRetention, $abuseLogsRetention, $auditLogRetention, $usageStatsRetention30m, $usageStatsRetention1d) {
|
Console::loop(function () use ($interval, $executionLogsRetention, $abuseLogsRetention, $auditLogRetention, $usageStatsRetention30m, $usageStatsRetention1d) {
|
||||||
$database = getConsoleDB();
|
$database = getConsoleDB();
|
||||||
|
|
||||||
$time = DateTime::getCurrentDateTime();
|
$time = DateTime::now();
|
||||||
|
|
||||||
Console::info("[{$time}] Notifying workers with maintenance tasks every {$interval} seconds");
|
Console::info("[{$time}] Notifying workers with maintenance tasks every {$interval} seconds");
|
||||||
notifyDeleteExecutionLogs($executionLogsRetention);
|
notifyDeleteExecutionLogs($executionLogsRetention);
|
||||||
|
|
|
@ -76,7 +76,7 @@ class BuildsV1 extends Worker
|
||||||
}
|
}
|
||||||
|
|
||||||
$buildId = $deployment->getAttribute('buildId', '');
|
$buildId = $deployment->getAttribute('buildId', '');
|
||||||
$startTime = DateTime::getCurrentDateTime();
|
$startTime = DateTime::now();
|
||||||
if (empty($buildId)) {
|
if (empty($buildId)) {
|
||||||
$buildId = $dbForProject->getId();
|
$buildId = $dbForProject->getId();
|
||||||
$build = $dbForProject->createDocument('builds', new Document([
|
$build = $dbForProject->createDocument('builds', new Document([
|
||||||
|
@ -167,7 +167,7 @@ class BuildsV1 extends Worker
|
||||||
|
|
||||||
/** Update the build document */
|
/** Update the build document */
|
||||||
|
|
||||||
//$response['endTime'] = DateTime::dateFormat((new \DateTime())->setTimestamp($response['endTime'])); //todo: fix to datetime
|
//$response['endTime'] = DateTime::format((new \DateTime())->setTimestamp($response['endTime'])); //todo: fix to datetime
|
||||||
|
|
||||||
$build->setAttribute('endTime', $response['endTime']);
|
$build->setAttribute('endTime', $response['endTime']);
|
||||||
$build->setAttribute('duration', $response['duration']);
|
$build->setAttribute('duration', $response['duration']);
|
||||||
|
@ -187,11 +187,11 @@ class BuildsV1 extends Worker
|
||||||
/** Update function schedule */
|
/** Update function schedule */
|
||||||
$schedule = $function->getAttribute('schedule', '');
|
$schedule = $function->getAttribute('schedule', '');
|
||||||
$cron = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
|
$cron = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? new CronExpression($schedule) : null;
|
||||||
$next = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::dateFormat($cron->getNextRunDate()) : null;
|
$next = (empty($function->getAttribute('deployment')) && !empty($schedule)) ? DateTime::format($cron->getNextRunDate()) : null;
|
||||||
$function->setAttribute('scheduleNext', $next);
|
$function->setAttribute('scheduleNext', $next);
|
||||||
$function = $dbForProject->updateDocument('functions', $function->getId(), $function);
|
$function = $dbForProject->updateDocument('functions', $function->getId(), $function);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
$endtime = DateTime::getCurrentDateTime();
|
$endtime = DateTime::now();
|
||||||
$interval = (new \DateTime($endtime))->diff(new \DateTime($startTime));
|
$interval = (new \DateTime($endtime))->diff(new \DateTime($startTime));
|
||||||
$build->setAttribute('endTime', $endtime);
|
$build->setAttribute('endTime', $endtime);
|
||||||
$build->setAttribute('duration', $interval->format('%s'));
|
$build->setAttribute('duration', $interval->format('%s'));
|
||||||
|
|
|
@ -116,7 +116,7 @@ class CertificatesV1 extends Worker
|
||||||
// Update certificate info stored in database
|
// Update certificate info stored in database
|
||||||
$certificate->setAttribute('renewDate', $this->getRenewDate($domain->get()));
|
$certificate->setAttribute('renewDate', $this->getRenewDate($domain->get()));
|
||||||
$certificate->setAttribute('attempts', 0);
|
$certificate->setAttribute('attempts', 0);
|
||||||
$certificate->setAttribute('issueDate', DateTime::getCurrentDateTime());
|
$certificate->setAttribute('issueDate', DateTime::now());
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
// Set exception as log in certificate document
|
// Set exception as log in certificate document
|
||||||
$certificate->setAttribute('log', $e->getMessage());
|
$certificate->setAttribute('log', $e->getMessage());
|
||||||
|
@ -129,7 +129,7 @@ class CertificatesV1 extends Worker
|
||||||
$this->notifyError($domain->get(), $e->getMessage(), $attempts);
|
$this->notifyError($domain->get(), $e->getMessage(), $attempts);
|
||||||
} finally {
|
} finally {
|
||||||
// All actions result in new updatedAt date
|
// All actions result in new updatedAt date
|
||||||
$certificate->setAttribute('updated', DateTime::getCurrentDateTime());
|
$certificate->setAttribute('updated', DateTime::now());
|
||||||
|
|
||||||
// Save all changes we made to certificate document into database
|
// Save all changes we made to certificate document into database
|
||||||
$this->saveCertificateDocument($domain->get(), $certificate);
|
$this->saveCertificateDocument($domain->get(), $certificate);
|
||||||
|
@ -298,7 +298,7 @@ class CertificatesV1 extends Worker
|
||||||
$certData = openssl_x509_parse(file_get_contents($certPath));
|
$certData = openssl_x509_parse(file_get_contents($certPath));
|
||||||
$validTo = $certData['validTo_time_t'] ?? null;
|
$validTo = $certData['validTo_time_t'] ?? null;
|
||||||
$dt = (new \DateTime())->setTimestamp($validTo);
|
$dt = (new \DateTime())->setTimestamp($validTo);
|
||||||
return DateTime::dateAddSeconds($dt, -60 * 60 * 24 * 30); // -30 days
|
return DateTime::addSeconds($dt, -60 * 60 * 24 * 30); // -30 days
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -398,7 +398,7 @@ class CertificatesV1 extends Worker
|
||||||
], 1000);
|
], 1000);
|
||||||
|
|
||||||
foreach ($domains as $domainDocument) {
|
foreach ($domains as $domainDocument) {
|
||||||
$domainDocument->setAttribute('updated', DateTime::getCurrentDateTime());
|
$domainDocument->setAttribute('updated', DateTime::now());
|
||||||
$domainDocument->setAttribute('certificateId', $certificateId);
|
$domainDocument->setAttribute('certificateId', $certificateId);
|
||||||
|
|
||||||
$this->dbForConsole->updateDocument('domains', $domainDocument->getId(), $domainDocument);
|
$this->dbForConsole->updateDocument('domains', $domainDocument->getId(), $domainDocument);
|
||||||
|
|
|
@ -147,11 +147,11 @@ class FunctionsV1 extends Worker
|
||||||
}
|
}
|
||||||
|
|
||||||
$cron = new CronExpression($function->getAttribute('schedule'));
|
$cron = new CronExpression($function->getAttribute('schedule'));
|
||||||
$next = DateTime::dateFormat($cron->getNextRunDate());
|
$next = DateTime::format($cron->getNextRunDate());
|
||||||
|
|
||||||
$function
|
$function
|
||||||
->setAttribute('scheduleNext', $next)
|
->setAttribute('scheduleNext', $next)
|
||||||
->setAttribute('schedulePrevious', DateTime::getCurrentDateTime());
|
->setAttribute('schedulePrevious', DateTime::now());
|
||||||
|
|
||||||
$function = $database->updateDocument(
|
$function = $database->updateDocument(
|
||||||
'functions',
|
'functions',
|
||||||
|
|
5383
composer.lock
generated
5383
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -207,7 +207,7 @@ class Auth
|
||||||
$token->isSet('expire') &&
|
$token->isSet('expire') &&
|
||||||
$token->getAttribute('type') == $type &&
|
$token->getAttribute('type') == $type &&
|
||||||
$token->getAttribute('secret') === self::hash($secret) &&
|
$token->getAttribute('secret') === self::hash($secret) &&
|
||||||
$token->getAttribute('expire') >= DateTime::getCurrentDateTime()
|
$token->getAttribute('expire') >= DateTime::now()
|
||||||
) {
|
) {
|
||||||
return (string)$token->getId();
|
return (string)$token->getId();
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ class Auth
|
||||||
$token->isSet('expire') &&
|
$token->isSet('expire') &&
|
||||||
$token->getAttribute('type') == Auth::TOKEN_TYPE_PHONE &&
|
$token->getAttribute('type') == Auth::TOKEN_TYPE_PHONE &&
|
||||||
$token->getAttribute('secret') === $secret &&
|
$token->getAttribute('secret') === $secret &&
|
||||||
$token->getAttribute('expire') >= DateTime::getCurrentDateTime()
|
$token->getAttribute('expire') >= DateTime::now()
|
||||||
) {
|
) {
|
||||||
return (string) $token->getId();
|
return (string) $token->getId();
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ class Auth
|
||||||
$session->isSet('expire') &&
|
$session->isSet('expire') &&
|
||||||
$session->isSet('provider') &&
|
$session->isSet('provider') &&
|
||||||
$session->getAttribute('secret') === self::hash($secret) &&
|
$session->getAttribute('secret') === self::hash($secret) &&
|
||||||
$session->getAttribute('expire') >= DateTime::getCurrentDateTime()
|
$session->getAttribute('expire') >= DateTime::now()
|
||||||
) {
|
) {
|
||||||
return $session->getId();
|
return $session->getId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,7 +539,7 @@ class AccountCustomClientTest extends Scope
|
||||||
$this->assertEquals(200, $response['headers']['status-code']);
|
$this->assertEquals(200, $response['headers']['status-code']);
|
||||||
$this->assertEquals('123456', $response['body']['providerAccessToken']);
|
$this->assertEquals('123456', $response['body']['providerAccessToken']);
|
||||||
$this->assertEquals('tuvwxyz', $response['body']['providerRefreshToken']);
|
$this->assertEquals('tuvwxyz', $response['body']['providerRefreshToken']);
|
||||||
$this->assertGreaterThan(DateTime::dateAddSeconds(new \DateTime(), 14400 - 5), $response['body']['providerAccessTokenExpiry']); // 5 seconds allowed networking delay
|
$this->assertGreaterThan(DateTime::addSeconds(new \DateTime(), 14400 - 5), $response['body']['providerAccessTokenExpiry']); // 5 seconds allowed networking delay
|
||||||
|
|
||||||
$initialExpiry = $response['body']['providerAccessTokenExpiry'];
|
$initialExpiry = $response['body']['providerAccessTokenExpiry'];
|
||||||
|
|
||||||
|
|
|
@ -1281,7 +1281,7 @@ class ProjectsConsoleClientTest extends Scope
|
||||||
], $this->getHeaders()), [
|
], $this->getHeaders()), [
|
||||||
'name' => 'Key Test',
|
'name' => 'Key Test',
|
||||||
'scopes' => ['health.read'],
|
'scopes' => ['health.read'],
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), 3600),
|
'expire' => DateTime::addSeconds(new \DateTime(), 3600),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response = $this->client->call(Client::METHOD_GET, '/health', [
|
$response = $this->client->call(Client::METHOD_GET, '/health', [
|
||||||
|
@ -1321,7 +1321,7 @@ class ProjectsConsoleClientTest extends Scope
|
||||||
], $this->getHeaders()), [
|
], $this->getHeaders()), [
|
||||||
'name' => 'Key Test',
|
'name' => 'Key Test',
|
||||||
'scopes' => ['health.read'],
|
'scopes' => ['health.read'],
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), -3600),
|
'expire' => DateTime::addSeconds(new \DateTime(), -3600),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response = $this->client->call(Client::METHOD_GET, '/health', [
|
$response = $this->client->call(Client::METHOD_GET, '/health', [
|
||||||
|
@ -1348,7 +1348,7 @@ class ProjectsConsoleClientTest extends Scope
|
||||||
], $this->getHeaders()), [
|
], $this->getHeaders()), [
|
||||||
'name' => 'Key Test Update',
|
'name' => 'Key Test Update',
|
||||||
'scopes' => ['users.read', 'users.write', 'collections.read'],
|
'scopes' => ['users.read', 'users.write', 'collections.read'],
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), 360),
|
'expire' => DateTime::addSeconds(new \DateTime(), 360),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertEquals(200, $response['headers']['status-code']);
|
$this->assertEquals(200, $response['headers']['status-code']);
|
||||||
|
|
|
@ -62,7 +62,7 @@ trait TeamsBaseServer
|
||||||
$this->assertNotEmpty($response['body']['teamId']);
|
$this->assertNotEmpty($response['body']['teamId']);
|
||||||
$this->assertCount(2, $response['body']['roles']);
|
$this->assertCount(2, $response['body']['roles']);
|
||||||
$this->assertEquals(true, DateTime::isValid($response['body']['joined']));
|
$this->assertEquals(true, DateTime::isValid($response['body']['joined']));
|
||||||
$this->assertGreaterThan('2020-07-07 07:58:44', DateTime::getCurrentDateTime());
|
$this->assertGreaterThan('2020-07-07 07:58:44', DateTime::now());
|
||||||
$this->assertEquals(true, $response['body']['confirm']);
|
$this->assertEquals(true, $response['body']['confirm']);
|
||||||
|
|
||||||
$userUid = $response['body']['userId'];
|
$userUid = $response['body']['userId'];
|
||||||
|
|
|
@ -77,14 +77,14 @@ class AuthTest extends TestCase
|
||||||
$tokens1 = [
|
$tokens1 = [
|
||||||
new Document([
|
new Document([
|
||||||
'$id' => 'token1',
|
'$id' => 'token1',
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), 60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), 60 * 60 * 24),
|
||||||
'secret' => $hash,
|
'secret' => $hash,
|
||||||
'provider' => Auth::SESSION_PROVIDER_EMAIL,
|
'provider' => Auth::SESSION_PROVIDER_EMAIL,
|
||||||
'providerUid' => 'test@example.com',
|
'providerUid' => 'test@example.com',
|
||||||
]),
|
]),
|
||||||
new Document([
|
new Document([
|
||||||
'$id' => 'token2',
|
'$id' => 'token2',
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
|
||||||
'secret' => 'secret2',
|
'secret' => 'secret2',
|
||||||
'provider' => Auth::SESSION_PROVIDER_EMAIL,
|
'provider' => Auth::SESSION_PROVIDER_EMAIL,
|
||||||
'providerUid' => 'test@example.com',
|
'providerUid' => 'test@example.com',
|
||||||
|
@ -94,14 +94,14 @@ class AuthTest extends TestCase
|
||||||
$tokens2 = [
|
$tokens2 = [
|
||||||
new Document([ // Correct secret and type time, wrong expire time
|
new Document([ // Correct secret and type time, wrong expire time
|
||||||
'$id' => 'token1',
|
'$id' => 'token1',
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
|
||||||
'secret' => $hash,
|
'secret' => $hash,
|
||||||
'provider' => Auth::SESSION_PROVIDER_EMAIL,
|
'provider' => Auth::SESSION_PROVIDER_EMAIL,
|
||||||
'providerUid' => 'test@example.com',
|
'providerUid' => 'test@example.com',
|
||||||
]),
|
]),
|
||||||
new Document([
|
new Document([
|
||||||
'$id' => 'token2',
|
'$id' => 'token2',
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
|
||||||
'secret' => 'secret2',
|
'secret' => 'secret2',
|
||||||
'provider' => Auth::SESSION_PROVIDER_EMAIL,
|
'provider' => Auth::SESSION_PROVIDER_EMAIL,
|
||||||
'providerUid' => 'test@example.com',
|
'providerUid' => 'test@example.com',
|
||||||
|
@ -122,13 +122,13 @@ class AuthTest extends TestCase
|
||||||
new Document([
|
new Document([
|
||||||
'$id' => 'token1',
|
'$id' => 'token1',
|
||||||
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), 60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), 60 * 60 * 24),
|
||||||
'secret' => $hash,
|
'secret' => $hash,
|
||||||
]),
|
]),
|
||||||
new Document([
|
new Document([
|
||||||
'$id' => 'token2',
|
'$id' => 'token2',
|
||||||
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
|
||||||
'secret' => 'secret2',
|
'secret' => 'secret2',
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
@ -137,13 +137,13 @@ class AuthTest extends TestCase
|
||||||
new Document([ // Correct secret and type time, wrong expire time
|
new Document([ // Correct secret and type time, wrong expire time
|
||||||
'$id' => 'token1',
|
'$id' => 'token1',
|
||||||
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
|
||||||
'secret' => $hash,
|
'secret' => $hash,
|
||||||
]),
|
]),
|
||||||
new Document([
|
new Document([
|
||||||
'$id' => 'token2',
|
'$id' => 'token2',
|
||||||
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
|
||||||
'secret' => 'secret2',
|
'secret' => 'secret2',
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
@ -152,13 +152,13 @@ class AuthTest extends TestCase
|
||||||
new Document([
|
new Document([
|
||||||
'$id' => 'token1',
|
'$id' => 'token1',
|
||||||
'type' => Auth::TOKEN_TYPE_INVITE,
|
'type' => Auth::TOKEN_TYPE_INVITE,
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), 60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), 60 * 60 * 24),
|
||||||
'secret' => $hash,
|
'secret' => $hash,
|
||||||
]),
|
]),
|
||||||
new Document([
|
new Document([
|
||||||
'$id' => 'token2',
|
'$id' => 'token2',
|
||||||
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
'type' => Auth::TOKEN_TYPE_RECOVERY,
|
||||||
'expire' => DateTime::dateAddSeconds(new \DateTime(), -60 * 60 * 24),
|
'expire' => DateTime::addSeconds(new \DateTime(), -60 * 60 * 24),
|
||||||
'secret' => 'secret2',
|
'secret' => 'secret2',
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue