예제 #1
0
 /**
  * Send repositories access for given role as XML
  *
  * @param AjxpRole $role
  * @return string
  */
 static function writeRoleRepositoriesData($role)
 {
     $st = "<repositories>";
     foreach (ConfService::getRepositoriesList() as $repoId => $repoObject) {
         $toLast = false;
         if ($repoObject->getAccessType() == "ajxp_conf") {
             continue;
         }
         if ($repoObject->getAccessType() == "ajxp_shared" && !AuthService::usersEnabled()) {
             continue;
         }
         $rightString = " r=\"" . ($role->canRead($repoId) ? "1" : "0") . "\" w=\"" . ($role->canWrite($repoId) ? "1" : "0") . "\"";
         $string = "<repo access_type=\"" . $repoObject->accessType . "\" id=\"" . $repoId . "\"{$rightString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($repoObject->getDisplay())) . "</label></repo>";
         if ($toLast) {
             $lastString = $string;
         } else {
             $st .= $string;
         }
     }
     if (isset($lastString)) {
         $st .= $lastString;
     }
     $st .= "</repositories>";
     $st .= "<actions_rights>";
     foreach ($role->getSpecificActionsRights("ajxp.all") as $actionId => $actionValue) {
         $st .= "<action name=\"{$actionId}\" value=\"" . ($actionValue ? "true" : "false") . "\"/>";
     }
     $st .= "</actions_rights>";
     return $st;
 }