From f030342c955eda396997aac9bf07027fd82b012a Mon Sep 17 00:00:00 2001 From: JWalczak Date: Thu, 18 Jul 2024 12:06:11 +0200 Subject: [PATCH 1/2] fix: add "vendor" and "composer.lock" in gitignore, add jetbrains ide project files in gitignore --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 477de25..4fd0fec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ .settings .buildpath .project +.idea *bak* *draft* *phprbac.sqlite3* *Doxygen* *phpdoc* -index.php \ No newline at end of file +index.php +vendor +/composer.lock \ No newline at end of file From 5bef29d48396259f70a58e6ce4ff11d9327fea25 Mon Sep 17 00:00:00 2001 From: JWalczak Date: Thu, 18 Jul 2024 12:22:50 +0200 Subject: [PATCH 2/2] fix: descendantsConditional parameter order causes descendants($ID) be interpreted as $AbsoluteDepths, fixed this --- PhpRbac/src/PhpRbac/core/lib/nestedset/full.php | 7 ++++--- PhpRbac/src/PhpRbac/core/lib/rbac.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php b/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php index f2db5a8..8383e5a 100644 --- a/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php +++ b/PhpRbac/src/PhpRbac/core/lib/nestedset/full.php @@ -221,11 +221,12 @@ function deleteSubtreeConditional($ConditionString,$Rest=null) * @param boolean $AbsoluteDepths to return Depth of sub-tree from zero or absolutely from the whole tree * @param string $Condition * @param string $Rest optional, rest of variables to fill in placeholders of condition string, one variable for each ? in condition - * @return Rowset including Depth field - * @seealso children + * @return Rowset including Depth field + * @seealso children */ - function descendantsConditional($ConditionString,$Rest=null,$AbsoluteDepths=false) + function descendantsConditional($ConditionString,$AbsoluteDepths=false,$Rest=null) { + $DepthConcat = ""; if (!$AbsoluteDepths) $DepthConcat="- (sub_tree.innerDepth )"; $Arguments=func_get_args(); diff --git a/PhpRbac/src/PhpRbac/core/lib/rbac.php b/PhpRbac/src/PhpRbac/core/lib/rbac.php index e23ac01..cd105a7 100644 --- a/PhpRbac/src/PhpRbac/core/lib/rbac.php +++ b/PhpRbac/src/PhpRbac/core/lib/rbac.php @@ -334,7 +334,7 @@ function children($ID) */ function descendants($ID) { - $res = $this->{$this->type ()}->descendantsConditional("ID=?", $ID, /* absolute depths*/false); + $res = $this->{$this->type()}->descendantsConditional("ID=?", false, $ID); $out = array (); if (is_array ( $res )) foreach ( $res as $v )