X-Git-Url: http://git.roojs.org/?p=Pman.Admin;a=blobdiff_plain;f=GroupRights.php;h=6275f2c2a8189e7dd40153a22665b04cd77baf16;hp=2b9db010f8603aa2a06eadb50d66b66cbdee6032;hb=HEAD;hpb=87320f49ac09708de2c8903aaba30ef88b9d373a diff --git a/GroupRights.php b/GroupRights.php index 2b9db01..0dbd455 100644 --- a/GroupRights.php +++ b/GroupRights.php @@ -12,7 +12,7 @@ class Pman_Admin_GroupRights extends Pman parent::getAuth(); // load company! $au = $this->getAuthUser(); if (!$au) { - $this->jerr("Not authenticated", array('authFailure' => true)); + $this->jerror("LOGIN-NOAUTH", "Not authenticated", array('authFailure' => true)); } if ($au->company()->comptype !='OWNER') { @@ -34,10 +34,11 @@ class Pman_Admin_GroupRights extends Pman if (!isset($_GET['group_id']) || (int)$_GET['group_id'] < 0) { $this->jerr("NO GROUP"); } - if (!$this->hasPerm( 'Core.Groups','S')) { // listing groups.. + + if (!$this->checkPerm('E')) { // editing groups.. $this->jerr("PERMISSION DENIED"); } - print_R('run??');exit; + $g = DB_DataObject::Factory('core_group'); if (!$g->get($_GET['group_id'])) { $this->jerr("group is invalid"); @@ -74,17 +75,28 @@ class Pman_Admin_GroupRights extends Pman $cur[$k] = clone($gr); } - + $short = explode('.',$k); $ar[] = array( 'id' => $cur[$k]->id * 1, // 'rightname' => $k, 'descript' => isset($defdata[2]) ? $defdata[2] : '' , 'accessmask' => $cur[$k]->accessmask, 'FullMask' => $defdata[0], - 'group_id' => (int)$_GET['group_id'] + 'group_id' => (int)$_GET['group_id'], + 'shortname' => $short[0] ); } + + if (isset($_GET['_sort'])) { + foreach ($ar as $key => $row) { + $shortname[$key] = $row['shortname']; + $descript[$key] = $row['descript']; + } + + array_multisort($shortname, SORT_ASC, $descript, SORT_ASC, $ar); + } + $this->jdata($ar); @@ -97,14 +109,11 @@ class Pman_Admin_GroupRights extends Pman if (!isset($_POST['group_id']) || (int)$_POST['group_id'] < 0) { $this->jerr("NO GROUP"); } - if (!$this->hasPerm( 'Core.Groups','E')) { // editing groups.. + + if (!$this->checkPerm('E')) { // editing groups.. $this->jerr("PERMISSION DENIED"); } - - - - // add or update.. if (!empty($_POST['dataUpdate'])) { foreach($_POST['dataUpdate'] as $id => $ac) { @@ -136,9 +145,10 @@ class Pman_Admin_GroupRights extends Pman } - - - + function checkPerm($lvl) + { + return $this->hasPerm('Core.Groups', $lvl); + } } \ No newline at end of file