mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 09:34:39 +00:00
some style fixes (mvc)
This commit is contained in:
parent
d84b293b6a
commit
40b6e7a95f
@ -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
|
||||
*/
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user