diff --git a/module/VuFind/src/VuFind/Controller/AbstractBase.php b/module/VuFind/src/VuFind/Controller/AbstractBase.php index 2b163bfd200c48099f87e82ab5e921eeaa8fdafe..a8ca2e452df9bd72f1de480dab182b7455e721da 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractBase.php +++ b/module/VuFind/src/VuFind/Controller/AbstractBase.php @@ -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 + ); } } diff --git a/module/VuFind/src/VuFind/Role/DynamicRoleProvider.php b/module/VuFind/src/VuFind/Role/DynamicRoleProvider.php index c7ad23371b04e1a5ac340e049179343577616667..727e469d962c319c7390ac30129e812e4594955f 100644 --- a/module/VuFind/src/VuFind/Role/DynamicRoleProvider.php +++ b/module/VuFind/src/VuFind/Role/DynamicRoleProvider.php @@ -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[] */ diff --git a/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php b/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php index 623880becc0e9f97256b798b919c6cd7ce9442f8..6919369692e981aeece18dbdc7032fc7f8c103be 100644 --- a/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php +++ b/module/VuFind/src/VuFind/Role/DynamicRoleProviderFactory.php @@ -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 */ diff --git a/module/VuFind/src/VuFind/Role/PermissionProvider/IpRange.php b/module/VuFind/src/VuFind/Role/PermissionProvider/IpRange.php index e4d081959b7c78ac0c1afaa6ac71ae24c9dfceab..d27f05497da1b0704285d38d7dd9dd840e5ef03e 100644 --- a/module/VuFind/src/VuFind/Role/PermissionProvider/IpRange.php +++ b/module/VuFind/src/VuFind/Role/PermissionProvider/IpRange.php @@ -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 diff --git a/module/VuFind/src/VuFind/Role/PermissionProvider/IpRegEx.php b/module/VuFind/src/VuFind/Role/PermissionProvider/IpRegEx.php index a99c02fdaf8b1890c04ae84e9a175bb77d0ee819..b9e22f4e86e17bb3195e540117b9cb94d52d989a 100644 --- a/module/VuFind/src/VuFind/Role/PermissionProvider/IpRegEx.php +++ b/module/VuFind/src/VuFind/Role/PermissionProvider/IpRegEx.php @@ -49,7 +49,7 @@ class IpRegEx implements PermissionProviderInterface /** * Constructor * - * @param Request $request Request object + * @param Request $request Request object */ public function __construct(Request $request) {