@@ -34,35 +34,35 @@ |
||
34 | 34 | */ |
35 | 35 | class BeforeUserLoggedInEvent extends Event { |
36 | 36 | |
37 | - /** @var string */ |
|
38 | - private $username; |
|
37 | + /** @var string */ |
|
38 | + private $username; |
|
39 | 39 | |
40 | - /** @var string */ |
|
41 | - private $password; |
|
40 | + /** @var string */ |
|
41 | + private $password; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @since 18.0.0 |
|
45 | - */ |
|
46 | - public function __construct(string $username, string $password) { |
|
47 | - parent::__construct(); |
|
48 | - $this->username = $username; |
|
49 | - $this->password = $password; |
|
50 | - } |
|
43 | + /** |
|
44 | + * @since 18.0.0 |
|
45 | + */ |
|
46 | + public function __construct(string $username, string $password) { |
|
47 | + parent::__construct(); |
|
48 | + $this->username = $username; |
|
49 | + $this->password = $password; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * returns the login name, which must not necessarily match to a user ID |
|
54 | - * |
|
55 | - * @since 18.0.0 |
|
56 | - */ |
|
57 | - public function getUsername(): string { |
|
58 | - return $this->username; |
|
59 | - } |
|
52 | + /** |
|
53 | + * returns the login name, which must not necessarily match to a user ID |
|
54 | + * |
|
55 | + * @since 18.0.0 |
|
56 | + */ |
|
57 | + public function getUsername(): string { |
|
58 | + return $this->username; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @since 18.0.0 |
|
63 | - */ |
|
64 | - public function getPassword(): string { |
|
65 | - return $this->password; |
|
66 | - } |
|
61 | + /** |
|
62 | + * @since 18.0.0 |
|
63 | + */ |
|
64 | + public function getPassword(): string { |
|
65 | + return $this->password; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | } |
@@ -37,77 +37,77 @@ |
||
37 | 37 | |
38 | 38 | class SecurityProvider implements IProvider { |
39 | 39 | |
40 | - /** @var L10nFactory */ |
|
41 | - private $l10n; |
|
40 | + /** @var L10nFactory */ |
|
41 | + private $l10n; |
|
42 | 42 | |
43 | - /** @var IURLGenerator */ |
|
44 | - private $urlGenerator; |
|
43 | + /** @var IURLGenerator */ |
|
44 | + private $urlGenerator; |
|
45 | 45 | |
46 | - /** @var IManager */ |
|
47 | - private $activityManager; |
|
46 | + /** @var IManager */ |
|
47 | + private $activityManager; |
|
48 | 48 | |
49 | - public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) { |
|
50 | - $this->urlGenerator = $urlGenerator; |
|
51 | - $this->l10n = $l10n; |
|
52 | - $this->activityManager = $activityManager; |
|
53 | - } |
|
49 | + public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) { |
|
50 | + $this->urlGenerator = $urlGenerator; |
|
51 | + $this->l10n = $l10n; |
|
52 | + $this->activityManager = $activityManager; |
|
53 | + } |
|
54 | 54 | |
55 | - public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
56 | - if ($event->getType() !== 'security') { |
|
57 | - throw new InvalidArgumentException(); |
|
58 | - } |
|
55 | + public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
56 | + if ($event->getType() !== 'security') { |
|
57 | + throw new InvalidArgumentException(); |
|
58 | + } |
|
59 | 59 | |
60 | - $l = $this->l10n->get('settings', $language); |
|
60 | + $l = $this->l10n->get('settings', $language); |
|
61 | 61 | |
62 | - switch ($event->getSubject()) { |
|
63 | - case 'twofactor_success': |
|
64 | - $params = $event->getSubjectParameters(); |
|
65 | - $event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [ |
|
66 | - $params['provider'], |
|
67 | - ])); |
|
68 | - if ($this->activityManager->getRequirePNG()) { |
|
69 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png'))); |
|
70 | - } else { |
|
71 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg'))); |
|
72 | - } |
|
73 | - break; |
|
74 | - case 'twofactor_failed': |
|
75 | - $params = $event->getSubjectParameters(); |
|
76 | - $event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [ |
|
77 | - $params['provider'], |
|
78 | - ])); |
|
79 | - if ($this->activityManager->getRequirePNG()) { |
|
80 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png'))); |
|
81 | - } else { |
|
82 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg'))); |
|
83 | - } |
|
84 | - break; |
|
85 | - case 'remote_wipe_start': |
|
86 | - $params = $event->getSubjectParameters(); |
|
87 | - $event->setParsedSubject($l->t('Remote wipe was started on %1$s', [ |
|
88 | - $params['name'], |
|
89 | - ])); |
|
90 | - if ($this->activityManager->getRequirePNG()) { |
|
91 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png'))); |
|
92 | - } else { |
|
93 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg'))); |
|
94 | - } |
|
95 | - break; |
|
96 | - case 'remote_wipe_finish': |
|
97 | - $params = $event->getSubjectParameters(); |
|
98 | - $event->setParsedSubject($l->t('Remote wipe has finished on %1$s', [ |
|
99 | - $params['name'], |
|
100 | - ])); |
|
101 | - if ($this->activityManager->getRequirePNG()) { |
|
102 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png'))); |
|
103 | - } else { |
|
104 | - $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg'))); |
|
105 | - } |
|
106 | - break; |
|
107 | - default: |
|
108 | - throw new InvalidArgumentException(); |
|
109 | - } |
|
110 | - return $event; |
|
111 | - } |
|
62 | + switch ($event->getSubject()) { |
|
63 | + case 'twofactor_success': |
|
64 | + $params = $event->getSubjectParameters(); |
|
65 | + $event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [ |
|
66 | + $params['provider'], |
|
67 | + ])); |
|
68 | + if ($this->activityManager->getRequirePNG()) { |
|
69 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png'))); |
|
70 | + } else { |
|
71 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg'))); |
|
72 | + } |
|
73 | + break; |
|
74 | + case 'twofactor_failed': |
|
75 | + $params = $event->getSubjectParameters(); |
|
76 | + $event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [ |
|
77 | + $params['provider'], |
|
78 | + ])); |
|
79 | + if ($this->activityManager->getRequirePNG()) { |
|
80 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png'))); |
|
81 | + } else { |
|
82 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg'))); |
|
83 | + } |
|
84 | + break; |
|
85 | + case 'remote_wipe_start': |
|
86 | + $params = $event->getSubjectParameters(); |
|
87 | + $event->setParsedSubject($l->t('Remote wipe was started on %1$s', [ |
|
88 | + $params['name'], |
|
89 | + ])); |
|
90 | + if ($this->activityManager->getRequirePNG()) { |
|
91 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png'))); |
|
92 | + } else { |
|
93 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg'))); |
|
94 | + } |
|
95 | + break; |
|
96 | + case 'remote_wipe_finish': |
|
97 | + $params = $event->getSubjectParameters(); |
|
98 | + $event->setParsedSubject($l->t('Remote wipe has finished on %1$s', [ |
|
99 | + $params['name'], |
|
100 | + ])); |
|
101 | + if ($this->activityManager->getRequirePNG()) { |
|
102 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.png'))); |
|
103 | + } else { |
|
104 | + $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/delete.svg'))); |
|
105 | + } |
|
106 | + break; |
|
107 | + default: |
|
108 | + throw new InvalidArgumentException(); |
|
109 | + } |
|
110 | + return $event; |
|
111 | + } |
|
112 | 112 | |
113 | 113 | } |
@@ -111,10 +111,10 @@ |
||
111 | 111 | <?php if (!empty($_['disclaimer'])) { ?> |
112 | 112 | <div> |
113 | 113 | <?php |
114 | - echo $l->t('By uploading files, you agree to the %1$sterms of service%2$s.', [ |
|
115 | - '<span id="show-terms-dialog">', '</span>' |
|
116 | - ]); |
|
117 | - ?> |
|
114 | + echo $l->t('By uploading files, you agree to the %1$sterms of service%2$s.', [ |
|
115 | + '<span id="show-terms-dialog">', '</span>' |
|
116 | + ]); |
|
117 | + ?> |
|
118 | 118 | </div> |
119 | 119 | <?php } ?> |
120 | 120 | </div> |
@@ -38,84 +38,84 @@ |
||
38 | 38 | use OCP\IUserSession; |
39 | 39 | |
40 | 40 | class AjaxController extends Controller { |
41 | - /** @var RSA */ |
|
42 | - private $rsaMechanism; |
|
43 | - /** @var GlobalAuth */ |
|
44 | - private $globalAuth; |
|
45 | - /** @var IUserSession */ |
|
46 | - private $userSession; |
|
47 | - /** @var IGroupManager */ |
|
48 | - private $groupManager; |
|
41 | + /** @var RSA */ |
|
42 | + private $rsaMechanism; |
|
43 | + /** @var GlobalAuth */ |
|
44 | + private $globalAuth; |
|
45 | + /** @var IUserSession */ |
|
46 | + private $userSession; |
|
47 | + /** @var IGroupManager */ |
|
48 | + private $groupManager; |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string $appName |
|
52 | - * @param IRequest $request |
|
53 | - * @param RSA $rsaMechanism |
|
54 | - * @param GlobalAuth $globalAuth |
|
55 | - * @param IUserSession $userSession |
|
56 | - * @param IGroupManager $groupManager |
|
57 | - */ |
|
58 | - public function __construct($appName, |
|
59 | - IRequest $request, |
|
60 | - RSA $rsaMechanism, |
|
61 | - GlobalAuth $globalAuth, |
|
62 | - IUserSession $userSession, |
|
63 | - IGroupManager $groupManager) { |
|
64 | - parent::__construct($appName, $request); |
|
65 | - $this->rsaMechanism = $rsaMechanism; |
|
66 | - $this->globalAuth = $globalAuth; |
|
67 | - $this->userSession = $userSession; |
|
68 | - $this->groupManager = $groupManager; |
|
69 | - } |
|
50 | + /** |
|
51 | + * @param string $appName |
|
52 | + * @param IRequest $request |
|
53 | + * @param RSA $rsaMechanism |
|
54 | + * @param GlobalAuth $globalAuth |
|
55 | + * @param IUserSession $userSession |
|
56 | + * @param IGroupManager $groupManager |
|
57 | + */ |
|
58 | + public function __construct($appName, |
|
59 | + IRequest $request, |
|
60 | + RSA $rsaMechanism, |
|
61 | + GlobalAuth $globalAuth, |
|
62 | + IUserSession $userSession, |
|
63 | + IGroupManager $groupManager) { |
|
64 | + parent::__construct($appName, $request); |
|
65 | + $this->rsaMechanism = $rsaMechanism; |
|
66 | + $this->globalAuth = $globalAuth; |
|
67 | + $this->userSession = $userSession; |
|
68 | + $this->groupManager = $groupManager; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @param int $keyLength |
|
73 | - * @return array |
|
74 | - */ |
|
75 | - private function generateSshKeys($keyLength) { |
|
76 | - $key = $this->rsaMechanism->createKey($keyLength); |
|
77 | - // Replace the placeholder label with a more meaningful one |
|
78 | - $key['publickey'] = str_replace('phpseclib-generated-key', gethostname(), $key['publickey']); |
|
71 | + /** |
|
72 | + * @param int $keyLength |
|
73 | + * @return array |
|
74 | + */ |
|
75 | + private function generateSshKeys($keyLength) { |
|
76 | + $key = $this->rsaMechanism->createKey($keyLength); |
|
77 | + // Replace the placeholder label with a more meaningful one |
|
78 | + $key['publickey'] = str_replace('phpseclib-generated-key', gethostname(), $key['publickey']); |
|
79 | 79 | |
80 | - return $key; |
|
81 | - } |
|
80 | + return $key; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * Generates an SSH public/private key pair. |
|
85 | - * |
|
86 | - * @NoAdminRequired |
|
87 | - * @param int $keyLength |
|
88 | - */ |
|
89 | - public function getSshKeys($keyLength = 1024) { |
|
90 | - $key = $this->generateSshKeys($keyLength); |
|
91 | - return new JSONResponse( |
|
92 | - ['data' => [ |
|
93 | - 'private_key' => $key['privatekey'], |
|
94 | - 'public_key' => $key['publickey'] |
|
95 | - ], |
|
96 | - 'status' => 'success' |
|
97 | - ]); |
|
98 | - } |
|
83 | + /** |
|
84 | + * Generates an SSH public/private key pair. |
|
85 | + * |
|
86 | + * @NoAdminRequired |
|
87 | + * @param int $keyLength |
|
88 | + */ |
|
89 | + public function getSshKeys($keyLength = 1024) { |
|
90 | + $key = $this->generateSshKeys($keyLength); |
|
91 | + return new JSONResponse( |
|
92 | + ['data' => [ |
|
93 | + 'private_key' => $key['privatekey'], |
|
94 | + 'public_key' => $key['publickey'] |
|
95 | + ], |
|
96 | + 'status' => 'success' |
|
97 | + ]); |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * @NoAdminRequired |
|
102 | - * |
|
103 | - * @param string $uid |
|
104 | - * @param string $user |
|
105 | - * @param string $password |
|
106 | - * @return bool |
|
107 | - */ |
|
108 | - public function saveGlobalCredentials($uid, $user, $password) { |
|
109 | - $currentUser = $this->userSession->getUser(); |
|
100 | + /** |
|
101 | + * @NoAdminRequired |
|
102 | + * |
|
103 | + * @param string $uid |
|
104 | + * @param string $user |
|
105 | + * @param string $password |
|
106 | + * @return bool |
|
107 | + */ |
|
108 | + public function saveGlobalCredentials($uid, $user, $password) { |
|
109 | + $currentUser = $this->userSession->getUser(); |
|
110 | 110 | |
111 | - // Non-admins can only edit their own credentials |
|
112 | - $allowedToEdit = ($this->groupManager->isAdmin($currentUser->getUID()) || $currentUser->getUID() === $uid); |
|
111 | + // Non-admins can only edit their own credentials |
|
112 | + $allowedToEdit = ($this->groupManager->isAdmin($currentUser->getUID()) || $currentUser->getUID() === $uid); |
|
113 | 113 | |
114 | - if ($allowedToEdit) { |
|
115 | - $this->globalAuth->saveAuth($uid, $user, $password); |
|
116 | - return true; |
|
117 | - } else { |
|
118 | - return false; |
|
119 | - } |
|
120 | - } |
|
114 | + if ($allowedToEdit) { |
|
115 | + $this->globalAuth->saveAuth($uid, $user, $password); |
|
116 | + return true; |
|
117 | + } else { |
|
118 | + return false; |
|
119 | + } |
|
120 | + } |
|
121 | 121 | } |
@@ -24,14 +24,14 @@ |
||
24 | 24 | namespace OCA\User_LDAP; |
25 | 25 | |
26 | 26 | class ConnectionFactory { |
27 | - /** @var ILDAPWrapper */ |
|
28 | - private $ldap; |
|
27 | + /** @var ILDAPWrapper */ |
|
28 | + private $ldap; |
|
29 | 29 | |
30 | - public function __construct(ILDAPWrapper $ldap) { |
|
31 | - $this->ldap = $ldap; |
|
32 | - } |
|
30 | + public function __construct(ILDAPWrapper $ldap) { |
|
31 | + $this->ldap = $ldap; |
|
32 | + } |
|
33 | 33 | |
34 | - public function get($prefix) { |
|
35 | - return new Connection($this->ldap, $prefix, 'user_ldap'); |
|
36 | - } |
|
34 | + public function get($prefix) { |
|
35 | + return new Connection($this->ldap, $prefix, 'user_ldap'); |
|
36 | + } |
|
37 | 37 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | namespace OCA\Files_Trashbin\Sabre; |
29 | 29 | |
30 | 30 | class TrashFolderFile extends AbstractTrashFile { |
31 | - public function get() { |
|
32 | - return $this->data->getStorage()->fopen($this->data->getInternalPath(), 'rb'); |
|
33 | - } |
|
31 | + public function get() { |
|
32 | + return $this->data->getStorage()->fopen($this->data->getInternalPath(), 'rb'); |
|
33 | + } |
|
34 | 34 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | namespace OCA\Files_Trashbin\Sabre; |
29 | 29 | |
30 | 30 | class TrashFolder extends AbstractTrashFolder { |
31 | - public function getName(): string { |
|
32 | - return $this->data->getName() . '.d' . $this->getLastModified(); |
|
33 | - } |
|
31 | + public function getName(): string { |
|
32 | + return $this->data->getName() . '.d' . $this->getLastModified(); |
|
33 | + } |
|
34 | 34 | } |
@@ -36,24 +36,24 @@ |
||
36 | 36 | */ |
37 | 37 | class LoginFailedEvent extends Event { |
38 | 38 | |
39 | - /** @var string */ |
|
40 | - private $uid; |
|
41 | - |
|
42 | - /** |
|
43 | - * @since 19.0.0 |
|
44 | - */ |
|
45 | - public function __construct(string $uid) { |
|
46 | - parent::__construct(); |
|
47 | - |
|
48 | - $this->uid = $uid; |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * returns the uid of the user that was tried to login against |
|
53 | - * |
|
54 | - * @since 19.0.0 |
|
55 | - */ |
|
56 | - public function getUid(): string { |
|
57 | - return $this->uid; |
|
58 | - } |
|
39 | + /** @var string */ |
|
40 | + private $uid; |
|
41 | + |
|
42 | + /** |
|
43 | + * @since 19.0.0 |
|
44 | + */ |
|
45 | + public function __construct(string $uid) { |
|
46 | + parent::__construct(); |
|
47 | + |
|
48 | + $this->uid = $uid; |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * returns the uid of the user that was tried to login against |
|
53 | + * |
|
54 | + * @since 19.0.0 |
|
55 | + */ |
|
56 | + public function getUid(): string { |
|
57 | + return $this->uid; |
|
58 | + } |
|
59 | 59 | } |
@@ -53,52 +53,52 @@ |
||
53 | 53 | abstract class AFilesDocument extends IndexDocument { |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Returns the owner of the document/file. |
|
58 | - * |
|
59 | - * @since 15.0.0 |
|
60 | - * |
|
61 | - * @return string |
|
62 | - */ |
|
63 | - abstract public function getOwnerId(): string; |
|
56 | + /** |
|
57 | + * Returns the owner of the document/file. |
|
58 | + * |
|
59 | + * @since 15.0.0 |
|
60 | + * |
|
61 | + * @return string |
|
62 | + */ |
|
63 | + abstract public function getOwnerId(): string; |
|
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * Returns the current viewer of the document/file. |
|
68 | - * |
|
69 | - * @since 15.0.0 |
|
70 | - * |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - abstract public function getViewerId(): string; |
|
66 | + /** |
|
67 | + * Returns the current viewer of the document/file. |
|
68 | + * |
|
69 | + * @since 15.0.0 |
|
70 | + * |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + abstract public function getViewerId(): string; |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * Returns the type of the document/file. |
|
78 | - * |
|
79 | - * @since 15.0.0 |
|
80 | - * |
|
81 | - * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER |
|
82 | - */ |
|
83 | - abstract public function getType(): string; |
|
76 | + /** |
|
77 | + * Returns the type of the document/file. |
|
78 | + * |
|
79 | + * @since 15.0.0 |
|
80 | + * |
|
81 | + * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER |
|
82 | + */ |
|
83 | + abstract public function getType(): string; |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * Returns the mimetype of the document/file. |
|
88 | - * |
|
89 | - * @since 15.0.0 |
|
90 | - * |
|
91 | - * @return string |
|
92 | - */ |
|
93 | - abstract public function getMimetype(): string; |
|
86 | + /** |
|
87 | + * Returns the mimetype of the document/file. |
|
88 | + * |
|
89 | + * @since 15.0.0 |
|
90 | + * |
|
91 | + * @return string |
|
92 | + */ |
|
93 | + abstract public function getMimetype(): string; |
|
94 | 94 | |
95 | - /** |
|
96 | - * Returns the path of the document/file. |
|
97 | - * |
|
98 | - * @since 15.0.0 |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - abstract public function getPath(): string; |
|
95 | + /** |
|
96 | + * Returns the path of the document/file. |
|
97 | + * |
|
98 | + * @since 15.0.0 |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + abstract public function getPath(): string; |
|
103 | 103 | |
104 | 104 | } |