Permalink
Browse files

Permission-tweaking

  • Loading branch information...
1 parent fb1507d commit 7eef8d499c12cc1ae3bc851b48f06f54cccf95fc Kristian Lyngstol committed Jan 25, 2009
Showing with 13 additions and 18 deletions.
  1. +1 −1 public_html/subs/content.php
  2. +10 −3 public_html/subs/env.php
  3. +2 −0 public_html/subs/user.php
  4. +0 −14 public_html/template.php
@@ -69,7 +69,7 @@ function content($title = false, $version = -1)
$_SESSION['page'] = $pg;
}
- if(isset($pg) && $pg != "/FrontPage")
+ if(isset($pg) && $pg != "/FrontPage" && $pg != "/")
{
$query .= $db->escape($pg);
$this->title = $pg;
View
@@ -123,6 +123,16 @@ function next_action($action, &$object)
$page->logo->add(img($event->logo,$event->title));
$page->set_css($event->css);
+ $menu = new menuboks($event->title);
+ $menu->add(new content("/" . $event->gname . "Menu"));
+ $page->ctrl1->add(&$menu);
+
+/* Permission */
+ $allowed = perm_path($_SERVER['PATH_INFO'],"r");
+ if (!$allowed)
+ {
+ throw new Error("Permission denied.");
+ }
/* Get the content of the currently selected page and add it to $page */
$maincontent =& new content();
if(!isset($maincontent->content))
@@ -137,9 +147,6 @@ function next_action($action, &$object)
$ticket = new Ticket_System($event);
/* Populate the menu */
- $menu = new menuboks($event->title);
- $menu->add(new content("/" . $event->gname . "Menu"));
- $page->ctrl1->add(&$menu);
$menucrew = new menuboks("/" . $event->title);
$menucrew->add(new content("/" . $event->gname . "CrewMenu"));
$page->ctrl1->add(&$menucrew);
@@ -75,6 +75,8 @@ function perm_end_path($resource, $perm)
function perm_path($resource, $perm)
{
global $me;
+
+ $resource = preg_replace("/^\//","",$resource);
$arr = split("/",$resource);
$str = "";
// Special case - Initial page is /, not "".
View
@@ -7,19 +7,5 @@
* the functionality this page demonstrates will be used internally
* in other parts of bwreg2 as they are developed.
*/
- global $page;
- $crew = perm_path("Crew","r");
- $foo = perm_path("Foo","w");
- $deep = perm_path("Crew/Ticket/Admin","r");
-
- $str = "";
- if ($crew)
- $str .= "Crew ok!<br>\n";
- if ($foo)
- $str .= "Foo ok!<br>\n";
- if ($deep)
- $str .= "Deep ok!<br>\n";
- $page->content->add(str($str));
-global $me;
?>

0 comments on commit 7eef8d4

Please sign in to comment.