コード例 #1
0
ファイル: ariadne_object.php プロジェクト: poef/ariadne
 public function sgBegin($grants, $key = '', $path = '.')
 {
     global $AR;
     $result = false;
     $context = $this->getContext();
     $path = $this->make_path($path);
     // serialize the grants so the order does not matter, mod_grant takes care of the sorting for us
     $this->_load("mod_grant.php");
     $mg = new mod_grant();
     $grantsarray = array();
     $mg->compile($grants, $grantsarray);
     if ($context['scope'] == 'pinp') {
         $checkgrants = serialize($grantsarray);
         $check = $AR->sgSalt ? sha1($AR->sgSalt . $checkgrants . $path) : false;
         // not using suKey because that checks for config grant
     } else {
         $check = true;
         $key = true;
     }
     if ($check !== false && $check === $key) {
         $AR->user->grants = array();
         // unset all grants for the current user, this makes sure GetValidGrants gets called again for this path and all childs
         $grantsarray = (array) $AR->sgGrants[$path];
         $mg->compile($grants, $grantsarray);
         $AR->sgGrants[$path] = $grantsarray;
         $result = true;
     }
     return $result;
 }
コード例 #2
0
ファイル: dialog.grants.users.php プロジェクト: poef/ariadne
 $info['grants'] = arrayMergeCorrect($info['grants'], $stored_formdata['grants']);
 $info['grants'] = arrayMergeCorrect($info['grants'], $formdata['grants']);
 //			$info['grants'] = array_merge($info['grants'], $stored_formdata['grants'], $formdata['grants']);
 //			echo "<pre>";
 //			print_r($info['grants']);
 if (isset($textswitch) && $textswitch == 1) {
     $grants = (array) $formdata['grants']['array'];
     foreach ($grants as $key => $val) {
         if ($val == 8) {
             $grants[$key] = $formdata['grants']['bytype'][$key];
         }
     }
     $info['grants']['grantsstring'] = grantsArrayToString($grants);
 } else {
     if (isset($textswitch) && $textswitch == 0) {
         $g_comp = new mod_grant();
         $newgrants = array();
         //				print_r($info['grants']);
         $g_comp->compile($formdata['grants']['grantsstring'], $newgrants);
         $grants_by_type = array();
         foreach ($newgrants as $grantname => $grantvalue) {
             if (!isset($available_grants[$grantname])) {
                 $available_grants[$grantname] = yui::labelspan($grantname, 8);
             }
             if (is_array($grantvalue)) {
                 $grants_by_type[$grantname] = $grantvalue;
                 $newgrants[$grantname] = ARGRANTBYTYPE;
             }
         }
         $formdata['grants']['array'] = $newgrant;
         $formdata['grants']['bytype'] = $grants_by_type;