Total Complexity | 9 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | abstract class Role |
||
10 | { |
||
11 | /** |
||
12 | * Whether the current user can update from oldRole to newRole. |
||
13 | * |
||
14 | * The current user is allowed to promote another user up to the same role as himself. So |
||
15 | * a Responsible can promote a Member to Responsible. Or an Admin can promote a Member to Admin. |
||
16 | * |
||
17 | * But the current user is **not** allowed to demote a user who has a higher role than himself. |
||
18 | * That means that a Responsible cannot demote an Admin to Member. |
||
19 | */ |
||
20 | 10 | public static function canUpdate(?User $currentUser, string $oldRole, string $newRole): bool |
|
56 |