mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-20 09:30:49 +08:00
fix create user
This commit is contained in:
@@ -103,7 +103,16 @@ class UserRepository extends BaseRepository
|
||||
if (mb_strlen($password) < 6 || mb_strlen($password) > 40) {
|
||||
throw new \InvalidArgumentException("Invalid password: $password, it should be more than 6 character and less than 40 character");
|
||||
}
|
||||
$class = !empty($params['class']) ? intval($params['class']) : User::CLASS_USER;
|
||||
if (!empty($params['class'])) {
|
||||
$class =intval($params['class']);
|
||||
$authUser = Auth::user();
|
||||
if ($authUser && $class >= $authUser->class) {
|
||||
throw new InsufficientPermissionException('No permission');
|
||||
}
|
||||
} else {
|
||||
$class = User::CLASS_USER;
|
||||
}
|
||||
|
||||
if (!isset(User::$classes[$class])) {
|
||||
throw new \InvalidArgumentException("Invalid user class: $class");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user