mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Fix permission type and error logs
This commit is contained in:
parent
bfc457115c
commit
536d480a36
|
|
@ -25,7 +25,7 @@ namespace phpOMS\Account;
|
|||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class PermissionAbstract
|
||||
class PermissionAbstract implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Permission id.
|
||||
|
|
@ -54,7 +54,7 @@ class PermissionAbstract
|
|||
/**
|
||||
* Module id.
|
||||
*
|
||||
* @var int|null
|
||||
* @var string|null
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $module = null;
|
||||
|
|
@ -166,11 +166,11 @@ class PermissionAbstract
|
|||
/**
|
||||
* Get module id.
|
||||
*
|
||||
* @return int|null
|
||||
* @return string|null
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getModule() : ?int
|
||||
public function getModule() : ?string
|
||||
{
|
||||
return $this->module;
|
||||
}
|
||||
|
|
@ -178,13 +178,13 @@ class PermissionAbstract
|
|||
/**
|
||||
* Set module id.
|
||||
*
|
||||
* @param int $module Module
|
||||
* @param string $module Module
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setModule(int $module = null) : void
|
||||
public function setModule(string $module = null) : void
|
||||
{
|
||||
$this->module = $module;
|
||||
}
|
||||
|
|
@ -346,4 +346,22 @@ class PermissionAbstract
|
|||
{
|
||||
return ($this->permission | $permission) === $this->permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'unit' => $this->unit,
|
||||
'app' => $this->app,
|
||||
'module' => $this->module,
|
||||
'from' => $this->from,
|
||||
'type' => $this->type,
|
||||
'element' => $this->element,
|
||||
'component' => $this->component,
|
||||
'permission' => $this->permission,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,26 +62,19 @@ final class UnhandledHandler
|
|||
$logger = FileLogger::getInstance(__DIR__ . '/../Logs');
|
||||
|
||||
if (!(\error_reporting() & $errno)) {
|
||||
$logger->error(FileLogger::MSG_FULL, [
|
||||
'message' => 'Undefined error',
|
||||
'line' => $errline,
|
||||
'file' => $errfile,
|
||||
]);
|
||||
|
||||
\error_clear_last();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
\error_clear_last();
|
||||
|
||||
$logger->error(FileLogger::MSG_FULL, [
|
||||
'message' => 'Unhandled error',
|
||||
'message' => 'Undefined error',
|
||||
'line' => $errline,
|
||||
'file' => $errfile,
|
||||
]);
|
||||
|
||||
\error_clear_last();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +89,7 @@ final class UnhandledHandler
|
|||
public static function shutdownHandler() : void
|
||||
{
|
||||
$e = \error_get_last();
|
||||
\error_clear_last();
|
||||
|
||||
if ($e !== null) {
|
||||
$logger = FileLogger::getInstance(__DIR__ . '/../Logs');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user