public getAssignments ( string | integer $userId ) : |
||
$userId | string | integer | the user ID (see [[\yii\web\User::id]]) |
return | the assignments indexed by role names. An empty array will be returned if there is no role assigned to the user. |
public function getAssignments($userId);
public function testAssignmentsToIntegerId() { $this->prepareData(); $reader = $this->auth->getRole('reader'); $author = $this->auth->getRole('author'); $this->auth->assign($reader, 42); $this->auth->assign($author, 1337); $this->auth->assign($reader, 1337); $this->auth = $this->createManager(); $this->assertEquals(0, count($this->auth->getAssignments(0))); $this->assertEquals(1, count($this->auth->getAssignments(42))); $this->assertEquals(2, count($this->auth->getAssignments(1337))); }