Commit 089d799b95724240e3d96de4ab6241edd357c4e4

Authored by Michael Joseph
1 parent fd75b5d0

changed to use user groups instead of "userClass"


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@85 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 10 additions and 7 deletions
lib/SiteMap.inc
... ... @@ -45,20 +45,23 @@ class SiteMap {
45 45 *
46 46 * @param $action
47 47 * the action to lookup pages for
48   - * @param $userClass
49   - * the userclass to perform page level validation against
  48 + * @param $userGroup
  49 + * the user group to perform page level validation against
50 50 * @return
51 51 * the page to redirect to, or false if the user class doesn't
52 52 * have access to the page
53 53 */
54   - function getPage($action, $userClass) {
  54 + function getPage($action, $userGroup) {
55 55 // map incoming userClass to number
56   - $uc = constant($userClass);
  56 + //$uc = constant($userClass);
  57 +
  58 + // look up the id for this group
  59 + $groupID = group_to_name($userGroup);
57 60  
58 61 // iterate through multidim sitemap array
59 62 foreach ($this->siteMapArray as $section => $valArr) {
60   - foreach ($valArr as $userAccess => $pageArr) {
61   - if ($uc <= constant($userAccess)) {
  63 + foreach ($valArr as $requiredGroup => $pageArr) {
  64 + if ($groupID <= group_to_name($requiredGroup)) {
62 65 // now loop through pages until we find the right one
63 66 foreach ($pageArr as $ackshin => $page) {
64 67 if ($ackshin == $action) {
... ... @@ -69,7 +72,7 @@ class SiteMap {
69 72 }
70 73 }
71 74 // if the function hasn't returned already then the specified
72   - // userClass does not have access to the action
  75 + // userGroup does not have access to the action
73 76 return false;
74 77 }
75 78  
... ...