mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-26 10:15:40 +01:00
Add Group scope to TwoFAccount model
This commit is contained in:
parent
273aaa9840
commit
afc2095e27
@ -4,6 +4,7 @@
|
||||
|
||||
use App\TwoFAccount;
|
||||
use App\Classes\OTP;
|
||||
use App\Classes\Options;
|
||||
use Illuminate\Http\Request;
|
||||
use ParagonIE\ConstantTime\Base32;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@ -17,7 +18,8 @@ class TwoFAccountController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return response()->json(TwoFAccount::ordered()->get()->toArray());
|
||||
return response()->json(TwoFAccount::ofGroup(Options::get('activeGroup'))->get()->toArray());
|
||||
//return response()->json(TwoFAccount::ordered()->get()->toArray());
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,6 +55,23 @@ protected static function boot()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Scope a query to only include TwoFAccounts of a given group.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param mixed $groupId
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeOfGroup($query, $groupId)
|
||||
{
|
||||
if( $groupId ) {
|
||||
return $query->where('group_id', $groupId);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sortable settings
|
||||
*
|
||||
|
@ -38,7 +38,8 @@
|
||||
'useBasicQrcodeReader' => false,
|
||||
'displayMode' => 'list',
|
||||
'showAccountsIcons' => true,
|
||||
'kickUserAfter' => '15'
|
||||
'kickUserAfter' => '15',
|
||||
'activeGroup' => 0,
|
||||
],
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user