Commit ab04ff9aab0df5944243bef9e2b5c48b7c8d7ac9
1 parent
97bb1ff3
changed userclass to groupID and added more comments
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@121 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
11 additions
and
14 deletions
lib/SiteMap.inc
| @@ -32,12 +32,12 @@ class SiteMap { | @@ -32,12 +32,12 @@ class SiteMap { | ||
| 32 | * the corresponding page for this action | 32 | * the corresponding page for this action |
| 33 | * @param $sectionName | 33 | * @param $sectionName |
| 34 | * the section this page falls under | 34 | * the section this page falls under |
| 35 | - * @param $userClass | ||
| 36 | - * the user class with access to this page | 35 | + * @param $groupID |
| 36 | + * the user group with access to this page | ||
| 37 | */ | 37 | */ |
| 38 | - function addPage($action, $page, $sectionName, $userClass) { | 38 | + function addPage($action, $page, $sectionName, $groupID) { |
| 39 | // add to map | 39 | // add to map |
| 40 | - $this->siteMapArray[$sectionName][$userClass][$action] = $page; | 40 | + $this->siteMapArray[$sectionName][$groupID][$action] = $page; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | /** | 43 | /** |
| @@ -45,23 +45,20 @@ class SiteMap { | @@ -45,23 +45,20 @@ class SiteMap { | ||
| 45 | * | 45 | * |
| 46 | * @param $action | 46 | * @param $action |
| 47 | * the action to lookup pages for | 47 | * the action to lookup pages for |
| 48 | - * @param $userGroup | ||
| 49 | - * the user group to perform page level validation against | 48 | + * @param $groupID |
| 49 | + * the user group ID to perform page level validation against | ||
| 50 | * @return | 50 | * @return |
| 51 | * the page to redirect to, or false if the user class doesn't | 51 | * the page to redirect to, or false if the user class doesn't |
| 52 | * have access to the page | 52 | * have access to the page |
| 53 | */ | 53 | */ |
| 54 | - function getPage($action, $userGroup) { | ||
| 55 | - // map incoming userClass to number | ||
| 56 | - //$uc = constant($userClass); | 54 | + function getPage($action, $groupID) { |
| 55 | + global $default; | ||
| 57 | 56 | ||
| 58 | - // look up the id for this group | ||
| 59 | - $groupID = group_to_name($userGroup); | ||
| 60 | - | ||
| 61 | - // iterate through multidim sitemap array | 57 | + // for each section |
| 62 | foreach ($this->siteMapArray as $section => $valArr) { | 58 | foreach ($this->siteMapArray as $section => $valArr) { |
| 59 | + // for each group, page array combination | ||
| 63 | foreach ($valArr as $requiredGroup => $pageArr) { | 60 | foreach ($valArr as $requiredGroup => $pageArr) { |
| 64 | - if ($groupID <= group_to_name($requiredGroup)) { | 61 | + if ($groupID <= lookup_id($default->owl_groups_table, "name", $requiredGroup)) { |
| 65 | // now loop through pages until we find the right one | 62 | // now loop through pages until we find the right one |
| 66 | foreach ($pageArr as $ackshin => $page) { | 63 | foreach ($pageArr as $ackshin => $page) { |
| 67 | if ($ackshin == $action) { | 64 | if ($ackshin == $action) { |