Better locction for missing project error
This commit is contained in:
parent
e706465723
commit
066f08fcf5
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue