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,13 +36,13 @@ class SiteMap {
36 * @param string the controller action 36 * @param string the controller action
37 * @param string the corresponding page for this action 37 * @param string the corresponding page for this action
38 * @param string the section this page falls under 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 * @param string description of the page for link presentation 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,13 +51,13 @@ class SiteMap {
51 * @param string the controller action 51 * @param string the controller action
52 * @param string the corresponding page for this action 52 * @param string the corresponding page for this action
53 * @param string the section this page falls under 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 * @param string description of the page for link presentation 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,8 +69,8 @@ class SiteMap {
69 global $default; 69 global $default;
70 // for each section 70 // for each section
71 foreach ($this->siteMapArray as $section => $valArr) { 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 // now loop through pages until we find the right one 74 // now loop through pages until we find the right one
75 foreach ($pageArr as $action => $page) { 75 foreach ($pageArr as $action => $page) {
76 if ($sRequiredPage == $page["page"]) { 76 if ($sRequiredPage == $page["page"]) {
@@ -89,10 +89,7 @@ class SiteMap { @@ -89,10 +89,7 @@ class SiteMap {
89 * @return boolean true if the user has the access, else false. 89 * @return boolean true if the user has the access, else false.
90 */ 90 */
91 function hasPermission($requiredAccess) { 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 switch ($requiredAccess) { 93 switch ($requiredAccess) {
97 case A : // everyone has access to anonymous pages 94 case A : // everyone has access to anonymous pages
98 return true; 95 return true;
@@ -134,7 +131,7 @@ class SiteMap { @@ -134,7 +131,7 @@ class SiteMap {
134 // initialise result array 131 // initialise result array
135 $results = array("descriptions" => array(), "links" => array()); 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 foreach ($this->siteMapArray[$sSectionName] as $requiredAccess => $pages) { 135 foreach ($this->siteMapArray[$sSectionName] as $requiredAccess => $pages) {
139 if ($this->hasPermission($requiredAccess)) { 136 if ($this->hasPermission($requiredAccess)) {
140 foreach ($pages as $action => $pageDetail) { 137 foreach ($pages as $action => $pageDetail) {
@@ -204,7 +201,7 @@ class SiteMap { @@ -204,7 +201,7 @@ class SiteMap {
204 // initialise result array 201 // initialise result array
205 $results = array(); 202 $results = array();
206 // need to loop through all (groupName, page) arrays in this section 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 // don't need to check the permissions here, when the controller tries to 205 // don't need to check the permissions here, when the controller tries to
209 // retrieve the page from the action, the perms will be checked 206 // retrieve the page from the action, the perms will be checked
210 //$default->log->debug("Sitemap::getDefaultAction: (section=$sectionName, reqGrp=$requiredGroupName); pages=" . arrayToString($pages)); 207 //$default->log->debug("Sitemap::getDefaultAction: (section=$sectionName, reqGrp=$requiredGroupName); pages=" . arrayToString($pages));
@@ -236,8 +233,8 @@ class SiteMap { @@ -236,8 +233,8 @@ class SiteMap {
236 foreach ($this->siteMapArray as $section => $valArr) { 233 foreach ($this->siteMapArray as $section => $valArr) {
237 $default->log->debug("Sitemap::getActionFromPage section=$section"); 234 $default->log->debug("Sitemap::getActionFromPage section=$section");
238 // for each group, page array combination 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 // now loop through pages until we find the right one 238 // now loop through pages until we find the right one
242 foreach ($pageArr as $action => $page) { 239 foreach ($pageArr as $action => $page) {
243 $default->log->debug("Sitemap::getActionFromPage action=$action, reqPage=$sPage; page=" . $page["page"]); 240 $default->log->debug("Sitemap::getActionFromPage action=$action, reqPage=$sPage; page=" . $page["page"]);