Skip to content

Commit

Permalink
Remove exculsivity option
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephSilber committed Dec 8, 2016
1 parent e9f418a commit 280d7bb
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 65 deletions.
13 changes: 0 additions & 13 deletions src/Bouncer.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,6 @@ public static function tables(array $map)
Models::setTables($map);
}

/**
* Set the bouncer to be the exclusive authority on gate access.
*
* @param bool $boolean
* @return $this
*/
public function exclusive($boolean = true)
{
$this->clipboard->setExclusivity($boolean);

return $this;
}

/**
* Resolve the given type from the container.
*
Expand Down
22 changes: 0 additions & 22 deletions src/Clipboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ class Clipboard
{
use HandlesAuthorization;

/**
* Whether the bouncer is the exclusive authority on gate access.
*
* @var bool
*/
protected $exclusive = false;

/**
* Register the clipboard at the given gate.
*
Expand All @@ -39,10 +32,6 @@ public function registerAt(Gate $gate)
if ($id = $this->checkGetId($authority, $ability, $model)) {
return $this->allow('Bouncer granted permission via ability #'.$id);
}

if ($this->exclusive) {
return false;
}
});
}

Expand Down Expand Up @@ -72,17 +61,6 @@ protected function parseGateArguments($arguments, $additional)
return [$arguments, null];
}

/**
* Set whether the bouncer is the exclusive authority on gate access.
*
* @param bool $boolean
* @return $this
*/
public function setExclusivity($boolean)
{
$this->exclusive = $boolean;
}

/**
* Determine if the given authority has the given ability.
*
Expand Down
15 changes: 0 additions & 15 deletions tests/BouncerSimpleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@ public function test_bouncer_can_give_and_remove_wildcard_abilities()
$this->assertTrue($bouncer->denies('edit-site'));
}

public function test_bouncer_can_deny_access_if_set_to_work_exclusively()
{
$bouncer = $this->bouncer();

$bouncer->getGate()->define('access-dashboard', function () {
return true;
});

$this->assertTrue($bouncer->allows('access-dashboard'));

$bouncer->exclusive();

$this->assertTrue($bouncer->denies('access-dashboard'));
}

public function test_bouncer_can_ignore_duplicate_ability_allowances()
{
$user1 = User::create();
Expand Down
15 changes: 0 additions & 15 deletions tests/CustomAuthorityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,6 @@ public function test_bouncer_can_give_and_remove_abilities()
$this->assertTrue($bouncer->denies('edit-site'));
}

public function test_bouncer_can_deny_access_if_set_to_work_exclusively()
{
$bouncer = $this->bouncer(Account::create());

$bouncer->getGate()->define('access-dashboard', function () {
return true;
});

$this->assertTrue($bouncer->allows('access-dashboard'));

$bouncer->exclusive();

$this->assertTrue($bouncer->denies('access-dashboard'));
}

public function test_bouncer_can_ignore_duplicate_ability_allowances()
{
$account1 = Account::create();
Expand Down

0 comments on commit 280d7bb

Please sign in to comment.