@@ -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 | } |
@@ -28,11 +28,11 @@ |
||
28 | 28 | namespace OC\Authentication\Token; |
29 | 29 | |
30 | 30 | interface INamedToken extends IToken { |
31 | - /** |
|
32 | - * Set token name |
|
33 | - * |
|
34 | - * @param string $name |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - public function setName(string $name): void; |
|
31 | + /** |
|
32 | + * Set token name |
|
33 | + * |
|
34 | + * @param string $name |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + public function setName(string $name): void; |
|
38 | 38 | } |
@@ -32,37 +32,37 @@ |
||
32 | 32 | |
33 | 33 | class RegisterRegenerateBirthdayCalendars extends QueuedJob { |
34 | 34 | |
35 | - /** @var IUserManager */ |
|
36 | - private $userManager; |
|
35 | + /** @var IUserManager */ |
|
36 | + private $userManager; |
|
37 | 37 | |
38 | - /** @var IJobList */ |
|
39 | - private $jobList; |
|
38 | + /** @var IJobList */ |
|
39 | + private $jobList; |
|
40 | 40 | |
41 | - /** |
|
42 | - * RegisterRegenerateBirthdayCalendars constructor. |
|
43 | - * |
|
44 | - * @param ITimeFactory $time |
|
45 | - * @param IUserManager $userManager |
|
46 | - * @param IJobList $jobList |
|
47 | - */ |
|
48 | - public function __construct(ITimeFactory $time, |
|
49 | - IUserManager $userManager, |
|
50 | - IJobList $jobList) { |
|
51 | - parent::__construct($time); |
|
52 | - $this->userManager = $userManager; |
|
53 | - $this->jobList = $jobList; |
|
54 | - } |
|
41 | + /** |
|
42 | + * RegisterRegenerateBirthdayCalendars constructor. |
|
43 | + * |
|
44 | + * @param ITimeFactory $time |
|
45 | + * @param IUserManager $userManager |
|
46 | + * @param IJobList $jobList |
|
47 | + */ |
|
48 | + public function __construct(ITimeFactory $time, |
|
49 | + IUserManager $userManager, |
|
50 | + IJobList $jobList) { |
|
51 | + parent::__construct($time); |
|
52 | + $this->userManager = $userManager; |
|
53 | + $this->jobList = $jobList; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @inheritDoc |
|
58 | - */ |
|
59 | - public function run($argument) { |
|
60 | - $this->userManager->callForSeenUsers(function (IUser $user) { |
|
61 | - $this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [ |
|
62 | - 'userId' => $user->getUID(), |
|
63 | - 'purgeBeforeGenerating' => true |
|
64 | - ]); |
|
65 | - }); |
|
66 | - } |
|
56 | + /** |
|
57 | + * @inheritDoc |
|
58 | + */ |
|
59 | + public function run($argument) { |
|
60 | + $this->userManager->callForSeenUsers(function (IUser $user) { |
|
61 | + $this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [ |
|
62 | + 'userId' => $user->getUID(), |
|
63 | + 'purgeBeforeGenerating' => true |
|
64 | + ]); |
|
65 | + }); |
|
66 | + } |
|
67 | 67 | |
68 | 68 | } |
@@ -33,33 +33,33 @@ |
||
33 | 33 | * Verify that the public link share is valid |
34 | 34 | */ |
35 | 35 | class PublicLinkCheckPlugin extends ServerPlugin { |
36 | - /** |
|
37 | - * @var FileInfo |
|
38 | - */ |
|
39 | - private $fileInfo; |
|
36 | + /** |
|
37 | + * @var FileInfo |
|
38 | + */ |
|
39 | + private $fileInfo; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param FileInfo $fileInfo |
|
43 | - */ |
|
44 | - public function setFileInfo($fileInfo) { |
|
45 | - $this->fileInfo = $fileInfo; |
|
46 | - } |
|
41 | + /** |
|
42 | + * @param FileInfo $fileInfo |
|
43 | + */ |
|
44 | + public function setFileInfo($fileInfo) { |
|
45 | + $this->fileInfo = $fileInfo; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * This initializes the plugin. |
|
50 | - * |
|
51 | - * @param \Sabre\DAV\Server $server Sabre server |
|
52 | - * |
|
53 | - * @return void |
|
54 | - */ |
|
55 | - public function initialize(\Sabre\DAV\Server $server) { |
|
56 | - $server->on('beforeMethod:*', [$this, 'beforeMethod']); |
|
57 | - } |
|
48 | + /** |
|
49 | + * This initializes the plugin. |
|
50 | + * |
|
51 | + * @param \Sabre\DAV\Server $server Sabre server |
|
52 | + * |
|
53 | + * @return void |
|
54 | + */ |
|
55 | + public function initialize(\Sabre\DAV\Server $server) { |
|
56 | + $server->on('beforeMethod:*', [$this, 'beforeMethod']); |
|
57 | + } |
|
58 | 58 | |
59 | - public function beforeMethod(RequestInterface $request, ResponseInterface $response) { |
|
60 | - // verify that the owner didn't have his share permissions revoked |
|
61 | - if ($this->fileInfo && !$this->fileInfo->isShareable()) { |
|
62 | - throw new NotFound(); |
|
63 | - } |
|
64 | - } |
|
59 | + public function beforeMethod(RequestInterface $request, ResponseInterface $response) { |
|
60 | + // verify that the owner didn't have his share permissions revoked |
|
61 | + if ($this->fileInfo && !$this->fileInfo->isShareable()) { |
|
62 | + throw new NotFound(); |
|
63 | + } |
|
64 | + } |
|
65 | 65 | } |
@@ -35,35 +35,35 @@ |
||
35 | 35 | * @since 8.1.0 |
36 | 36 | */ |
37 | 37 | class StreamResponse extends Response implements ICallbackResponse { |
38 | - /** @var string */ |
|
39 | - private $filePath; |
|
38 | + /** @var string */ |
|
39 | + private $filePath; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param string|resource $filePath the path to the file or a file handle which should be streamed |
|
43 | - * @since 8.1.0 |
|
44 | - */ |
|
45 | - public function __construct($filePath) { |
|
46 | - parent::__construct(); |
|
41 | + /** |
|
42 | + * @param string|resource $filePath the path to the file or a file handle which should be streamed |
|
43 | + * @since 8.1.0 |
|
44 | + */ |
|
45 | + public function __construct($filePath) { |
|
46 | + parent::__construct(); |
|
47 | 47 | |
48 | - $this->filePath = $filePath; |
|
49 | - } |
|
48 | + $this->filePath = $filePath; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Streams the file using readfile |
|
54 | - * |
|
55 | - * @param IOutput $output a small wrapper that handles output |
|
56 | - * @since 8.1.0 |
|
57 | - */ |
|
58 | - public function callback(IOutput $output) { |
|
59 | - // handle caching |
|
60 | - if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { |
|
61 | - if (!(is_resource($this->filePath) || file_exists($this->filePath))) { |
|
62 | - $output->setHttpResponseCode(Http::STATUS_NOT_FOUND); |
|
63 | - } elseif ($output->setReadfile($this->filePath) === false) { |
|
64 | - $output->setHttpResponseCode(Http::STATUS_BAD_REQUEST); |
|
65 | - } |
|
66 | - } |
|
67 | - } |
|
52 | + /** |
|
53 | + * Streams the file using readfile |
|
54 | + * |
|
55 | + * @param IOutput $output a small wrapper that handles output |
|
56 | + * @since 8.1.0 |
|
57 | + */ |
|
58 | + public function callback(IOutput $output) { |
|
59 | + // handle caching |
|
60 | + if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) { |
|
61 | + if (!(is_resource($this->filePath) || file_exists($this->filePath))) { |
|
62 | + $output->setHttpResponseCode(Http::STATUS_NOT_FOUND); |
|
63 | + } elseif ($output->setReadfile($this->filePath) === false) { |
|
64 | + $output->setHttpResponseCode(Http::STATUS_BAD_REQUEST); |
|
65 | + } |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | 69 | } |
@@ -34,43 +34,43 @@ |
||
34 | 34 | * @since 8.0.0 |
35 | 35 | */ |
36 | 36 | interface IQueryLogger extends SQLLogger { |
37 | - /** |
|
38 | - * Mark the start of a query providing query SQL statement, its parameters and types. |
|
39 | - * This method should be called as close to the DB as possible and after |
|
40 | - * query is finished finalized with stopQuery() method. |
|
41 | - * |
|
42 | - * @param string $sql |
|
43 | - * @param array|null $params |
|
44 | - * @param array|null $types |
|
45 | - * @since 8.0.0 |
|
46 | - */ |
|
47 | - public function startQuery($sql, array $params = null, array $types = null); |
|
37 | + /** |
|
38 | + * Mark the start of a query providing query SQL statement, its parameters and types. |
|
39 | + * This method should be called as close to the DB as possible and after |
|
40 | + * query is finished finalized with stopQuery() method. |
|
41 | + * |
|
42 | + * @param string $sql |
|
43 | + * @param array|null $params |
|
44 | + * @param array|null $types |
|
45 | + * @since 8.0.0 |
|
46 | + */ |
|
47 | + public function startQuery($sql, array $params = null, array $types = null); |
|
48 | 48 | |
49 | - /** |
|
50 | - * Mark the end of the current active query. Ending query should store \OCP\Diagnostics\IQuery to |
|
51 | - * be returned with getQueries() method. |
|
52 | - * |
|
53 | - * @return mixed |
|
54 | - * @since 8.0.0 |
|
55 | - */ |
|
56 | - public function stopQuery(); |
|
49 | + /** |
|
50 | + * Mark the end of the current active query. Ending query should store \OCP\Diagnostics\IQuery to |
|
51 | + * be returned with getQueries() method. |
|
52 | + * |
|
53 | + * @return mixed |
|
54 | + * @since 8.0.0 |
|
55 | + */ |
|
56 | + public function stopQuery(); |
|
57 | 57 | |
58 | - /** |
|
59 | - * This method should return all \OCP\Diagnostics\IQuery objects stored using |
|
60 | - * startQuery()/stopQuery() methods. |
|
61 | - * |
|
62 | - * @return \OCP\Diagnostics\IQuery[] |
|
63 | - * @since 8.0.0 |
|
64 | - */ |
|
65 | - public function getQueries(); |
|
58 | + /** |
|
59 | + * This method should return all \OCP\Diagnostics\IQuery objects stored using |
|
60 | + * startQuery()/stopQuery() methods. |
|
61 | + * |
|
62 | + * @return \OCP\Diagnostics\IQuery[] |
|
63 | + * @since 8.0.0 |
|
64 | + */ |
|
65 | + public function getQueries(); |
|
66 | 66 | |
67 | - /** |
|
68 | - * Activate the module for the duration of the request. Deactivated module |
|
69 | - * does not create and store \OCP\Diagnostics\IQuery objects. |
|
70 | - * Only activated module should create and store objects to be |
|
71 | - * returned with getQueries() call. |
|
72 | - * |
|
73 | - * @since 12.0.0 |
|
74 | - */ |
|
75 | - public function activate(); |
|
67 | + /** |
|
68 | + * Activate the module for the duration of the request. Deactivated module |
|
69 | + * does not create and store \OCP\Diagnostics\IQuery objects. |
|
70 | + * Only activated module should create and store objects to be |
|
71 | + * returned with getQueries() call. |
|
72 | + * |
|
73 | + * @since 12.0.0 |
|
74 | + */ |
|
75 | + public function activate(); |
|
76 | 76 | } |