Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to Lock will be documented in this file. This file follows the *[Keep a CHANGELOG](http://keepachangelog.com/)* standards.

## [Unreleased]
- Added all method, this feature returns the permissions collection for a caller.

## 0.2.0 - 2015-09-16

### Added
Expand Down
9 changes: 9 additions & 0 deletions spec/Callers/CallerLockSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,13 @@ function it_can_work_with_permission_conditions()
$this->can('create', 'posts')->shouldReturn(true);
$this->can('create', 'pages')->shouldReturn(false);
}

function it_can_fetch_all_permissions()
{
$this->allow('login');
$this->allow('create', 'posts');
$this->deny('delete', 'users');

$this->all()->shouldBeArray();
}
}
10 changes: 10 additions & 0 deletions src/Lock.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ private function clearPermission($action, Resource $resource, array $permissions
}
}

/**
* Fetch collection of all caller permissions
*
* @return Permissions\Permission[]
*/
public function all()
{
return $this->getPermissions();
}

/**
* Determine if an action is allowed
*
Expand Down