Merge remote-tracking branch 'upstream/master' into feat-add-encrypt-param
This commit is contained in:
commit
96f1284cbf
2 changed files with 5 additions and 13 deletions
|
@ -684,17 +684,11 @@ App::delete('/v1/projects/:projectId')
|
||||||
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
|
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
|
||||||
->label('sdk.response.model', Response::MODEL_NONE)
|
->label('sdk.response.model', Response::MODEL_NONE)
|
||||||
->param('projectId', '', new UID(), 'Project unique ID.')
|
->param('projectId', '', new UID(), 'Project unique ID.')
|
||||||
->param('password', '', new Password(), 'Your user password for confirmation. Must be at least 8 chars.')
|
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('user')
|
->inject('user')
|
||||||
->inject('dbForConsole')
|
->inject('dbForConsole')
|
||||||
->inject('deletes')
|
->inject('deletes')
|
||||||
->action(function (string $projectId, string $password, Response $response, Document $user, Database $dbForConsole, Delete $deletes) {
|
->action(function (string $projectId, Response $response, Document $user, Database $dbForConsole, Delete $deletes) {
|
||||||
|
|
||||||
if (!Auth::passwordVerify($password, $user->getAttribute('password'), $user->getAttribute('hash'), $user->getAttribute('hashOptions'))) { // Double check user password
|
|
||||||
throw new Exception(Exception::USER_INVALID_CREDENTIALS);
|
|
||||||
}
|
|
||||||
|
|
||||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||||
|
|
||||||
if ($project->isEmpty()) {
|
if ($project->isEmpty()) {
|
||||||
|
|
|
@ -3012,15 +3012,13 @@ class ProjectsConsoleClientTest extends Scope
|
||||||
|
|
||||||
$this->assertEquals(200, $project['headers']['status-code']);
|
$this->assertEquals(200, $project['headers']['status-code']);
|
||||||
|
|
||||||
// Delete team
|
// Delete Project
|
||||||
$team = $this->client->call(Client::METHOD_DELETE, '/projects/' . $projectId, array_merge([
|
$project = $this->client->call(Client::METHOD_DELETE, '/projects/' . $projectId, array_merge([
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $this->getProject()['$id'],
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
], $this->getHeaders()), [
|
], $this->getHeaders()));
|
||||||
'password' => 'password'
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->assertEquals(204, $team['headers']['status-code']);
|
$this->assertEquals(204, $project['headers']['status-code']);
|
||||||
|
|
||||||
// Ensure I can get team but not a project
|
// Ensure I can get team but not a project
|
||||||
$team = $this->client->call(Client::METHOD_GET, '/teams/' . $teamId, array_merge([
|
$team = $this->client->call(Client::METHOD_GET, '/teams/' . $teamId, array_merge([
|
||||||
|
|
Loading…
Reference in a new issue