create-prisma-php-app 1.11.11 → 1.11.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -251,14 +251,7 @@ function checkForDuplicateRoutes()
251
251
  if ($basename === 'layout.php') continue;
252
252
 
253
253
  if (count($originalRoutes) > 1 && strpos($normalizedRoute, DIRECTORY_SEPARATOR) !== false) {
254
- $directGroupMatchFound = false;
255
- foreach ($originalRoutes as $originalRoute) {
256
- if (preg_match('~^\\.\\/src\\/app[\\/\\\\]\\(.*?\\)[\\/\\\\].*?\\.php$~', $originalRoute, $matches)) {
257
- $directGroupMatchFound = true;
258
- }
259
- }
260
-
261
- if ($directGroupMatchFound) continue;
254
+ if ($basename !== 'route.php' && $basename !== 'index.php') continue;
262
255
 
263
256
  $errorMessages[] = "Duplicate route found after normalization: " . $normalizedRoute;
264
257
 
@@ -10,6 +10,7 @@ use DateTime;
10
10
  class Auth
11
11
  {
12
12
  public const PAYLOAD_NAME = 'role';
13
+ public const ROLE_NAME = '';
13
14
  public const PAYLOAD = 'payload';
14
15
  public const COOKIE_NAME = 'auth_token';
15
16
 
@@ -72,7 +72,7 @@ class AuthMiddleware
72
72
  $roleBasedRoutes = AuthConfig::$roleBasedRoutes ?? [];
73
73
  foreach ($roleBasedRoutes as $pattern => $data) {
74
74
  if (self::getUriRegex($pattern, $requestUri)) {
75
- $userRole = $auth->getPayload() ?? null;
75
+ $userRole = Auth::ROLE_NAME ? $auth->getPayload()[Auth::ROLE_NAME] : $auth->getPayload();
76
76
  if ($userRole !== null && AuthConfig::checkAuthRole($userRole, $data[AuthConfig::ROLE_IDENTIFIER])) {
77
77
  return true;
78
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.11.11",
3
+ "version": "1.11.13",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",