Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul Patel committed Apr 28, 2019
1 parent c788bee commit 9da9d2f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 215 deletions.
23 changes: 19 additions & 4 deletions src/core/Directus/Permissions/Acl.php
Expand Up @@ -1245,11 +1245,26 @@ public function allowTo($action, $level, $collection, $status = null)
if ($this->isAdmin()) {
return true;
}
if($status){
$permission = $this->getPermission($collection, $status);
$permissionLevel = ArrayUtils::get($permission, $action);
return $this->can($permissionLevel, $level);
}else{
$statuses = $this->getCollectionStatuses($collection);

$allowed = false;
foreach ($statuses as $status) {
$permission = $this->getPermission($collection, $status);
$permissionLevel = ArrayUtils::get($permission, $action);

if ($this->can($permissionLevel, $level)) {
$allowed = true;
break;
}
}

$permission = $this->getPermission($collection, $status);
$permissionLevel = ArrayUtils::get($permission, $action);

return $this->can($permissionLevel, $level);
return $allowed;
}
}

public function allowToOnce($action, $collection)
Expand Down
55 changes: 0 additions & 55 deletions tests/api/AuthTest.php

This file was deleted.

156 changes: 0 additions & 156 deletions tests/api/CollectionTest.php

This file was deleted.

0 comments on commit 9da9d2f

Please sign in to comment.