Commit 875246f40850a6576535e34aaf8c4ae82c1d00a4
1 parent
cdecbc05
Don't show folders in breadcrumbs unless you have read permission on
them git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5521 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
24 additions
and
2 deletions
lib/browse/browseutil.inc.php
| @@ -188,10 +188,16 @@ class KTBrowseUtil { | @@ -188,10 +188,16 @@ class KTBrowseUtil { | ||
| 188 | $url = generateControllerUrl($sAction, "fFolderId=1"); | 188 | $url = generateControllerUrl($sAction, "fFolderId=1"); |
| 189 | } | 189 | } |
| 190 | $aBreadcrumbs[] = array("url" => $url, "name" => _kt('Folders')); | 190 | $aBreadcrumbs[] = array("url" => $url, "name" => _kt('Folders')); |
| 191 | + $oUser = User::get($_SESSION['userID']); | ||
| 191 | 192 | ||
| 192 | if ($parents != 0) { | 193 | if ($parents != 0) { |
| 193 | foreach (range(0, $parents - 1) as $index) { | 194 | foreach (range(0, $parents - 1) as $index) { |
| 194 | $id = $folder_path_ids[$index]; | 195 | $id = $folder_path_ids[$index]; |
| 196 | + $oThisFolder = Folder::get($id); | ||
| 197 | + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, 'ktcore.permissions.read', $oThisFolder)) { | ||
| 198 | + $aBreadcrumbs[] = array('name' => '...'); | ||
| 199 | + continue; | ||
| 200 | + } | ||
| 195 | $url = KTUtil::addQueryStringSelf("fFolderId=" . $id); | 201 | $url = KTUtil::addQueryStringSelf("fFolderId=" . $id); |
| 196 | if (!empty($sAction)) { | 202 | if (!empty($sAction)) { |
| 197 | $url = generateControllerUrl($sAction, "fFolderId=" . $id); | 203 | $url = generateControllerUrl($sAction, "fFolderId=" . $id); |
| @@ -202,7 +208,9 @@ class KTBrowseUtil { | @@ -202,7 +208,9 @@ class KTBrowseUtil { | ||
| 202 | 208 | ||
| 203 | // now add this folder, _if we aren't in 1_. | 209 | // now add this folder, _if we aren't in 1_. |
| 204 | if ($oFolder->getId() != 1) { | 210 | if ($oFolder->getId() != 1) { |
| 205 | - if ($bFinal) { | 211 | + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, 'ktcore.permissions.read', $oFolder)) { |
| 212 | + $aBreadcrumbs[] = array('name' => '...'); | ||
| 213 | + } else if ($bFinal) { | ||
| 206 | $aBreadcrumbs[] = array("name" => $oFolder->getName()); | 214 | $aBreadcrumbs[] = array("name" => $oFolder->getName()); |
| 207 | } else { | 215 | } else { |
| 208 | $id = $oFolder->getId(); | 216 | $id = $oFolder->getId(); |
| @@ -214,7 +222,21 @@ class KTBrowseUtil { | @@ -214,7 +222,21 @@ class KTBrowseUtil { | ||
| 214 | } | 222 | } |
| 215 | } | 223 | } |
| 216 | 224 | ||
| 217 | - return $aBreadcrumbs; | 225 | + $aCompactBreadcrumbs = array(); |
| 226 | + $lastdotdotdot = false; | ||
| 227 | + foreach ($aBreadcrumbs as $aBreadcrumb) { | ||
| 228 | + if ($aBreadcrumb['name'] == '...') { | ||
| 229 | + if ($lastdotdotdot == true) { | ||
| 230 | + continue; | ||
| 231 | + } | ||
| 232 | + $lastdotdotdot = true; | ||
| 233 | + } else { | ||
| 234 | + $lastdotdotdot = false; | ||
| 235 | + } | ||
| 236 | + $aCompactBreadcrumbs[] = $aBreadcrumb; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + return $aCompactBreadcrumbs; | ||
| 218 | } | 240 | } |
| 219 | // }}} | 241 | // }}} |
| 220 | 242 |