Skip to content
Snippets Groups Projects
Commit 9c14d90a authored by Demian Katz's avatar Demian Katz
Browse files

Style fixes.

parent 7e5daeb3
No related merge requests found
......@@ -91,7 +91,9 @@ class AbstractBase extends AbstractActionController
// Attach preDispatch event if we need to check permissions.
if ($this->accessPermission) {
$events = $this->getEventManager();
$events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 1000);
$events->attach(
MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 1000
);
}
}
......
......@@ -78,7 +78,7 @@ class DynamicRoleProvider implements RoleProviderInterface
/**
* Get the roles from the provider
*
* @param string[] $roleNames Role(s) to look up.
* @param string[] $roleNames Role(s) to look up.
*
* @return \Rbac\Role\RoleInterface[]
*/
......
......@@ -62,7 +62,7 @@ class DynamicRoleProviderFactory implements FactoryInterface
* Create the supporting plugin manager.
*
* @param ServiceLocatorInterface $serviceLocator Service locator
* @param array $rbacConfig ZfcRbac configuration
* @param array $rbacConfig ZfcRbac configuration
*
* @return PermissionProviderPluginManager
*/
......@@ -80,7 +80,7 @@ class DynamicRoleProviderFactory implements FactoryInterface
* Get a configuration array.
*
* @param ServiceLocatorInterface $serviceLocator Service locator
* @param array $rbacConfig ZfcRbac configuration
* @param array $rbacConfig ZfcRbac configuration
*
* @return array
*/
......
......@@ -51,7 +51,7 @@ class IpRange implements PermissionProviderInterface
/**
* Constructor
*
* @param Request $request Request object
* @param Request $request Request object
*/
public function __construct(Request $request)
{
......@@ -70,7 +70,7 @@ class IpRange implements PermissionProviderInterface
{
// Check if any regex matches....
$ip = $this->request->getServer()->get('REMOTE_ADDR');
if (checkIP($ip, $options)) {
if ($this->checkIP($ip, $options)) {
// Match? Grant to all users (guest or logged in).
return ['guest', 'loggedin'];
}
......@@ -79,35 +79,38 @@ class IpRange implements PermissionProviderInterface
return [];
}
/**
* Return true or false
*
* @param ip adress $remoteIP ip adress of the user
* @param array $rangeIP ip and ranges of adresses
*
* @return boolean
*/
// ToDo: Implementin IPv6 check
private function checkIP($remoteIP, $rangeIP) {
/**
* Check if $remoteIP is within $rangeIP
*
* @param string $remoteIP ip address of the user
* @param array $rangeIP single ip or range of addresses
*
* @return bool
* @todo Implement IPv6 check
*/
protected function checkIP($remoteIP, $rangeIP)
{
$mylist = array();
$count = 0;
$inList = false;
foreach ((array)$rangeIP as $range) {
if (preg_match('/-/',$range)) {
$tmp=preg_split('/-/',$range);
$mylist[$count]["start"]=$tmp[0];
$mylist[$count]["end"]=$tmp[1];
$mylist[$count]['start']=$tmp[0];
$mylist[$count]['end']=$tmp[1];
} else {
$mylist[$count]["start"]=$range;
$mylist[$count]["end"]=$range;
$mylist[$count]['start']=$range;
$mylist[$count]['end']=$range;
}
$count++;
}
foreach ($mylist as $check) {
if (ip2long($remoteIP) >= ip2long($check["start"]) && ip2long($remoteIP) <= ip2long($check["end"])) {
if (ip2long($remoteIP) >= ip2long($check['start'])
&& ip2long($remoteIP) <= ip2long($check['end'])
) {
$inList=true;
}
}
return $inList;
}
}
}
\ No newline at end of file
......@@ -49,7 +49,7 @@ class IpRegEx implements PermissionProviderInterface
/**
* Constructor
*
* @param Request $request Request object
* @param Request $request Request object
*/
public function __construct(Request $request)
{
......
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