protected function parseUsers(SimpleXMLElement $root) { $users = array(); foreach ($root->Users->User as $user) { $fzUser = FzUserGroup::fromXml($user); $users[$fzUser->name] = $fzUser; } $this->fzAdmin->setUsers($users); }
protected function writeUserGroup(SimpleXMLElement $xml, FzUserGroup $group) { $g = $xml->addChild('Group'); $g->addAttribute('Name', $group->getName()); foreach ($group->getOptions() as $name => $value) { $o = $g->addChild('Option', $value); $o->addAttribute('Name', $name); } $if = $g->addChild('IpFilter'); $if->addChild('Disallowed', $group->getIpDisallowed()); $if->addChild('Allowed', $group->getIpAllowed()); $perms = $g->addChild('Permissions'); foreach ($group->getPermissions() as $permDir => $groupPerms) { $perm = $perms->addChild('Permission'); $perm->addAttribute('Dir', $permDir); foreach ($groupPerms as $name => $value) { $o = $perm->addChild('Option', $value); $o->addAttribute('Name', $name); } } $this->writeSpeedLimits($g, $group->getSpeedLimits()); }
public function addGroup(FzUserGroup $g) { $this->groups[$g->getName()] = $g; }