1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

Better locction for missing project error

This commit is contained in:
Eldad Fux 2019-12-17 06:16:50 +02:00
parent e706465723
commit 066f08fcf5
2 changed files with 5 additions and 5 deletions

View file

@ -55,6 +55,7 @@ $clients = array_unique(array_merge($clientsConsole, array_map(function ($node)
}))));
$utopia->init(function () use ($utopia, $request, $response, &$user, $project, $roles, $webhook, $audit, $usage, $domain, $clients) {
$route = $utopia->match($request);
$referrer = $request->getServer('HTTP_REFERER', '');
@ -158,6 +159,10 @@ $utopia->init(function () use ($utopia, $request, $response, &$user, $project, $
// TDOO Check if user is god
if (!in_array($scope, $scopes)) {
if (empty($project->getUid()) || Database::SYSTEM_COLLECTION_PROJECTS !== $project->getCollection()) { // Check if permission is denied because project is missing
throw new Exception('Project not found', 404);
}
throw new Exception($user->getAttribute('email', 'Guest').' (role: '.strtolower($roles[$role]['label']).') missing scope ('.$scope.')', 401);
}

View file

@ -8,11 +8,6 @@ use Database\Database;
global $utopia, $request, $response, $register, $user, $project;
$utopia->init(function () use ($utopia, $request, $response, $register, $user, $project) {
if (empty($project->getUid()) || Database::SYSTEM_COLLECTION_PROJECTS !== $project->getCollection()) {
throw new Exception('Project not found', 404);
}
$route = $utopia->match($request);
/*