@@ -29,40 +29,40 @@ |
||
29 | 29 | |
30 | 30 | class FedAuth extends AbstractBasic { |
31 | 31 | |
32 | - /** @var DbHandler */ |
|
33 | - private $db; |
|
32 | + /** @var DbHandler */ |
|
33 | + private $db; |
|
34 | 34 | |
35 | - /** |
|
36 | - * FedAuth constructor. |
|
37 | - * |
|
38 | - * @param DbHandler $db |
|
39 | - */ |
|
40 | - public function __construct(DbHandler $db) { |
|
41 | - $this->db = $db; |
|
42 | - $this->principalPrefix = 'principals/system/'; |
|
35 | + /** |
|
36 | + * FedAuth constructor. |
|
37 | + * |
|
38 | + * @param DbHandler $db |
|
39 | + */ |
|
40 | + public function __construct(DbHandler $db) { |
|
41 | + $this->db = $db; |
|
42 | + $this->principalPrefix = 'principals/system/'; |
|
43 | 43 | |
44 | - // setup realm |
|
45 | - $defaults = new \OCP\Defaults(); |
|
46 | - $this->realm = $defaults->getName(); |
|
47 | - } |
|
44 | + // setup realm |
|
45 | + $defaults = new \OCP\Defaults(); |
|
46 | + $this->realm = $defaults->getName(); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Validates a username and password |
|
51 | - * |
|
52 | - * This method should return true or false depending on if login |
|
53 | - * succeeded. |
|
54 | - * |
|
55 | - * @param string $username |
|
56 | - * @param string $password |
|
57 | - * @return bool |
|
58 | - */ |
|
59 | - protected function validateUserPass($username, $password) { |
|
60 | - return $this->db->auth($username, $password); |
|
61 | - } |
|
49 | + /** |
|
50 | + * Validates a username and password |
|
51 | + * |
|
52 | + * This method should return true or false depending on if login |
|
53 | + * succeeded. |
|
54 | + * |
|
55 | + * @param string $username |
|
56 | + * @param string $password |
|
57 | + * @return bool |
|
58 | + */ |
|
59 | + protected function validateUserPass($username, $password) { |
|
60 | + return $this->db->auth($username, $password); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @inheritdoc |
|
65 | - */ |
|
66 | - public function challenge(RequestInterface $request, ResponseInterface $response) { |
|
67 | - } |
|
63 | + /** |
|
64 | + * @inheritdoc |
|
65 | + */ |
|
66 | + public function challenge(RequestInterface $request, ResponseInterface $response) { |
|
67 | + } |
|
68 | 68 | } |
@@ -29,59 +29,59 @@ |
||
29 | 29 | namespace OC\L10N; |
30 | 30 | |
31 | 31 | class L10NString implements \JsonSerializable { |
32 | - /** @var \OC\L10N\L10N */ |
|
33 | - protected $l10n; |
|
32 | + /** @var \OC\L10N\L10N */ |
|
33 | + protected $l10n; |
|
34 | 34 | |
35 | - /** @var string */ |
|
36 | - protected $text; |
|
35 | + /** @var string */ |
|
36 | + protected $text; |
|
37 | 37 | |
38 | - /** @var array */ |
|
39 | - protected $parameters; |
|
38 | + /** @var array */ |
|
39 | + protected $parameters; |
|
40 | 40 | |
41 | - /** @var integer */ |
|
42 | - protected $count; |
|
41 | + /** @var integer */ |
|
42 | + protected $count; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param \OC\L10N\L10N $l10n |
|
46 | - * @param string|string[] $text |
|
47 | - * @param array $parameters |
|
48 | - * @param int $count |
|
49 | - */ |
|
50 | - public function __construct(\OC\L10N\L10N $l10n, $text, $parameters, $count = 1) { |
|
51 | - $this->l10n = $l10n; |
|
52 | - $this->text = $text; |
|
53 | - $this->parameters = $parameters; |
|
54 | - $this->count = $count; |
|
55 | - } |
|
44 | + /** |
|
45 | + * @param \OC\L10N\L10N $l10n |
|
46 | + * @param string|string[] $text |
|
47 | + * @param array $parameters |
|
48 | + * @param int $count |
|
49 | + */ |
|
50 | + public function __construct(\OC\L10N\L10N $l10n, $text, $parameters, $count = 1) { |
|
51 | + $this->l10n = $l10n; |
|
52 | + $this->text = $text; |
|
53 | + $this->parameters = $parameters; |
|
54 | + $this->count = $count; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function __toString() { |
|
61 | - $translations = $this->l10n->getTranslations(); |
|
57 | + /** |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + public function __toString() { |
|
61 | + $translations = $this->l10n->getTranslations(); |
|
62 | 62 | |
63 | - $text = $this->text; |
|
64 | - if(array_key_exists($this->text, $translations)) { |
|
65 | - if(is_array($translations[$this->text])) { |
|
66 | - $fn = $this->l10n->getPluralFormFunction(); |
|
67 | - $id = $fn($this->count); |
|
68 | - $text = $translations[$this->text][$id]; |
|
69 | - } |
|
70 | - else{ |
|
71 | - $text = $translations[$this->text]; |
|
72 | - } |
|
73 | - } |
|
63 | + $text = $this->text; |
|
64 | + if(array_key_exists($this->text, $translations)) { |
|
65 | + if(is_array($translations[$this->text])) { |
|
66 | + $fn = $this->l10n->getPluralFormFunction(); |
|
67 | + $id = $fn($this->count); |
|
68 | + $text = $translations[$this->text][$id]; |
|
69 | + } |
|
70 | + else{ |
|
71 | + $text = $translations[$this->text]; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | |
75 | - // Replace %n first (won't interfere with vsprintf) |
|
76 | - $text = str_replace('%n', (string)$this->count, $text); |
|
77 | - return vsprintf($text, $this->parameters); |
|
78 | - } |
|
75 | + // Replace %n first (won't interfere with vsprintf) |
|
76 | + $text = str_replace('%n', (string)$this->count, $text); |
|
77 | + return vsprintf($text, $this->parameters); |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - /** |
|
82 | - * @return string |
|
83 | - */ |
|
84 | - public function jsonSerialize() { |
|
85 | - return $this->__toString(); |
|
86 | - } |
|
81 | + /** |
|
82 | + * @return string |
|
83 | + */ |
|
84 | + public function jsonSerialize() { |
|
85 | + return $this->__toString(); |
|
86 | + } |
|
87 | 87 | } |
@@ -24,58 +24,58 @@ |
||
24 | 24 | use OCP\IL10N; |
25 | 25 | |
26 | 26 | class BundleFetcher { |
27 | - /** @var IL10N */ |
|
28 | - private $l10n; |
|
27 | + /** @var IL10N */ |
|
28 | + private $l10n; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @param IL10N $l10n |
|
32 | - */ |
|
33 | - public function __construct(IL10N $l10n) { |
|
34 | - $this->l10n = $l10n; |
|
35 | - } |
|
30 | + /** |
|
31 | + * @param IL10N $l10n |
|
32 | + */ |
|
33 | + public function __construct(IL10N $l10n) { |
|
34 | + $this->l10n = $l10n; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @return Bundle[] |
|
39 | - */ |
|
40 | - public function getBundles() { |
|
41 | - return [ |
|
42 | - new EnterpriseBundle($this->l10n), |
|
43 | - new GroupwareBundle($this->l10n), |
|
44 | - new SocialSharingBundle($this->l10n), |
|
45 | - new EducationBundle($this->l10n), |
|
46 | - ]; |
|
47 | - } |
|
37 | + /** |
|
38 | + * @return Bundle[] |
|
39 | + */ |
|
40 | + public function getBundles() { |
|
41 | + return [ |
|
42 | + new EnterpriseBundle($this->l10n), |
|
43 | + new GroupwareBundle($this->l10n), |
|
44 | + new SocialSharingBundle($this->l10n), |
|
45 | + new EducationBundle($this->l10n), |
|
46 | + ]; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Bundles that should be installed by default after installation |
|
51 | - * |
|
52 | - * @return Bundle[] |
|
53 | - */ |
|
54 | - public function getDefaultInstallationBundle() { |
|
55 | - return [ |
|
56 | - new CoreBundle($this->l10n), |
|
57 | - ]; |
|
58 | - } |
|
49 | + /** |
|
50 | + * Bundles that should be installed by default after installation |
|
51 | + * |
|
52 | + * @return Bundle[] |
|
53 | + */ |
|
54 | + public function getDefaultInstallationBundle() { |
|
55 | + return [ |
|
56 | + new CoreBundle($this->l10n), |
|
57 | + ]; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Get the bundle with the specified identifier |
|
62 | - * |
|
63 | - * @param string $identifier |
|
64 | - * @return Bundle |
|
65 | - * @throws \BadMethodCallException If the bundle does not exist |
|
66 | - */ |
|
67 | - public function getBundleByIdentifier($identifier) { |
|
68 | - /** @var Bundle[] $bundles */ |
|
69 | - $bundles = array_merge( |
|
70 | - $this->getBundles(), |
|
71 | - $this->getDefaultInstallationBundle() |
|
72 | - ); |
|
73 | - foreach($bundles as $bundle) { |
|
74 | - if($bundle->getIdentifier() === $identifier) { |
|
75 | - return $bundle; |
|
76 | - } |
|
77 | - } |
|
60 | + /** |
|
61 | + * Get the bundle with the specified identifier |
|
62 | + * |
|
63 | + * @param string $identifier |
|
64 | + * @return Bundle |
|
65 | + * @throws \BadMethodCallException If the bundle does not exist |
|
66 | + */ |
|
67 | + public function getBundleByIdentifier($identifier) { |
|
68 | + /** @var Bundle[] $bundles */ |
|
69 | + $bundles = array_merge( |
|
70 | + $this->getBundles(), |
|
71 | + $this->getDefaultInstallationBundle() |
|
72 | + ); |
|
73 | + foreach($bundles as $bundle) { |
|
74 | + if($bundle->getIdentifier() === $identifier) { |
|
75 | + return $bundle; |
|
76 | + } |
|
77 | + } |
|
78 | 78 | |
79 | - throw new \BadMethodCallException('Bundle with specified identifier does not exist'); |
|
80 | - } |
|
79 | + throw new \BadMethodCallException('Bundle with specified identifier does not exist'); |
|
80 | + } |
|
81 | 81 | } |
@@ -23,28 +23,28 @@ |
||
23 | 23 | |
24 | 24 | class EducationBundle extends Bundle { |
25 | 25 | |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getName() { |
|
30 | - return (string)$this->l10n->t('Education Edition'); |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getName() { |
|
30 | + return (string)$this->l10n->t('Education Edition'); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * {@inheritDoc} |
|
35 | - */ |
|
36 | - public function getAppIdentifiers() { |
|
37 | - return [ |
|
38 | - 'zenodo', |
|
39 | - 'dashboard', |
|
40 | - 'circles', |
|
41 | - 'groupfolders', |
|
42 | - 'announcementcenter', |
|
43 | - 'admin_notifications', |
|
44 | - 'quota_warning', |
|
45 | - 'orcid', |
|
46 | - 'user_saml', |
|
47 | - ]; |
|
48 | - } |
|
33 | + /** |
|
34 | + * {@inheritDoc} |
|
35 | + */ |
|
36 | + public function getAppIdentifiers() { |
|
37 | + return [ |
|
38 | + 'zenodo', |
|
39 | + 'dashboard', |
|
40 | + 'circles', |
|
41 | + 'groupfolders', |
|
42 | + 'announcementcenter', |
|
43 | + 'admin_notifications', |
|
44 | + 'quota_warning', |
|
45 | + 'orcid', |
|
46 | + 'user_saml', |
|
47 | + ]; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | // @codeCoverageIgnoreStart |
3 | 3 | if(!isset($_)) {//standalone page is not supported anymore - redirect to / |
4 | - require_once '../../lib/base.php'; |
|
4 | + require_once '../../lib/base.php'; |
|
5 | 5 | |
6 | - $urlGenerator = \OC::$server->getURLGenerator(); |
|
7 | - header('Location: ' . $urlGenerator->getAbsoluteURL('/')); |
|
8 | - exit; |
|
6 | + $urlGenerator = \OC::$server->getURLGenerator(); |
|
7 | + header('Location: ' . $urlGenerator->getAbsoluteURL('/')); |
|
8 | + exit; |
|
9 | 9 | } |
10 | 10 | // @codeCoverageIgnoreEnd |
11 | 11 | ?> |
@@ -4,11 +4,11 @@ |
||
4 | 4 | /** @var $theme OCP\Defaults */ |
5 | 5 | // @codeCoverageIgnoreStart |
6 | 6 | if(!isset($_)) {//standalone page is not supported anymore - redirect to / |
7 | - require_once '../../lib/base.php'; |
|
7 | + require_once '../../lib/base.php'; |
|
8 | 8 | |
9 | - $urlGenerator = \OC::$server->getURLGenerator(); |
|
10 | - header('Location: ' . $urlGenerator->getAbsoluteURL('/')); |
|
11 | - exit; |
|
9 | + $urlGenerator = \OC::$server->getURLGenerator(); |
|
10 | + header('Location: ' . $urlGenerator->getAbsoluteURL('/')); |
|
11 | + exit; |
|
12 | 12 | } |
13 | 13 | // @codeCoverageIgnoreEnd |
14 | 14 | ?> |
@@ -35,49 +35,49 @@ |
||
35 | 35 | * @package OC\AppFramework\Middleware\Security |
36 | 36 | */ |
37 | 37 | class BruteForceMiddleware extends Middleware { |
38 | - /** @var ControllerMethodReflector */ |
|
39 | - private $reflector; |
|
40 | - /** @var Throttler */ |
|
41 | - private $throttler; |
|
42 | - /** @var IRequest */ |
|
43 | - private $request; |
|
38 | + /** @var ControllerMethodReflector */ |
|
39 | + private $reflector; |
|
40 | + /** @var Throttler */ |
|
41 | + private $throttler; |
|
42 | + /** @var IRequest */ |
|
43 | + private $request; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param ControllerMethodReflector $controllerMethodReflector |
|
47 | - * @param Throttler $throttler |
|
48 | - * @param IRequest $request |
|
49 | - */ |
|
50 | - public function __construct(ControllerMethodReflector $controllerMethodReflector, |
|
51 | - Throttler $throttler, |
|
52 | - IRequest $request) { |
|
53 | - $this->reflector = $controllerMethodReflector; |
|
54 | - $this->throttler = $throttler; |
|
55 | - $this->request = $request; |
|
56 | - } |
|
45 | + /** |
|
46 | + * @param ControllerMethodReflector $controllerMethodReflector |
|
47 | + * @param Throttler $throttler |
|
48 | + * @param IRequest $request |
|
49 | + */ |
|
50 | + public function __construct(ControllerMethodReflector $controllerMethodReflector, |
|
51 | + Throttler $throttler, |
|
52 | + IRequest $request) { |
|
53 | + $this->reflector = $controllerMethodReflector; |
|
54 | + $this->throttler = $throttler; |
|
55 | + $this->request = $request; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * {@inheritDoc} |
|
60 | - */ |
|
61 | - public function beforeController($controller, $methodName) { |
|
62 | - parent::beforeController($controller, $methodName); |
|
58 | + /** |
|
59 | + * {@inheritDoc} |
|
60 | + */ |
|
61 | + public function beforeController($controller, $methodName) { |
|
62 | + parent::beforeController($controller, $methodName); |
|
63 | 63 | |
64 | - if($this->reflector->hasAnnotation('BruteForceProtection')) { |
|
65 | - $action = $this->reflector->getAnnotationParameter('BruteForceProtection', 'action'); |
|
66 | - $this->throttler->sleepDelay($this->request->getRemoteAddress(), $action); |
|
67 | - } |
|
68 | - } |
|
64 | + if($this->reflector->hasAnnotation('BruteForceProtection')) { |
|
65 | + $action = $this->reflector->getAnnotationParameter('BruteForceProtection', 'action'); |
|
66 | + $this->throttler->sleepDelay($this->request->getRemoteAddress(), $action); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * {@inheritDoc} |
|
72 | - */ |
|
73 | - public function afterController($controller, $methodName, Response $response) { |
|
74 | - if($this->reflector->hasAnnotation('BruteForceProtection') && $response->isThrottled()) { |
|
75 | - $action = $this->reflector->getAnnotationParameter('BruteForceProtection', 'action'); |
|
76 | - $ip = $this->request->getRemoteAddress(); |
|
77 | - $this->throttler->sleepDelay($ip, $action); |
|
78 | - $this->throttler->registerAttempt($action, $ip, $response->getThrottleMetadata()); |
|
79 | - } |
|
70 | + /** |
|
71 | + * {@inheritDoc} |
|
72 | + */ |
|
73 | + public function afterController($controller, $methodName, Response $response) { |
|
74 | + if($this->reflector->hasAnnotation('BruteForceProtection') && $response->isThrottled()) { |
|
75 | + $action = $this->reflector->getAnnotationParameter('BruteForceProtection', 'action'); |
|
76 | + $ip = $this->request->getRemoteAddress(); |
|
77 | + $this->throttler->sleepDelay($ip, $action); |
|
78 | + $this->throttler->registerAttempt($action, $ip, $response->getThrottleMetadata()); |
|
79 | + } |
|
80 | 80 | |
81 | - return parent::afterController($controller, $methodName, $response); |
|
82 | - } |
|
81 | + return parent::afterController($controller, $methodName, $response); |
|
82 | + } |
|
83 | 83 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | use OC\DB\QueryBuilder\QueryFunction; |
25 | 25 | |
26 | 26 | class PgSqlFunctionBuilder extends FunctionBuilder { |
27 | - public function concat($x, $y) { |
|
28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | - } |
|
27 | + public function concat($x, $y) { |
|
28 | + return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | + } |
|
30 | 30 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | use OC\DB\QueryBuilder\QueryFunction; |
25 | 25 | |
26 | 26 | class SqliteFunctionBuilder extends FunctionBuilder { |
27 | - public function concat($x, $y) { |
|
28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | - } |
|
27 | + public function concat($x, $y) { |
|
28 | + return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | + } |
|
30 | 30 | } |