mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-20 19:57:44 +02:00
Ensure default group is owned by the provided user
This commit is contained in:
parent
ba4e1edffa
commit
5621115103
@ -15,6 +15,7 @@ class GroupService
|
|||||||
* Assign one or more accounts to a group
|
* Assign one or more accounts to a group
|
||||||
*
|
*
|
||||||
* @param array|int $ids accounts ids to assign
|
* @param array|int $ids accounts ids to assign
|
||||||
|
* @param User $user The user who owns the accounts & the target group
|
||||||
* @param mixed $targetGroup The group the accounts should be assigned to
|
* @param mixed $targetGroup The group the accounts should be assigned to
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||||
@ -109,6 +110,8 @@ class GroupService
|
|||||||
{
|
{
|
||||||
$id = $user->preferences['defaultGroup'] === -1 ? (int) $user->preferences['activeGroup'] : (int) $user->preferences['defaultGroup'];
|
$id = $user->preferences['defaultGroup'] === -1 ? (int) $user->preferences['activeGroup'] : (int) $user->preferences['defaultGroup'];
|
||||||
|
|
||||||
return Group::find($id);
|
return Group::where('id', $id)
|
||||||
|
->where('user_id', $user->id)
|
||||||
|
->first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user