assign() public abstract method
Assigns a role to a user.
| public abstract yii\rbac\Assignment assign ( $role, $userId ) | ||
|---|---|---|
| $role | yii\rbac\Role | |
| $userId | string|integer |
The user ID (see yii\web\User::$id) |
| return | yii\rbac\Assignment |
The role assignment information. |
| throws | Exception |
if the role has already been assigned to the user |
Please login to continue.