160 $acl->addReferrer(self::READ,
'*');
161 $acl->allowListings();
188 return self::makeNonPublic();
208 if (!empty($headers[self::HEADER_READ])) {
209 $read = $headers[self::HEADER_READ];
210 $rules = explode(
',', $read);
211 foreach (
$rules as $rule) {
212 $ruleArray = self::parseRule(self::READ, $rule);
213 if (!empty($ruleArray)) {
214 $acl->rules[] = $ruleArray;
221 if (!empty($headers[self::HEADER_WRITE])) {
222 $write = $headers[self::HEADER_WRITE];
223 $rules = explode(
',', $write);
224 foreach (
$rules as $rule) {
225 $ruleArray = self::parseRule(self::WRITE, $rule);
226 if (!empty($ruleArray)) {
227 $acl->rules[] = $ruleArray;
263 $exp =
'/^\s*(.r:([a-zA-Z0-9\*\-\.]+)|\.(rlistings)|([a-zA-Z0-9]+)(\:([a-zA-Z0-9]+))?)\s*$/';
266 preg_match($exp, $rule, $matches);
268 $entry = array(
'mask' => $perm);
269 if (!empty($matches[2])) {
270 $entry[
'host'] = $matches[2];
272 elseif (!empty($matches[3])) {
273 $entry[
'rlistings'] = TRUE;
275 elseif (!empty($matches[4])) {
276 $entry[
'account'] = $matches[4];
277 if (!empty($matches[6])) {
278 $entry[
'user'] = $matches[6];
332 $rule = array(
'account' =>
$account);
335 $rule[
'user'] = $user;
369 $this->
addRule($perm, array(
'host' => $host));
387 $rule[
'mask'] = $perm;
389 $this->
rules[] = $rule;
411 $this->
rules[] = array(
412 'mask' => self::READ,
443 foreach ($this->
rules as $rule) {
447 if (self::READ & $rule[
'mask']) {
449 if (!empty($ruleStr)) {
450 $readers[] = $ruleStr;
453 if (self::WRITE & $rule[
'mask']) {
455 if (!empty($ruleStr)) {
456 $writers[] = $ruleStr;
462 if (!empty($readers)) {
463 $headers[self::HEADER_READ] = implode(
',', $readers);
465 if (!empty($writers)) {
466 $headers[self::HEADER_WRITE] = implode(
',', $writers);
483 if (self::READ & $perm) {
486 if (!empty($rule[
'host'])) {
487 return '.r:' . $rule[
'host'];
491 if (!empty($rule[
'rlistings'])) {
497 if (!empty($rule[
'account'])) {
500 if (empty($rule[
'user'])) {
501 return $rule[
'account'];
505 elseif (is_array($rule[
'user'])) {
507 foreach ($rule[
'user'] as $user) {
508 $buffer[] = $rule[
'account'] .
':' . $user;
510 return implode(
',', $buffer);
516 return $rule[
'account'] .
':' . $rule[
'user'];
533 return empty($this->
rules);
555 $allowsAllHosts = FALSE;
556 $allowsRListings = FALSE;
557 foreach ($this->
rules as $rule) {
558 if (self::READ & $rule[
'mask']) {
559 if (!empty($rule[
'rlistings'])) {
560 $allowsRListings = TRUE;
562 elseif(!empty($rule[
'host']) && trim($rule[
'host']) ==
'*') {
563 $allowsAllHosts = TRUE;
567 return $allowsAllHosts && $allowsRListings;
584 foreach ($headers as $k => $v) {
585 $buffer[] = $k .
': ' . $v;
588 return implode(
"\t", $buffer);