some style fixes (mvc)

This commit is contained in:
Ad Schellevis 2015-04-29 21:56:17 +02:00
parent d84b293b6a
commit 40b6e7a95f
3 changed files with 31 additions and 18 deletions

View File

@ -36,10 +36,10 @@ use \Phalcon\Validation\Message;
class IntegerValidator extends Validator implements ValidatorInterface
{
/**
/**
* Executes Integer validation
*
* @param Phalcon\Validation $validator
* @param \Phalcon\Validation $validator
* @param string $attribute
* @return boolean
*/

View File

@ -35,14 +35,14 @@ use \Phalcon\Validation\Message;
class MinMaxValidator extends Validator implements ValidatorInterface
{
/**
* Executes MinMax validation
*
* @param Phalcon\Validation $validator
* @param string $attribute
* @return boolean
*/
public function validate(\Phalcon\Validation $validator, $attribute)
/**
* Executes MinMax validation
*
* @param \Phalcon\Validation $validator
* @param string $attribute
* @return boolean
*/
public function validate(\Phalcon\Validation $validator, $attribute)
{
$value = $validator->getValue($attribute);

View File

@ -89,7 +89,7 @@ class ACL
$this->legacyUsers[$node->name->__toString()]["priv"][] = $legacyPageMap[$priv->__toString()] ;
}
}
}
}
} elseif ($key == "group") {
$groupmap[$node->name->__toString()] = $node ;
}
@ -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.
* @param $username user name
@ -126,21 +143,17 @@ class ACL
// search user privs
foreach ($this->legacyUsers[$username]["priv"] as $privset) {
foreach ($privset as $urlmask) {
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $urlmask);
$result = preg_match("@^/{$match}$@", "{$url}");
if ($result) {
if ($this->urlMatch($url, $urlmask)) {
return true;
}
}
}
}
// search groups
foreach ($this->legacyUsers[$username]["groups"] as $itemkey => $group) {
if (array_key_exists($group, $this->legacyGroupPrivs)) {
foreach ($this->legacyGroupPrivs[$group] as $privset) {
foreach ($privset as $urlmask) {
$match = str_replace(array(".", "*","?"), array("\.", ".*","\?"), $urlmask);
$result = preg_match("@^/{$match}$@", "{$url}");
if ($result) {
if ($this->urlMatch($url, $urlmask)) {
return true;
}
}