Commit 2b50537f129b8a53a7ab7d84b726ad8c662cc943

Authored by Michael Joseph
1 parent cd8db0a4

updated phpdocs, renamed variables and formatting


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@543 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 17 additions and 20 deletions
lib/session/SiteMap.inc
... ... @@ -36,13 +36,13 @@ class SiteMap {
36 36 * @param string the controller action
37 37 * @param string the corresponding page for this action
38 38 * @param string the section this page falls under
39   - * @param string the user group with access to this page
  39 + * @param int the minimum access needed to access this page
40 40 * @param string description of the page for link presentation
41 41 */
42   - function addPage($action, $page, $sectionName, $groupName, $description) {
43   - $this->siteMapArray[$sectionName][$groupName][$action] = array ("page" => $page,
44   - "description" => $description,
45   - "default" => false);
  42 + function addPage($action, $page, $sectionName, $requiredAccess, $description) {
  43 + $this->siteMapArray[$sectionName][$requiredAccess][$action] = array ("page" => $page,
  44 + "description" => $description,
  45 + "default" => false);
46 46 }
47 47  
48 48 /**
... ... @@ -51,13 +51,13 @@ class SiteMap {
51 51 * @param string the controller action
52 52 * @param string the corresponding page for this action
53 53 * @param string the section this page falls under
54   - * @param string the user group with access to this page
  54 + * @param int the minimum access needed to access this page
55 55 * @param string description of the page for link presentation
56 56 */
57   - function addDefaultPage($action, $page, $sectionName, $groupName, $description) {
58   - $this->siteMapArray[$sectionName][$groupName][$action] = array ("page" => $page,
59   - "description" => $description,
60   - "default" => true);
  57 + function addDefaultPage($action, $page, $sectionName, $requiredAccess, $description) {
  58 + $this->siteMapArray[$sectionName][$requiredAccess][$action] = array ("page" => $page,
  59 + "description" => $description,
  60 + "default" => true);
61 61 }
62 62  
63 63 /**
... ... @@ -69,8 +69,8 @@ class SiteMap {
69 69 global $default;
70 70 // for each section
71 71 foreach ($this->siteMapArray as $section => $valArr) {
72   - // for each group, page array combination
73   - foreach ($valArr as $requiredGroupName => $pageArr) {
  72 + // for each access, page array combination
  73 + foreach ($valArr as $requiredAccess => $pageArr) {
74 74 // now loop through pages until we find the right one
75 75 foreach ($pageArr as $action => $page) {
76 76 if ($sRequiredPage == $page["page"]) {
... ... @@ -89,10 +89,7 @@ class SiteMap {
89 89 * @return boolean true if the user has the access, else false.
90 90 */
91 91 function hasPermission($requiredAccess) {
92   - // sitemap access rules:
93   - // if anonymous
94   - // or the user is in the required group
95   - // or the user is a SA
  92 +
96 93 switch ($requiredAccess) {
97 94 case A : // everyone has access to anonymous pages
98 95 return true;
... ... @@ -134,7 +131,7 @@ class SiteMap {
134 131 // initialise result array
135 132 $results = array("descriptions" => array(), "links" => array());
136 133  
137   - // need to loop through all (groupName, page) arrays in this section
  134 + // need to loop through all (access, page) arrays in this section
138 135 foreach ($this->siteMapArray[$sSectionName] as $requiredAccess => $pages) {
139 136 if ($this->hasPermission($requiredAccess)) {
140 137 foreach ($pages as $action => $pageDetail) {
... ... @@ -204,7 +201,7 @@ class SiteMap {
204 201 // initialise result array
205 202 $results = array();
206 203 // need to loop through all (groupName, page) arrays in this section
207   - foreach ($this->siteMapArray[$sectionName] as $requiredGroupName => $pages) {
  204 + foreach ($this->siteMapArray[$sectionName] as $requiredAccess => $pages) {
208 205 // don't need to check the permissions here, when the controller tries to
209 206 // retrieve the page from the action, the perms will be checked
210 207 //$default->log->debug("Sitemap::getDefaultAction: (section=$sectionName, reqGrp=$requiredGroupName); pages=" . arrayToString($pages));
... ... @@ -236,8 +233,8 @@ class SiteMap {
236 233 foreach ($this->siteMapArray as $section => $valArr) {
237 234 $default->log->debug("Sitemap::getActionFromPage section=$section");
238 235 // for each group, page array combination
239   - foreach ($valArr as $requiredGroupName => $pageArr) {
240   - $default->log->debug("Sitemap::getActionFromPage grp=$requiredGroupName");
  236 + foreach ($valArr as $requiredAccess => $pageArr) {
  237 + $default->log->debug("Sitemap::getActionFromPage access=$requiredAccess");
241 238 // now loop through pages until we find the right one
242 239 foreach ($pageArr as $action => $page) {
243 240 $default->log->debug("Sitemap::getActionFromPage action=$action, reqPage=$sPage; page=" . $page["page"]);
... ...