isHierarch function restored
authorniekt0 <niekt0@kyberia.cz>
Tue, 17 Jan 2012 21:36:24 +0000 (22:36 +0100)
committerniekt0 <niekt0@kyberia.cz>
Tue, 17 Jan 2012 21:36:24 +0000 (22:36 +0100)
wwwroot/backend/mysql/permissions.inc
wwwroot/inc/senate.inc

index 6ef959610a41be99105e7433cf45730f8461abf2..ace0e60a911f4d36b279cdf4d06afbda466f7b5b 100644 (file)
@@ -2,6 +2,36 @@
 
 class permissions {
 
+// XXX not checked 
+
+function isHierarch($node) {
+
+       global $db;
+       if (IsSet($_SESSION['user_id'])) {
+               $user_id=$_SESSION['user_id'];
+       } else {
+               $user_id=0;
+       }
+       if (!$user_id) return false;
+
+       $node_vector=chunk_split($node['node_vector'],VECTOR_CHARS,';');
+       $hierarchy=explode(';',$node_vector);
+       foreach ($hierarchy as $hierarch) {
+               $hierarch=ltrim($hierarch,0);
+               $q="select nodes.node_creator,node_access.node_permission from nodes left join node_access on nodes.node_id=node_access.node_id and node_access.user_id='".$user_id."' where nodes.node_id='$hierarch'";
+               $result=$db->query($q);
+               $result->next();
+               if ($result->getString('node_creator')==$user_id)
+                       return true;
+               if ($result->getString('node_permission')=='master')
+                       return true;
+               if ($result->getString('node_creator')=='operator')
+                       return true;
+       }
+       return false;
+
+}
+
 //trillion lights to Hierarchy!
 //$node input parameter can be a numeric node_id of a node-to-be-checked or a hash containing node_id,node_vector
 public static function checkPerms($node) {
index de5c4dc86a8079b834d12b532ef65f00569a34a5..a5f30258d71612d121cda95b82493dfc67b2c2b4 100644 (file)
@@ -3,7 +3,7 @@ define('DAILY_K',30);
 define('REGISTRATION_VOTES',2); //too small so far
 
 // logout after one hour
-define('LOGOUT_IDLE_SEC', 3600);
+define('LOGOUT_IDLE_SEC', 7200);
 
 // An attempt to remove hard-code constants from code
 define('MAIL_NODE',24);
This page took 0.134417 seconds and 4 git commands to generate.