@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $files_list = json_decode($files); |
38 | 38 | // in case we get only a single file |
39 | 39 | if (!is_array($files_list)) { |
40 | - $files_list = array($files); |
|
40 | + $files_list = array($files); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * alphanumeric characters |
47 | 47 | */ |
48 | 48 | if(isset($_GET['downloadStartSecret']) |
49 | - && !isset($_GET['downloadStartSecret'][32]) |
|
50 | - && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) { |
|
51 | - setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); |
|
49 | + && !isset($_GET['downloadStartSecret'][32]) |
|
50 | + && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) { |
|
51 | + setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $server_params = array( 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * Http range requests support |
58 | 58 | */ |
59 | 59 | if (isset($_SERVER['HTTP_RANGE'])) { |
60 | - $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
60 | + $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | OC_Files::get($dir, $files_list, $server_params); |
@@ -36,62 +36,62 @@ |
||
36 | 36 | */ |
37 | 37 | class SetPasswordColumn implements IRepairStep { |
38 | 38 | |
39 | - /** @var IDBConnection */ |
|
40 | - private $connection; |
|
41 | - |
|
42 | - /** @var IConfig */ |
|
43 | - private $config; |
|
44 | - |
|
45 | - |
|
46 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | - $this->connection = $connection; |
|
48 | - $this->config = $config; |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * Returns the step's name |
|
53 | - * |
|
54 | - * @return string |
|
55 | - * @since 9.1.0 |
|
56 | - */ |
|
57 | - public function getName() { |
|
58 | - return 'Copy the share password into the dedicated column'; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * @param IOutput $output |
|
63 | - */ |
|
64 | - public function run(IOutput $output) { |
|
65 | - if (!$this->shouldRun()) { |
|
66 | - return; |
|
67 | - } |
|
68 | - |
|
69 | - $query = $this->connection->getQueryBuilder(); |
|
70 | - $query |
|
71 | - ->update('share') |
|
72 | - ->set('password', 'share_with') |
|
73 | - ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK))) |
|
74 | - ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | - $result = $query->execute(); |
|
76 | - |
|
77 | - if ($result === 0) { |
|
78 | - // No link updated, no need to run the second query |
|
79 | - return; |
|
80 | - } |
|
81 | - |
|
82 | - $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | - $clearQuery |
|
84 | - ->update('share') |
|
85 | - ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | - ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK))); |
|
87 | - |
|
88 | - $clearQuery->execute(); |
|
89 | - |
|
90 | - } |
|
91 | - |
|
92 | - protected function shouldRun() { |
|
93 | - $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
94 | - return version_compare($appVersion, '1.4.0', '<'); |
|
95 | - } |
|
39 | + /** @var IDBConnection */ |
|
40 | + private $connection; |
|
41 | + |
|
42 | + /** @var IConfig */ |
|
43 | + private $config; |
|
44 | + |
|
45 | + |
|
46 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | + $this->connection = $connection; |
|
48 | + $this->config = $config; |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * Returns the step's name |
|
53 | + * |
|
54 | + * @return string |
|
55 | + * @since 9.1.0 |
|
56 | + */ |
|
57 | + public function getName() { |
|
58 | + return 'Copy the share password into the dedicated column'; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * @param IOutput $output |
|
63 | + */ |
|
64 | + public function run(IOutput $output) { |
|
65 | + if (!$this->shouldRun()) { |
|
66 | + return; |
|
67 | + } |
|
68 | + |
|
69 | + $query = $this->connection->getQueryBuilder(); |
|
70 | + $query |
|
71 | + ->update('share') |
|
72 | + ->set('password', 'share_with') |
|
73 | + ->where($query->expr()->eq('share_type', $query->createNamedParameter(Share::SHARE_TYPE_LINK))) |
|
74 | + ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | + $result = $query->execute(); |
|
76 | + |
|
77 | + if ($result === 0) { |
|
78 | + // No link updated, no need to run the second query |
|
79 | + return; |
|
80 | + } |
|
81 | + |
|
82 | + $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | + $clearQuery |
|
84 | + ->update('share') |
|
85 | + ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | + ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(Share::SHARE_TYPE_LINK))); |
|
87 | + |
|
88 | + $clearQuery->execute(); |
|
89 | + |
|
90 | + } |
|
91 | + |
|
92 | + protected function shouldRun() { |
|
93 | + $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
94 | + return version_compare($appVersion, '1.4.0', '<'); |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -28,26 +28,26 @@ |
||
28 | 28 | use OCP\ILogger; |
29 | 29 | |
30 | 30 | class CategoryFetcher extends Fetcher { |
31 | - /** |
|
32 | - * @param Factory $appDataFactory |
|
33 | - * @param IClientService $clientService |
|
34 | - * @param ITimeFactory $timeFactory |
|
35 | - * @param IConfig $config |
|
36 | - * @param ILogger $logger |
|
37 | - */ |
|
38 | - public function __construct(Factory $appDataFactory, |
|
39 | - IClientService $clientService, |
|
40 | - ITimeFactory $timeFactory, |
|
41 | - IConfig $config, |
|
42 | - ILogger $logger) { |
|
43 | - parent::__construct( |
|
44 | - $appDataFactory, |
|
45 | - $clientService, |
|
46 | - $timeFactory, |
|
47 | - $config, |
|
48 | - $logger |
|
49 | - ); |
|
50 | - $this->fileName = 'categories.json'; |
|
51 | - $this->endpointUrl = 'https://apps.nextcloud.com/api/v1/categories.json'; |
|
52 | - } |
|
31 | + /** |
|
32 | + * @param Factory $appDataFactory |
|
33 | + * @param IClientService $clientService |
|
34 | + * @param ITimeFactory $timeFactory |
|
35 | + * @param IConfig $config |
|
36 | + * @param ILogger $logger |
|
37 | + */ |
|
38 | + public function __construct(Factory $appDataFactory, |
|
39 | + IClientService $clientService, |
|
40 | + ITimeFactory $timeFactory, |
|
41 | + IConfig $config, |
|
42 | + ILogger $logger) { |
|
43 | + parent::__construct( |
|
44 | + $appDataFactory, |
|
45 | + $clientService, |
|
46 | + $timeFactory, |
|
47 | + $config, |
|
48 | + $logger |
|
49 | + ); |
|
50 | + $this->fileName = 'categories.json'; |
|
51 | + $this->endpointUrl = 'https://apps.nextcloud.com/api/v1/categories.json'; |
|
52 | + } |
|
53 | 53 | } |
@@ -34,20 +34,20 @@ |
||
34 | 34 | * @method void setName(string $name) |
35 | 35 | */ |
36 | 36 | class Client extends Entity { |
37 | - /** @var string */ |
|
38 | - protected $name; |
|
39 | - /** @var string */ |
|
40 | - protected $redirectUri; |
|
41 | - /** @var string */ |
|
42 | - protected $clientIdentifier; |
|
43 | - /** @var string */ |
|
44 | - protected $secret; |
|
37 | + /** @var string */ |
|
38 | + protected $name; |
|
39 | + /** @var string */ |
|
40 | + protected $redirectUri; |
|
41 | + /** @var string */ |
|
42 | + protected $clientIdentifier; |
|
43 | + /** @var string */ |
|
44 | + protected $secret; |
|
45 | 45 | |
46 | - public function __construct() { |
|
47 | - $this->addType('id', 'int'); |
|
48 | - $this->addType('name', 'string'); |
|
49 | - $this->addType('redirect_uri', 'string'); |
|
50 | - $this->addType('client_identifier', 'string'); |
|
51 | - $this->addType('secret', 'string'); |
|
52 | - } |
|
46 | + public function __construct() { |
|
47 | + $this->addType('id', 'int'); |
|
48 | + $this->addType('name', 'string'); |
|
49 | + $this->addType('redirect_uri', 'string'); |
|
50 | + $this->addType('client_identifier', 'string'); |
|
51 | + $this->addType('secret', 'string'); |
|
52 | + } |
|
53 | 53 | } |
@@ -34,20 +34,20 @@ |
||
34 | 34 | * @method void setHashedCode(string $token) |
35 | 35 | */ |
36 | 36 | class AccessToken extends Entity { |
37 | - /** @var int */ |
|
38 | - protected $tokenId; |
|
39 | - /** @var int */ |
|
40 | - protected $clientId; |
|
41 | - /** @var string */ |
|
42 | - protected $hashedCode; |
|
43 | - /** @var string */ |
|
44 | - protected $encryptedToken; |
|
37 | + /** @var int */ |
|
38 | + protected $tokenId; |
|
39 | + /** @var int */ |
|
40 | + protected $clientId; |
|
41 | + /** @var string */ |
|
42 | + protected $hashedCode; |
|
43 | + /** @var string */ |
|
44 | + protected $encryptedToken; |
|
45 | 45 | |
46 | - public function __construct() { |
|
47 | - $this->addType('id', 'int'); |
|
48 | - $this->addType('token_id', 'int'); |
|
49 | - $this->addType('client_id', 'int'); |
|
50 | - $this->addType('hashed_code', 'string'); |
|
51 | - $this->addType('encrypted_token', 'string'); |
|
52 | - } |
|
46 | + public function __construct() { |
|
47 | + $this->addType('id', 'int'); |
|
48 | + $this->addType('token_id', 'int'); |
|
49 | + $this->addType('client_id', 'int'); |
|
50 | + $this->addType('hashed_code', 'string'); |
|
51 | + $this->addType('encrypted_token', 'string'); |
|
52 | + } |
|
53 | 53 | } |
@@ -31,31 +31,31 @@ |
||
31 | 31 | */ |
32 | 32 | interface ICredentials { |
33 | 33 | |
34 | - /** |
|
35 | - * Get the user UID |
|
36 | - * |
|
37 | - * @since 12 |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function getUID(); |
|
34 | + /** |
|
35 | + * Get the user UID |
|
36 | + * |
|
37 | + * @since 12 |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function getUID(); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Get the login name the users used to login |
|
45 | - * |
|
46 | - * @since 12 |
|
47 | - * |
|
48 | - * @return string |
|
49 | - */ |
|
50 | - public function getLoginName(); |
|
43 | + /** |
|
44 | + * Get the login name the users used to login |
|
45 | + * |
|
46 | + * @since 12 |
|
47 | + * |
|
48 | + * @return string |
|
49 | + */ |
|
50 | + public function getLoginName(); |
|
51 | 51 | |
52 | - /** |
|
53 | - * Get the password |
|
54 | - * |
|
55 | - * @since 12 |
|
56 | - * |
|
57 | - * @return string |
|
58 | - * @throws PasswordUnavailableException |
|
59 | - */ |
|
60 | - public function getPassword(); |
|
52 | + /** |
|
53 | + * Get the password |
|
54 | + * |
|
55 | + * @since 12 |
|
56 | + * |
|
57 | + * @return string |
|
58 | + * @throws PasswordUnavailableException |
|
59 | + */ |
|
60 | + public function getPassword(); |
|
61 | 61 | } |
@@ -28,48 +28,48 @@ |
||
28 | 28 | |
29 | 29 | class BackupCodeMapper extends Mapper { |
30 | 30 | |
31 | - public function __construct(IDBConnection $db) { |
|
32 | - parent::__construct($db, 'twofactor_backupcodes'); |
|
33 | - } |
|
31 | + public function __construct(IDBConnection $db) { |
|
32 | + parent::__construct($db, 'twofactor_backupcodes'); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param IUser $user |
|
37 | - * @return BackupCode[] |
|
38 | - */ |
|
39 | - public function getBackupCodes(IUser $user) { |
|
40 | - /* @var IQueryBuilder $qb */ |
|
41 | - $qb = $this->db->getQueryBuilder(); |
|
35 | + /** |
|
36 | + * @param IUser $user |
|
37 | + * @return BackupCode[] |
|
38 | + */ |
|
39 | + public function getBackupCodes(IUser $user) { |
|
40 | + /* @var IQueryBuilder $qb */ |
|
41 | + $qb = $this->db->getQueryBuilder(); |
|
42 | 42 | |
43 | - $qb->select('id', 'user_id', 'code', 'used') |
|
44 | - ->from('twofactor_backupcodes') |
|
45 | - ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($user->getUID()))); |
|
46 | - $result = $qb->execute(); |
|
43 | + $qb->select('id', 'user_id', 'code', 'used') |
|
44 | + ->from('twofactor_backupcodes') |
|
45 | + ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($user->getUID()))); |
|
46 | + $result = $qb->execute(); |
|
47 | 47 | |
48 | - $rows = $result->fetchAll(); |
|
49 | - $result->closeCursor(); |
|
48 | + $rows = $result->fetchAll(); |
|
49 | + $result->closeCursor(); |
|
50 | 50 | |
51 | - return array_map(function ($row) { |
|
52 | - return BackupCode::fromRow($row); |
|
53 | - }, $rows); |
|
54 | - } |
|
51 | + return array_map(function ($row) { |
|
52 | + return BackupCode::fromRow($row); |
|
53 | + }, $rows); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param IUser $user |
|
58 | - */ |
|
59 | - public function deleteCodes(IUser $user) { |
|
60 | - $this->deleteCodesByUserId($user->getUID()); |
|
61 | - } |
|
56 | + /** |
|
57 | + * @param IUser $user |
|
58 | + */ |
|
59 | + public function deleteCodes(IUser $user) { |
|
60 | + $this->deleteCodesByUserId($user->getUID()); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @param string $uid |
|
65 | - */ |
|
66 | - public function deleteCodesByUserId($uid) { |
|
67 | - /* @var IQueryBuilder $qb */ |
|
68 | - $qb = $this->db->getQueryBuilder(); |
|
63 | + /** |
|
64 | + * @param string $uid |
|
65 | + */ |
|
66 | + public function deleteCodesByUserId($uid) { |
|
67 | + /* @var IQueryBuilder $qb */ |
|
68 | + $qb = $this->db->getQueryBuilder(); |
|
69 | 69 | |
70 | - $qb->delete('twofactor_backupcodes') |
|
71 | - ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($uid))); |
|
72 | - $qb->execute(); |
|
73 | - } |
|
70 | + $qb->delete('twofactor_backupcodes') |
|
71 | + ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($uid))); |
|
72 | + $qb->execute(); |
|
73 | + } |
|
74 | 74 | |
75 | 75 | } |
@@ -52,106 +52,106 @@ |
||
52 | 52 | class Application extends App { |
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * @param array $urlParams |
|
57 | - */ |
|
58 | - public function __construct(array $urlParams=[]){ |
|
59 | - parent::__construct('settings', $urlParams); |
|
55 | + /** |
|
56 | + * @param array $urlParams |
|
57 | + */ |
|
58 | + public function __construct(array $urlParams=[]){ |
|
59 | + parent::__construct('settings', $urlParams); |
|
60 | 60 | |
61 | - $container = $this->getContainer(); |
|
61 | + $container = $this->getContainer(); |
|
62 | 62 | |
63 | - // Register Middleware |
|
64 | - $container->registerAlias('SubadminMiddleware', SubadminMiddleware::class); |
|
65 | - $container->registerMiddleWare('SubadminMiddleware'); |
|
63 | + // Register Middleware |
|
64 | + $container->registerAlias('SubadminMiddleware', SubadminMiddleware::class); |
|
65 | + $container->registerMiddleWare('SubadminMiddleware'); |
|
66 | 66 | |
67 | - /** |
|
68 | - * Core class wrappers |
|
69 | - */ |
|
70 | - /** FIXME: Remove once OC_User is non-static and mockable */ |
|
71 | - $container->registerService('isAdmin', function() { |
|
72 | - return \OC_User::isAdminUser(\OC_User::getUser()); |
|
73 | - }); |
|
74 | - /** FIXME: Remove once OC_SubAdmin is non-static and mockable */ |
|
75 | - $container->registerService('isSubAdmin', function(IContainer $c) { |
|
76 | - $userObject = \OC::$server->getUserSession()->getUser(); |
|
77 | - $isSubAdmin = false; |
|
78 | - if($userObject !== null) { |
|
79 | - $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); |
|
80 | - } |
|
81 | - return $isSubAdmin; |
|
82 | - }); |
|
83 | - $container->registerService('userCertificateManager', function(IContainer $c) { |
|
84 | - return $c->query('ServerContainer')->getCertificateManager(); |
|
85 | - }, false); |
|
86 | - $container->registerService('systemCertificateManager', function (IContainer $c) { |
|
87 | - return $c->query('ServerContainer')->getCertificateManager(null); |
|
88 | - }, false); |
|
89 | - $container->registerService(IProvider::class, function (IContainer $c) { |
|
90 | - return $c->query('ServerContainer')->query(IProvider::class); |
|
91 | - }); |
|
92 | - $container->registerService(IManager::class, function (IContainer $c) { |
|
93 | - return $c->query('ServerContainer')->getSettingsManager(); |
|
94 | - }); |
|
67 | + /** |
|
68 | + * Core class wrappers |
|
69 | + */ |
|
70 | + /** FIXME: Remove once OC_User is non-static and mockable */ |
|
71 | + $container->registerService('isAdmin', function() { |
|
72 | + return \OC_User::isAdminUser(\OC_User::getUser()); |
|
73 | + }); |
|
74 | + /** FIXME: Remove once OC_SubAdmin is non-static and mockable */ |
|
75 | + $container->registerService('isSubAdmin', function(IContainer $c) { |
|
76 | + $userObject = \OC::$server->getUserSession()->getUser(); |
|
77 | + $isSubAdmin = false; |
|
78 | + if($userObject !== null) { |
|
79 | + $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); |
|
80 | + } |
|
81 | + return $isSubAdmin; |
|
82 | + }); |
|
83 | + $container->registerService('userCertificateManager', function(IContainer $c) { |
|
84 | + return $c->query('ServerContainer')->getCertificateManager(); |
|
85 | + }, false); |
|
86 | + $container->registerService('systemCertificateManager', function (IContainer $c) { |
|
87 | + return $c->query('ServerContainer')->getCertificateManager(null); |
|
88 | + }, false); |
|
89 | + $container->registerService(IProvider::class, function (IContainer $c) { |
|
90 | + return $c->query('ServerContainer')->query(IProvider::class); |
|
91 | + }); |
|
92 | + $container->registerService(IManager::class, function (IContainer $c) { |
|
93 | + return $c->query('ServerContainer')->getSettingsManager(); |
|
94 | + }); |
|
95 | 95 | |
96 | - $container->registerService(NewUserMailHelper::class, function (IContainer $c) { |
|
97 | - /** @var Server $server */ |
|
98 | - $server = $c->query('ServerContainer'); |
|
99 | - /** @var Defaults $defaults */ |
|
100 | - $defaults = $server->query(Defaults::class); |
|
96 | + $container->registerService(NewUserMailHelper::class, function (IContainer $c) { |
|
97 | + /** @var Server $server */ |
|
98 | + $server = $c->query('ServerContainer'); |
|
99 | + /** @var Defaults $defaults */ |
|
100 | + $defaults = $server->query(Defaults::class); |
|
101 | 101 | |
102 | - return new NewUserMailHelper( |
|
103 | - $defaults, |
|
104 | - $server->getURLGenerator(), |
|
105 | - $server->getL10N('settings'), |
|
106 | - $server->getMailer(), |
|
107 | - $server->getSecureRandom(), |
|
108 | - new TimeFactory(), |
|
109 | - $server->getConfig(), |
|
110 | - $server->getCrypto(), |
|
111 | - Util::getDefaultEmailAddress('no-reply') |
|
112 | - ); |
|
113 | - }); |
|
114 | - } |
|
102 | + return new NewUserMailHelper( |
|
103 | + $defaults, |
|
104 | + $server->getURLGenerator(), |
|
105 | + $server->getL10N('settings'), |
|
106 | + $server->getMailer(), |
|
107 | + $server->getSecureRandom(), |
|
108 | + new TimeFactory(), |
|
109 | + $server->getConfig(), |
|
110 | + $server->getCrypto(), |
|
111 | + Util::getDefaultEmailAddress('no-reply') |
|
112 | + ); |
|
113 | + }); |
|
114 | + } |
|
115 | 115 | |
116 | - public function register() { |
|
117 | - $activityManager = $this->getContainer()->getServer()->getActivityManager(); |
|
118 | - $activityManager->registerSetting(Setting::class); // FIXME move to info.xml |
|
119 | - $activityManager->registerProvider(Provider::class); // FIXME move to info.xml |
|
120 | - $activityManager->registerFilter(SecurityFilter::class); // FIXME move to info.xml |
|
121 | - $activityManager->registerSetting(SecuritySetting::class); // FIXME move to info.xml |
|
122 | - $activityManager->registerProvider(SecurityProvider::class); // FIXME move to info.xml |
|
116 | + public function register() { |
|
117 | + $activityManager = $this->getContainer()->getServer()->getActivityManager(); |
|
118 | + $activityManager->registerSetting(Setting::class); // FIXME move to info.xml |
|
119 | + $activityManager->registerProvider(Provider::class); // FIXME move to info.xml |
|
120 | + $activityManager->registerFilter(SecurityFilter::class); // FIXME move to info.xml |
|
121 | + $activityManager->registerSetting(SecuritySetting::class); // FIXME move to info.xml |
|
122 | + $activityManager->registerProvider(SecurityProvider::class); // FIXME move to info.xml |
|
123 | 123 | |
124 | - Util::connectHook('OC_User', 'post_setPassword', $this, 'onChangePassword'); |
|
125 | - Util::connectHook('OC_User', 'changeUser', $this, 'onChangeInfo'); |
|
126 | - } |
|
124 | + Util::connectHook('OC_User', 'post_setPassword', $this, 'onChangePassword'); |
|
125 | + Util::connectHook('OC_User', 'changeUser', $this, 'onChangeInfo'); |
|
126 | + } |
|
127 | 127 | |
128 | - /** |
|
129 | - * @param array $parameters |
|
130 | - * @throws \InvalidArgumentException |
|
131 | - * @throws \BadMethodCallException |
|
132 | - * @throws \Exception |
|
133 | - * @throws \OCP\AppFramework\QueryException |
|
134 | - */ |
|
135 | - public function onChangePassword(array $parameters) { |
|
136 | - /** @var Hooks $hooks */ |
|
137 | - $hooks = $this->getContainer()->query(Hooks::class); |
|
138 | - $hooks->onChangePassword($parameters['uid']); |
|
139 | - } |
|
128 | + /** |
|
129 | + * @param array $parameters |
|
130 | + * @throws \InvalidArgumentException |
|
131 | + * @throws \BadMethodCallException |
|
132 | + * @throws \Exception |
|
133 | + * @throws \OCP\AppFramework\QueryException |
|
134 | + */ |
|
135 | + public function onChangePassword(array $parameters) { |
|
136 | + /** @var Hooks $hooks */ |
|
137 | + $hooks = $this->getContainer()->query(Hooks::class); |
|
138 | + $hooks->onChangePassword($parameters['uid']); |
|
139 | + } |
|
140 | 140 | |
141 | - /** |
|
142 | - * @param array $parameters |
|
143 | - * @throws \InvalidArgumentException |
|
144 | - * @throws \BadMethodCallException |
|
145 | - * @throws \Exception |
|
146 | - * @throws \OCP\AppFramework\QueryException |
|
147 | - */ |
|
148 | - public function onChangeInfo(array $parameters) { |
|
149 | - if ($parameters['feature'] !== 'eMailAddress') { |
|
150 | - return; |
|
151 | - } |
|
141 | + /** |
|
142 | + * @param array $parameters |
|
143 | + * @throws \InvalidArgumentException |
|
144 | + * @throws \BadMethodCallException |
|
145 | + * @throws \Exception |
|
146 | + * @throws \OCP\AppFramework\QueryException |
|
147 | + */ |
|
148 | + public function onChangeInfo(array $parameters) { |
|
149 | + if ($parameters['feature'] !== 'eMailAddress') { |
|
150 | + return; |
|
151 | + } |
|
152 | 152 | |
153 | - /** @var Hooks $hooks */ |
|
154 | - $hooks = $this->getContainer()->query(Hooks::class); |
|
155 | - $hooks->onChangeEmail($parameters['user'], $parameters['old_value']); |
|
156 | - } |
|
153 | + /** @var Hooks $hooks */ |
|
154 | + $hooks = $this->getContainer()->query(Hooks::class); |
|
155 | + $hooks->onChangeEmail($parameters['user'], $parameters['old_value']); |
|
156 | + } |
|
157 | 157 | } |
@@ -28,39 +28,39 @@ |
||
28 | 28 | |
29 | 29 | class SecurityFilter implements IFilter { |
30 | 30 | |
31 | - /** @var IURLGenerator */ |
|
32 | - private $urlGenerator; |
|
31 | + /** @var IURLGenerator */ |
|
32 | + private $urlGenerator; |
|
33 | 33 | |
34 | - /** @var IL10N */ |
|
35 | - private $l10n; |
|
34 | + /** @var IL10N */ |
|
35 | + private $l10n; |
|
36 | 36 | |
37 | - public function __construct(IURLGenerator $urlGenerator, IL10N $l10n) { |
|
38 | - $this->urlGenerator = $urlGenerator; |
|
39 | - $this->l10n = $l10n; |
|
40 | - } |
|
37 | + public function __construct(IURLGenerator $urlGenerator, IL10N $l10n) { |
|
38 | + $this->urlGenerator = $urlGenerator; |
|
39 | + $this->l10n = $l10n; |
|
40 | + } |
|
41 | 41 | |
42 | - public function allowedApps() { |
|
43 | - return []; |
|
44 | - } |
|
42 | + public function allowedApps() { |
|
43 | + return []; |
|
44 | + } |
|
45 | 45 | |
46 | - public function filterTypes(array $types) { |
|
47 | - return array_intersect(['security'], $types); |
|
48 | - } |
|
46 | + public function filterTypes(array $types) { |
|
47 | + return array_intersect(['security'], $types); |
|
48 | + } |
|
49 | 49 | |
50 | - public function getIcon() { |
|
51 | - return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')); |
|
52 | - } |
|
50 | + public function getIcon() { |
|
51 | + return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')); |
|
52 | + } |
|
53 | 53 | |
54 | - public function getIdentifier() { |
|
55 | - return 'security'; |
|
56 | - } |
|
54 | + public function getIdentifier() { |
|
55 | + return 'security'; |
|
56 | + } |
|
57 | 57 | |
58 | - public function getName() { |
|
59 | - return $this->l10n->t('Security'); |
|
60 | - } |
|
58 | + public function getName() { |
|
59 | + return $this->l10n->t('Security'); |
|
60 | + } |
|
61 | 61 | |
62 | - public function getPriority() { |
|
63 | - return 30; |
|
64 | - } |
|
62 | + public function getPriority() { |
|
63 | + return 30; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | } |