<?php
/**
* Table Definition for Group_Rights
+ *
+ * // what they mean:
+ // A - add
+ // D - delete
+ // E - edit
+ // S - list
+ // P - print / export
+ // I - import
+ // M????
+ *
+ *
*/
require_once 'DB/DataObject.php';
public $__table = 'Group_Rights'; // table name
public $rightname; // string(64) not_null
public $group_id; // int(11) not_null
- public $AccessMask; // string(10) not_null
+ public $accessmask; // string(10) not_null
public $id; // int(11) not_null primary_key auto_increment
$ret = array();
while($t->fetch()) {
if (isset($ret[$t->rightname])) {
- $ret[$t->rightname] = $this->mergeMask($ret[$t->rightname], $t->AccessMask);
+ $ret[$t->rightname] = $this->mergeMask($ret[$t->rightname], $t->accessmask);
continue;
}
- $ret[$t->rightname] = $t->AccessMask;
+ $ret[$t->rightname] = $t->accessmask;
}
// blank out rights that are disabled by the system..
$defs = $this->defaultPermData();
$enabled = array('Core') ;
$enabled = explode(',', $ff->enable);
$disabled = explode(',', $ff->disable? $ff->disable: '');
- $pman = dirname(__FILE__).'/../../';
+ $pman = $ff->rootDir . '/Pman/';
$ret = array();
//echo '<PRE>';print_r($enabled);
foreach($enabled as $module) {
continue;
}
$ar = (array)json_decode(file_get_contents($fn));
+ if (empty($ar)) {
+ // since these are critical files.. die'ing with error is ok.
+ die("invalid json file: " . $fn);
+ }
// echo '<PRE>';print_r($ar);
foreach($ar as $k=> $perm) {
if ($k[0] == '/') {
$defs = $this->defaultPermData();
switch($g->name) {
case "Administrators";
- $this->AccessMask = $this->mergeMask($this->AccessMask, $defs[$this->rightname][0]);
+ $this->accessmask = $this->mergeMask($this->accessmask, $defs[$this->rightname][0]);
break;
default:
- $this->AccessMask = $this->mergeMask($this->AccessMask, $defs[$this->rightname][1]);
+ //$this->accessmask = $this->mergeMask($this->accessmask, $defs[$this->rightname][1]);
break;
}
}
+ /**
+ * generates the default admin group.
+ * and returns it.
+ */
function genDefault()
{
// need to create to special groups, admin & DEFAULT.
$g = DB_DataObject::Factory('Groups');
$g->name = 'Administrators';
+ $g->type = 0;
if (!$g->find(true)) {
$g->insert();
}
$this->applyDefs($g, 0);
-
+ return $g;
}
function applyDefs($g, $usecol) {
$defs = $this->defaultPermData();
+ //echo '<PRE>';print_r($defs);
//$usecol = 1;
foreach($defs as $rightname => $defdata) {
$gr = DB_DataObject::Factory('Group_Rights');
$gr->rightname = $rightname;
$gr->group_id = $g->id;
if (!$gr->find(true)) {
- $gr->AccessMask = $defdata[$usecol];
+ $gr->accessmask = $defdata[$usecol];
$gr->insert();
continue;
}
$oldgr = clone($gr);
- $gr->AccessMask = $gr->mergeMask($gr->AccessMask, $defdata[$usecol]);
- if ($gr->AccesMask == $oldgr->AccesMask) {
+ $gr->accessmask = $gr->mergeMask($gr->accessmask, $defdata[$usecol]);
+ if ($gr->accessmask == $oldgr->accessmask) {
continue;
}
$gr->update($oldgr);