Skip to content

Commit

Permalink
Merge pull request #13 from dtkahl/1.0
Browse files Browse the repository at this point in the history
merge #12 from 1.0
  • Loading branch information
dantodev authored May 26, 2017
2 parents 82fbad4 + 9ed22f8 commit f62ca58
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ Register a new object for the Judge instance.

Set the default user for the Judge instance.

### `getUser()`

Return the default user of the Judge instance.

### `checkRight($rights, $object = null, $user = null)`

Throws `NotAllowedException` if the user do not have the given right(s).
Expand Down
8 changes: 8 additions & 0 deletions src/Judge.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,12 @@ public function setUser($user)
$this->user = $user;
}

/**
* @return UserAccessInterface|null
*/
public function getUser()
{
return $this->user;
}

}
7 changes: 7 additions & 0 deletions tests/AccessControlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,11 @@ public function testExceptionRole()
$this->judge->checkRole("master");
}

public function testGetSetUser()
{
$this->assertEquals(get_class($this->judge->getUser()), TestUser::class);
$this->judge->setUser(null);
$this->assertNull($this->judge->getUser());
}

}

0 comments on commit f62ca58

Please sign in to comment.