feat: enhance player authentication and agent management features
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
- Updated AGENTS.md to clarify player interface bindings and agent account restrictions. - Improved PlayerAuthLoginController to include captcha verification for player login. - Enhanced AdminPlayerIndexController with permission checks for admin users. - Refactored AdminPlayerStoreController to enforce agent node restrictions for non-super admins. - Introduced new error codes for player authentication failures and updated related services. - Enhanced validation rules for agent profiles to include settlement cycle options. - Improved AdminCaptchaService to support separate scopes for admin and player captcha handling. - Updated various services to ensure proper credit management and settlement processes.
This commit is contained in:
@@ -2,13 +2,16 @@
|
||||
|
||||
use App\Models\AdminRole;
|
||||
use App\Models\AdminUser;
|
||||
use Database\Seeders\AdminRbacAndUserSeeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function (): void {
|
||||
$this->artisan('lottery:admin-auth-sync')->assertExitCode(0);
|
||||
});
|
||||
|
||||
function makeFinanceReportAdminToken(): string
|
||||
{
|
||||
$admin = AdminUser::query()->create([
|
||||
@@ -19,7 +22,7 @@ function makeFinanceReportAdminToken(): string
|
||||
'status' => 0,
|
||||
]);
|
||||
|
||||
$role = AdminRole::query()->where('slug', 'finance')->firstOrFail();
|
||||
$role = AdminRole::query()->where('slug', 'site_finance')->firstOrFail();
|
||||
$siteId = AdminUser::defaultAdminSiteId();
|
||||
$admin->roles()->sync([
|
||||
(int) $role->id => [
|
||||
@@ -32,9 +35,7 @@ function makeFinanceReportAdminToken(): string
|
||||
}
|
||||
|
||||
test('finance role with report legacy can access report jobs after rbac seed', function (): void {
|
||||
$this->seed(AdminRbacAndUserSeeder::class);
|
||||
|
||||
$finance = AdminRole::query()->where('slug', 'finance')->firstOrFail();
|
||||
$finance = AdminRole::query()->where('slug', 'site_finance')->firstOrFail();
|
||||
expect($finance->legacyPermissionSlugs())->toContain('prd.report.view');
|
||||
|
||||
$hasReportAction = DB::table('admin_role_menu_actions as rma')
|
||||
@@ -53,10 +54,6 @@ test('finance role with report legacy can access report jobs after rbac seed', f
|
||||
});
|
||||
|
||||
test('report read api resources bind service.report.view only', function (): void {
|
||||
$this->seed(AdminRbacAndUserSeeder::class);
|
||||
|
||||
$this->artisan('lottery:admin-auth-sync')->assertExitCode(0);
|
||||
|
||||
$codes = [
|
||||
'admin.reports.daily-profit',
|
||||
'admin.report-jobs.index',
|
||||
@@ -69,10 +66,6 @@ test('report read api resources bind service.report.view only', function (): voi
|
||||
});
|
||||
|
||||
test('report export api resources bind service.report.export', function (): void {
|
||||
$this->seed(AdminRbacAndUserSeeder::class);
|
||||
|
||||
$this->artisan('lottery:admin-auth-sync')->assertExitCode(0);
|
||||
|
||||
expect(bindingsForResource('admin.report-jobs.download'))->toBe(['service.report.export']);
|
||||
expect(bindingsForResource('admin.report-jobs.store'))->toBe(['service.report.export']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user