diff --git a/core/src/core/classes/class.AJXP_PermissionMask.php b/core/src/core/classes/class.AJXP_PermissionMask.php index 17fe4c3511..a54ed1b8c2 100755 --- a/core/src/core/classes/class.AJXP_PermissionMask.php +++ b/core/src/core/classes/class.AJXP_PermissionMask.php @@ -22,7 +22,7 @@ defined('AJXP_EXEC') or die('Access not allowed'); -class AJXP_PermissionMask implements JsonSerializable +class AJXP_PermissionMask implements JsonSerializable, Serializable { /** * @var array @@ -210,7 +210,7 @@ private function pathToBranch($path, $permission){ * @param string $currentRoot * @return AJXP_Permission[] */ - private function flattenTree($tree = null, &$pathes = null, $currentRoot=""){ + public function flattenTree($tree = null, &$pathes = null, $currentRoot=""){ if($tree == null) $tree = $this->getTree(); if($pathes == null) $pathes = array(); if(!is_array($tree) || $tree == null) $tree = array(); @@ -264,4 +264,29 @@ function jsonSerialize() { return $this->flattenTree(); } + + /** + * String representation of object + * @link http://php.net/manual/en/serializable.serialize.php + * @return string the string representation of the object or null + * @since 5.1.0 + */ + public function serialize() + { + return serialize($this->permissionTree); + } + + /** + * Constructs the object + * @link http://php.net/manual/en/serializable.unserialize.php + * @param string $serialized

+ * The string representation of the object. + *

+ * @return void + * @since 5.1.0 + */ + public function unserialize($serialized) + { + $this->permissionTree = unserialize($serialized); + } } \ No newline at end of file