Commit fe6781f74c36c81db2ea47d8a9809d675a8e461c
1 parent
deeea89d
fixed logic for the default folder to start at for SA, UA, A users
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@541 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
11 additions
and
12 deletions
lib/documentmanagement/DocumentBrowser.inc
| ... | ... | @@ -36,18 +36,13 @@ class DocumentBrowser { |
| 36 | 36 | // no folder specified, so depending on the users groups, resolve to the right folderID |
| 37 | 37 | if ($folderID == -1) { |
| 38 | 38 | // no folder specified, so start at the root folder |
| 39 | + | |
| 40 | + // look up this users unit | |
| 41 | + $unitID = User::getUnitID($_SESSION["userID"]); | |
| 39 | 42 | |
| 40 | - // if this is a system administrator, start her at the root folder | |
| 41 | - if (Permission::userIsSystemAdministrator()) { | |
| 42 | - $folderID = lookupID($default->owl_folders_table, "parent_id", 0); | |
| 43 | - $default->log->info("DocumentBrowser::browseByFolder looked up org root folderID=$folderID"); | |
| 44 | - } else { | |
| 45 | - // start everyone else relative to their unit | |
| 43 | + if ($unitID) { | |
| 44 | + // if the user is in a unit, start at the unit's root folder | |
| 46 | 45 | |
| 47 | - // look up this users unit | |
| 48 | - // FIXME: what if the user belongs to multiple units? | |
| 49 | - //$unitID = lookupField($default->owl_groups_units_table, "unit_id", "group_id", $groupIDs[0]); | |
| 50 | - $unitID = User::getUnitID($_SESSION["userID"]); | |
| 51 | 46 | // lookup the unit name |
| 52 | 47 | $unitName = lookupField($default->owl_units_table, "name", "id", $unitID); |
| 53 | 48 | $default->log->debug("DocumentBrowser::browseByFolder: unitID=$unitID; unitName=$unitName"); |
| ... | ... | @@ -58,8 +53,12 @@ class DocumentBrowser { |
| 58 | 53 | |
| 59 | 54 | // now lookup the folderID |
| 60 | 55 | $folderID = lookupID($default->owl_folders_table, "name", $unitRootFolderName); |
| 61 | - $default->log->info("DocumentBrowser::browseByFolder looked up unit root folderID=$folderID; unit root foldername=$unitRootFolderName"); | |
| 62 | - } | |
| 56 | + $default->log->info("DocumentBrowser::browseByFolder looked up unit root folderID=$folderID; unit root foldername=$unitRootFolderName"); | |
| 57 | + } else { | |
| 58 | + // else just start at the root | |
| 59 | + $folderID = lookupID($default->owl_folders_table, "parent_id", 0); | |
| 60 | + $default->log->info("DocumentBrowser::browseByFolder: starting at docroot folderID=$folderID"); | |
| 61 | + } | |
| 63 | 62 | } else { |
| 64 | 63 | $default->log->info("DocumentBrowser::browseByFolder starting at passed in folderID=$folderID"); |
| 65 | 64 | } | ... | ... |