Restructure src/ and tests/ from package-by-type to package-by-domain
CI / Coding Standards (push) Successful in 43s
CI / PHPStan (push) Successful in 52s
CI / Tests (PHP 8.1) (push) Successful in 47s
CI / Tests (PHP 8.2) (push) Successful in 49s
CI / Tests (PHP 8.3) (push) Successful in 37s
CI / No Debug Code (push) Successful in 2s
CI / Coding Standards (push) Successful in 43s
CI / PHPStan (push) Successful in 52s
CI / Tests (PHP 8.1) (push) Successful in 47s
CI / Tests (PHP 8.2) (push) Successful in 49s
CI / Tests (PHP 8.3) (push) Successful in 37s
CI / No Debug Code (push) Successful in 2s
All classes are now organised by domain (Availability, Booking, Auth). Each domain package contains its value object, repository, admin controller, REST endpoint, and any shortcode pages under a matching sub-namespace. Cross-cutting wiring (Plugin, AdminMenu, RestRegistrar, ShortcodeRegistrar, Schema) lives at src/ root. Tests mirror the domain structure. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Unsupervised\Schedular\Auth;
|
||||
|
||||
class RoleManager {
|
||||
|
||||
public const INSTRUCTOR = 'us_instructor';
|
||||
public const STUDENT = 'us_student';
|
||||
|
||||
public const CAP_MANAGE_AVAILABILITY = 'manage_availability';
|
||||
public const CAP_VIEW_LESSONS = 'view_own_lessons';
|
||||
public const CAP_BOOK_LESSON = 'book_lesson';
|
||||
|
||||
public function register(): void {
|
||||
add_action( 'init', [ $this, 'createRoles' ] );
|
||||
}
|
||||
|
||||
public function createRoles(): void {
|
||||
if ( get_role( self::INSTRUCTOR ) === null ) {
|
||||
add_role(
|
||||
self::INSTRUCTOR,
|
||||
__( 'Instructor', 'unsupervised-schedular' ),
|
||||
[
|
||||
'read' => true,
|
||||
self::CAP_MANAGE_AVAILABILITY => true,
|
||||
self::CAP_VIEW_LESSONS => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ( get_role( self::STUDENT ) === null ) {
|
||||
add_role(
|
||||
self::STUDENT,
|
||||
__( 'Student', 'unsupervised-schedular' ),
|
||||
[
|
||||
'read' => true,
|
||||
self::CAP_BOOK_LESSON => true,
|
||||
self::CAP_VIEW_LESSONS => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user