Commit 40b6e7a9 authored by Ad Schellevis's avatar Ad Schellevis

some style fixes (mvc)

parent d84b293b
...@@ -36,10 +36,10 @@ use \Phalcon\Validation\Message; ...@@ -36,10 +36,10 @@ use \Phalcon\Validation\Message;
class IntegerValidator extends Validator implements ValidatorInterface class IntegerValidator extends Validator implements ValidatorInterface
{ {
/** /**
* Executes Integer validation * Executes Integer validation
* *
* @param Phalcon\Validation $validator * @param \Phalcon\Validation $validator
* @param string $attribute * @param string $attribute
* @return boolean * @return boolean
*/ */
......
...@@ -35,14 +35,14 @@ use \Phalcon\Validation\Message; ...@@ -35,14 +35,14 @@ use \Phalcon\Validation\Message;
class MinMaxValidator extends Validator implements ValidatorInterface class MinMaxValidator extends Validator implements ValidatorInterface
{ {
/** /**
* Executes MinMax validation * Executes MinMax validation
* *
* @param Phalcon\Validation $validator * @param \Phalcon\Validation $validator
* @param string $attribute * @param string $attribute
* @return boolean * @return boolean
*/ */
public function validate(\Phalcon\Validation $validator, $attribute) public function validate(\Phalcon\Validation $validator, $attribute)
{ {
$value = $validator->getValue($attribute); $value = $validator->getValue($attribute);
......
...@@ -89,7 +89,7 @@ class ACL ...@@ -89,7 +89,7 @@ class ACL
$this->legacyUsers[$node->name->__toString()]["priv"][] = $legacyPageMap[$priv->__toString()] ; $this->legacyUsers[$node->name->__toString()]["priv"][] = $legacyPageMap[$priv->__toString()] ;
} }
} }
} }
} elseif ($key == "group") { } elseif ($key == "group") {
$groupmap[$node->name->__toString()] = $node ; $groupmap[$node->name->__toString()] = $node ;
} }
...@@ -114,6 +114,23 @@ class ACL ...@@ -114,6 +114,23 @@ class ACL
} }
} }
/**
* check url against regex mask
* @param $url url to match
* @param $urlmask regex mask
* @return bool url matches mask
*/
private function urlMatch($url, $urlmask)
{
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $urlmask);
$result = preg_match("@^/{$match}$@", "{$url}");
if ($result) {
return true;
} else {
return false;
}
}
/** /**
* legacy functionality to check if a page is accessible for the specified user. * legacy functionality to check if a page is accessible for the specified user.
* @param $username user name * @param $username user name
...@@ -126,21 +143,17 @@ class ACL ...@@ -126,21 +143,17 @@ class ACL
// search user privs // search user privs
foreach ($this->legacyUsers[$username]["priv"] as $privset) { foreach ($this->legacyUsers[$username]["priv"] as $privset) {
foreach ($privset as $urlmask) { foreach ($privset as $urlmask) {
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $urlmask); if ($this->urlMatch($url, $urlmask)) {
$result = preg_match("@^/{$match}$@", "{$url}");
if ($result) {
return true; return true;
} }
} }
} }
// search groups // search groups
foreach ($this->legacyUsers[$username]["groups"] as $itemkey => $group) { foreach ($this->legacyUsers[$username]["groups"] as $itemkey => $group) {
if (array_key_exists($group, $this->legacyGroupPrivs)) { if (array_key_exists($group, $this->legacyGroupPrivs)) {
foreach ($this->legacyGroupPrivs[$group] as $privset) { foreach ($this->legacyGroupPrivs[$group] as $privset) {
foreach ($privset as $urlmask) { foreach ($privset as $urlmask) {
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $urlmask); if ($this->urlMatch($url, $urlmask)) {
$result = preg_match("@^/{$match}$@", "{$url}");
if ($result) {
return true; return true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment