mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-13 15:18:41 +00:00
fix cli routing
This commit is contained in:
parent
df89ee433e
commit
c5cd5da5d9
|
|
@ -85,6 +85,9 @@ final class SocketRouter implements RouterInterface
|
||||||
*
|
*
|
||||||
* @param string $route Route regex
|
* @param string $route Route regex
|
||||||
* @param mixed $destination Destination e.g. Module:function string or callback
|
* @param mixed $destination Destination e.g. Module:function string or callback
|
||||||
|
* @param int $verb Request verb
|
||||||
|
* @param array $validation Validation patterns
|
||||||
|
* @param string $dataPattern Data patterns
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -93,6 +96,7 @@ final class SocketRouter implements RouterInterface
|
||||||
public function add(
|
public function add(
|
||||||
string $route,
|
string $route,
|
||||||
mixed $destination,
|
mixed $destination,
|
||||||
|
int $verb = RouteVerb::GET,
|
||||||
array $validation = [],
|
array $validation = [],
|
||||||
string $dataPattern = ''
|
string $dataPattern = ''
|
||||||
) : void
|
) : void
|
||||||
|
|
@ -103,6 +107,7 @@ final class SocketRouter implements RouterInterface
|
||||||
|
|
||||||
$this->routes[$route][] = [
|
$this->routes[$route][] = [
|
||||||
'dest' => $destination,
|
'dest' => $destination,
|
||||||
|
'verb' => $verb,
|
||||||
'validation' => empty($validation) ? null : $validation,
|
'validation' => empty($validation) ? null : $validation,
|
||||||
'pattern' => empty($dataPattern) ? null : $dataPattern,
|
'pattern' => empty($dataPattern) ? null : $dataPattern,
|
||||||
];
|
];
|
||||||
|
|
@ -112,6 +117,7 @@ final class SocketRouter implements RouterInterface
|
||||||
* Route request.
|
* Route request.
|
||||||
*
|
*
|
||||||
* @param string $uri Route
|
* @param string $uri Route
|
||||||
|
* @param int $verb Route verb
|
||||||
* @param string $app Application name
|
* @param string $app Application name
|
||||||
* @param int $orgId Organization id
|
* @param int $orgId Organization id
|
||||||
* @param Account $account Account
|
* @param Account $account Account
|
||||||
|
|
@ -123,6 +129,7 @@ final class SocketRouter implements RouterInterface
|
||||||
*/
|
*/
|
||||||
public function route(
|
public function route(
|
||||||
string $uri,
|
string $uri,
|
||||||
|
int $verb = RouteVerb::GET,
|
||||||
string $app = null,
|
string $app = null,
|
||||||
int $orgId = null,
|
int $orgId = null,
|
||||||
Account $account = null,
|
Account $account = null,
|
||||||
|
|
@ -136,6 +143,10 @@ final class SocketRouter implements RouterInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($destination as $d) {
|
foreach ($destination as $d) {
|
||||||
|
if ($d['verb'] === RouteVerb::ANY
|
||||||
|
|| $verb === RouteVerb::ANY
|
||||||
|
|| ($verb & $d['verb']) === $verb
|
||||||
|
) {
|
||||||
// if permission check is invalid
|
// if permission check is invalid
|
||||||
if ((isset($d['permission']) && !empty($d['permission']) && $account === null)
|
if ((isset($d['permission']) && !empty($d['permission']) && $account === null)
|
||||||
|| (isset($d['permission']) && !empty($d['permission'])
|
|| (isset($d['permission']) && !empty($d['permission'])
|
||||||
|
|
@ -168,6 +179,7 @@ final class SocketRouter implements RouterInterface
|
||||||
$bound[] = $temp;
|
$bound[] = $temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $bound;
|
return $bound;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user