|
@@ -90,8 +90,10 @@ class AuthorityService
|
|
|
|
|
|
|
|
foreach ($authorities as $authority){
|
|
foreach ($authorities as $authority){
|
|
|
if ($authority->parent_id){
|
|
if ($authority->parent_id){
|
|
|
- if (isset($authMap[$authority->parent_id]))$authMap[$authority->parent_id]["child"][] = $authMap[$authority->id];
|
|
|
|
|
- else $authMap = $this->formatAuthority($authMap,$authMap[$authority->id]);
|
|
|
|
|
|
|
+ if (!isset($authMap[$authority->parent_id])){
|
|
|
|
|
+ $authTem = $this->formatAuthority($authMap,$authMap[$authority->id]);
|
|
|
|
|
+ if ($authTem)$authMap = $authTem;
|
|
|
|
|
+ } else $authMap[$authority->parent_id]["child"][] = $authMap[$authority->id];
|
|
|
unset($authMap[$authority->id]);
|
|
unset($authMap[$authority->id]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -105,7 +107,7 @@ class AuthorityService
|
|
|
* @param array $authMap
|
|
* @param array $authMap
|
|
|
* @param array $authorities
|
|
* @param array $authorities
|
|
|
*
|
|
*
|
|
|
- * @return array
|
|
|
|
|
|
|
+ * @return array|bool
|
|
|
*/
|
|
*/
|
|
|
private function formatAuthority(array $authMap,array $authorities)
|
|
private function formatAuthority(array $authMap,array $authorities)
|
|
|
{
|
|
{
|
|
@@ -124,6 +126,6 @@ class AuthorityService
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return $authMap;
|
|
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|