Add membership fee system with disability discount and fix document permissions
Features: - Implement two fee types: entrance fee and annual fee (both NT$1,000) - Add 50% discount for disability certificate holders - Add disability certificate upload in member profile - Integrate disability verification into cashier approval workflow - Add membership fee settings in system admin Document permissions: - Fix hard-coded role logic in Document model - Use permission-based authorization instead of role checks Additional features: - Add announcements, general ledger, and trial balance modules - Add income management and accounting entries - Add comprehensive test suite with factories - Update UI translations to Traditional Chinese 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,8 +14,7 @@ class AuthorizationTest extends TestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->artisan('db:seed', ['--class' => 'RoleSeeder']);
|
||||
$this->artisan('db:seed', ['--class' => 'PaymentVerificationRolesSeeder']);
|
||||
$this->artisan('db:seed', ['--class' => 'FinancialWorkflowPermissionsSeeder', '--force' => true]);
|
||||
}
|
||||
|
||||
public function test_admin_middleware_allows_admin_role(): void
|
||||
@@ -28,18 +27,9 @@ class AuthorizationTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function test_admin_middleware_allows_is_admin_flag(): void
|
||||
{
|
||||
$admin = User::factory()->create(['is_admin' => true]);
|
||||
|
||||
$response = $this->actingAs($admin)->get(route('admin.dashboard'));
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function test_admin_middleware_blocks_non_admin_users(): void
|
||||
{
|
||||
$user = User::factory()->create(['is_admin' => false]);
|
||||
$user = User::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->get(route('admin.dashboard'));
|
||||
|
||||
@@ -87,7 +77,7 @@ class AuthorizationTest extends TestCase
|
||||
|
||||
public function test_cashier_permission_enforced(): void
|
||||
{
|
||||
$cashier = User::factory()->create(['is_admin' => true]);
|
||||
$cashier = User::factory()->create();
|
||||
$cashier->givePermissionTo('verify_payments_cashier');
|
||||
|
||||
$this->assertTrue($cashier->can('verify_payments_cashier'));
|
||||
@@ -97,7 +87,7 @@ class AuthorizationTest extends TestCase
|
||||
|
||||
public function test_accountant_permission_enforced(): void
|
||||
{
|
||||
$accountant = User::factory()->create(['is_admin' => true]);
|
||||
$accountant = User::factory()->create();
|
||||
$accountant->givePermissionTo('verify_payments_accountant');
|
||||
|
||||
$this->assertTrue($accountant->can('verify_payments_accountant'));
|
||||
@@ -107,7 +97,7 @@ class AuthorizationTest extends TestCase
|
||||
|
||||
public function test_chair_permission_enforced(): void
|
||||
{
|
||||
$chair = User::factory()->create(['is_admin' => true]);
|
||||
$chair = User::factory()->create();
|
||||
$chair->givePermissionTo('verify_payments_chair');
|
||||
|
||||
$this->assertTrue($chair->can('verify_payments_chair'));
|
||||
@@ -117,7 +107,7 @@ class AuthorizationTest extends TestCase
|
||||
|
||||
public function test_membership_manager_permission_enforced(): void
|
||||
{
|
||||
$manager = User::factory()->create(['is_admin' => true]);
|
||||
$manager = User::factory()->create();
|
||||
$manager->givePermissionTo('activate_memberships');
|
||||
|
||||
$this->assertTrue($manager->can('activate_memberships'));
|
||||
@@ -134,20 +124,20 @@ class AuthorizationTest extends TestCase
|
||||
|
||||
public function test_role_assignment_works(): void
|
||||
{
|
||||
$user = User::factory()->create(['is_admin' => true]);
|
||||
$user->assignRole('payment_cashier');
|
||||
$user = User::factory()->create();
|
||||
$user->assignRole('finance_cashier');
|
||||
|
||||
$this->assertTrue($user->hasRole('payment_cashier'));
|
||||
$this->assertTrue($user->hasRole('finance_cashier'));
|
||||
$this->assertTrue($user->can('verify_payments_cashier'));
|
||||
$this->assertTrue($user->can('view_payment_verifications'));
|
||||
}
|
||||
|
||||
public function test_permission_inheritance_works(): void
|
||||
{
|
||||
$user = User::factory()->create(['is_admin' => true]);
|
||||
$user->assignRole('payment_cashier');
|
||||
$user = User::factory()->create();
|
||||
$user->assignRole('finance_cashier');
|
||||
|
||||
// payment_cashier role should have these permissions
|
||||
// finance_cashier role should have these permissions
|
||||
$this->assertTrue($user->can('verify_payments_cashier'));
|
||||
$this->assertTrue($user->can('view_payment_verifications'));
|
||||
}
|
||||
@@ -199,34 +189,34 @@ class AuthorizationTest extends TestCase
|
||||
$response->assertRedirect(route('login'));
|
||||
}
|
||||
|
||||
public function test_payment_cashier_role_has_correct_permissions(): void
|
||||
public function test_finance_cashier_role_has_correct_permissions(): void
|
||||
{
|
||||
$user = User::factory()->create(['is_admin' => true]);
|
||||
$user->assignRole('payment_cashier');
|
||||
$user = User::factory()->create();
|
||||
$user->assignRole('finance_cashier');
|
||||
|
||||
$this->assertTrue($user->hasRole('payment_cashier'));
|
||||
$this->assertTrue($user->hasRole('finance_cashier'));
|
||||
$this->assertTrue($user->can('verify_payments_cashier'));
|
||||
$this->assertTrue($user->can('view_payment_verifications'));
|
||||
$this->assertFalse($user->can('verify_payments_accountant'));
|
||||
}
|
||||
|
||||
public function test_payment_accountant_role_has_correct_permissions(): void
|
||||
public function test_finance_accountant_role_has_correct_permissions(): void
|
||||
{
|
||||
$user = User::factory()->create(['is_admin' => true]);
|
||||
$user->assignRole('payment_accountant');
|
||||
$user = User::factory()->create();
|
||||
$user->assignRole('finance_accountant');
|
||||
|
||||
$this->assertTrue($user->hasRole('payment_accountant'));
|
||||
$this->assertTrue($user->hasRole('finance_accountant'));
|
||||
$this->assertTrue($user->can('verify_payments_accountant'));
|
||||
$this->assertTrue($user->can('view_payment_verifications'));
|
||||
$this->assertFalse($user->can('verify_payments_cashier'));
|
||||
}
|
||||
|
||||
public function test_payment_chair_role_has_correct_permissions(): void
|
||||
public function test_finance_chair_role_has_correct_permissions(): void
|
||||
{
|
||||
$user = User::factory()->create(['is_admin' => true]);
|
||||
$user->assignRole('payment_chair');
|
||||
$user = User::factory()->create();
|
||||
$user->assignRole('finance_chair');
|
||||
|
||||
$this->assertTrue($user->hasRole('payment_chair'));
|
||||
$this->assertTrue($user->hasRole('finance_chair'));
|
||||
$this->assertTrue($user->can('verify_payments_chair'));
|
||||
$this->assertTrue($user->can('view_payment_verifications'));
|
||||
$this->assertFalse($user->can('activate_memberships'));
|
||||
@@ -234,7 +224,7 @@ class AuthorizationTest extends TestCase
|
||||
|
||||
public function test_membership_manager_role_has_correct_permissions(): void
|
||||
{
|
||||
$user = User::factory()->create(['is_admin' => true]);
|
||||
$user = User::factory()->create();
|
||||
$user->assignRole('membership_manager');
|
||||
|
||||
$this->assertTrue($user->hasRole('membership_manager'));
|
||||
|
||||
Reference in New Issue
Block a user