Skip to content

Commit

Permalink
make public class work on api v1 requests
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed May 25, 2017
1 parent d4247e5 commit 3d8fd68
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@
// API/Server is about to initialize
$app->hookEmitter->run('application.init', $app);

// TODO: Move this process to a middleware

/** Skip routes which don't require these protections */
$routeName = $app->router()->getCurrentRoute()->getName();
if (!in_array($routeName, $authAndNonceRouteWhitelist)) {
Expand Down Expand Up @@ -210,8 +212,10 @@
} else if (!$authentication->loggedIn()) {
$directusGroupsTableGateway = new DirectusGroupsTableGateway($ZendDb, $acl);
$publicGroup = $directusGroupsTableGateway->select(['name' => 'public'])->current();
$uri = trim($app->request()->getResourceUri(), '/');
$uriParts = explode('/', $uri);

if ($publicGroup) {
if (ArrayUtils::get($uriParts, 0) === '1.1' && $publicGroup) {
$user = [
'id' => null,
'group' => $publicGroup['id']
Expand Down

0 comments on commit 3d8fd68

Please sign in to comment.