@@ -32,10 +32,10 @@ |
||
32 | 32 | * @since 18.0.0 |
33 | 33 | */ |
34 | 34 | interface IDisplayName { |
35 | - /** |
|
36 | - * returns the end user facing name of the object related to the entity |
|
37 | - * |
|
38 | - * @since 18.0.0 |
|
39 | - */ |
|
40 | - public function getDisplayName(): string; |
|
35 | + /** |
|
36 | + * returns the end user facing name of the object related to the entity |
|
37 | + * |
|
38 | + * @since 18.0.0 |
|
39 | + */ |
|
40 | + public function getDisplayName(): string; |
|
41 | 41 | } |
@@ -32,11 +32,11 @@ |
||
32 | 32 | * @since 18.0.0 |
33 | 33 | */ |
34 | 34 | interface IIcon { |
35 | - /** |
|
36 | - * returns a URL to an icon that is related to the entity, for instance |
|
37 | - * a group icon for groups. |
|
38 | - * |
|
39 | - * @since 18.0.0 |
|
40 | - */ |
|
41 | - public function getIconUrl(): string; |
|
35 | + /** |
|
36 | + * returns a URL to an icon that is related to the entity, for instance |
|
37 | + * a group icon for groups. |
|
38 | + * |
|
39 | + * @since 18.0.0 |
|
40 | + */ |
|
41 | + public function getIconUrl(): string; |
|
42 | 42 | } |
@@ -37,24 +37,24 @@ |
||
37 | 37 | * @method string getNodeName() |
38 | 38 | */ |
39 | 39 | class TransferOwnership extends Entity { |
40 | - /** @var string */ |
|
41 | - protected $sourceUser; |
|
40 | + /** @var string */ |
|
41 | + protected $sourceUser; |
|
42 | 42 | |
43 | - /** @var string */ |
|
44 | - protected $targetUser; |
|
43 | + /** @var string */ |
|
44 | + protected $targetUser; |
|
45 | 45 | |
46 | - /** @var integer */ |
|
47 | - protected $fileId; |
|
46 | + /** @var integer */ |
|
47 | + protected $fileId; |
|
48 | 48 | |
49 | - /** @var string */ |
|
50 | - protected $nodeName; |
|
49 | + /** @var string */ |
|
50 | + protected $nodeName; |
|
51 | 51 | |
52 | - public function __construct() { |
|
53 | - $this->addType('sourceUser', 'string'); |
|
54 | - $this->addType('targetUser', 'string'); |
|
55 | - $this->addType('fileId', 'integer'); |
|
56 | - $this->addType('nodeName', 'string'); |
|
57 | - } |
|
52 | + public function __construct() { |
|
53 | + $this->addType('sourceUser', 'string'); |
|
54 | + $this->addType('targetUser', 'string'); |
|
55 | + $this->addType('fileId', 'integer'); |
|
56 | + $this->addType('nodeName', 'string'); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | |
60 | 60 | } |
@@ -35,63 +35,63 @@ |
||
35 | 35 | |
36 | 36 | class Notifier implements INotifier { |
37 | 37 | |
38 | - /** @var IFactory */ |
|
39 | - private $factory; |
|
40 | - |
|
41 | - /** @var IURLGenerator */ |
|
42 | - private $url; |
|
43 | - |
|
44 | - public function __construct(IFactory $factory, IURLGenerator $url) { |
|
45 | - $this->factory = $factory; |
|
46 | - $this->url = $url; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * Identifier of the notifier, only use [a-z0-9_] |
|
51 | - * |
|
52 | - * @return string |
|
53 | - * @since 17.0.0 |
|
54 | - */ |
|
55 | - public function getID(): string { |
|
56 | - return 'twofactor_backupcodes'; |
|
57 | - } |
|
58 | - |
|
59 | - /** |
|
60 | - * Human readable name describing the notifier |
|
61 | - * |
|
62 | - * @return string |
|
63 | - * @since 17.0.0 |
|
64 | - */ |
|
65 | - public function getName(): string { |
|
66 | - return $this->factory->get('twofactor_backupcodes')->t('Second-factor backup codes'); |
|
67 | - } |
|
68 | - |
|
69 | - public function prepare(INotification $notification, string $languageCode): INotification { |
|
70 | - if ($notification->getApp() !== 'twofactor_backupcodes') { |
|
71 | - // Not my app => throw |
|
72 | - throw new \InvalidArgumentException(); |
|
73 | - } |
|
74 | - |
|
75 | - // Read the language from the notification |
|
76 | - $l = $this->factory->get('twofactor_backupcodes', $languageCode); |
|
77 | - |
|
78 | - switch ($notification->getSubject()) { |
|
79 | - case 'create_backupcodes': |
|
80 | - $notification->setParsedSubject( |
|
81 | - $l->t('Generate backup codes') |
|
82 | - )->setParsedMessage( |
|
83 | - $l->t('You enabled two-factor authentication but did not generate backup codes yet. They are needed to restore access to your account in case you lose your second factor.') |
|
84 | - ); |
|
85 | - |
|
86 | - $notification->setLink($this->url->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'security'])); |
|
87 | - |
|
88 | - $notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/password.svg'))); |
|
89 | - |
|
90 | - return $notification; |
|
91 | - |
|
92 | - default: |
|
93 | - // Unknown subject => Unknown notification => throw |
|
94 | - throw new \InvalidArgumentException(); |
|
95 | - } |
|
96 | - } |
|
38 | + /** @var IFactory */ |
|
39 | + private $factory; |
|
40 | + |
|
41 | + /** @var IURLGenerator */ |
|
42 | + private $url; |
|
43 | + |
|
44 | + public function __construct(IFactory $factory, IURLGenerator $url) { |
|
45 | + $this->factory = $factory; |
|
46 | + $this->url = $url; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * Identifier of the notifier, only use [a-z0-9_] |
|
51 | + * |
|
52 | + * @return string |
|
53 | + * @since 17.0.0 |
|
54 | + */ |
|
55 | + public function getID(): string { |
|
56 | + return 'twofactor_backupcodes'; |
|
57 | + } |
|
58 | + |
|
59 | + /** |
|
60 | + * Human readable name describing the notifier |
|
61 | + * |
|
62 | + * @return string |
|
63 | + * @since 17.0.0 |
|
64 | + */ |
|
65 | + public function getName(): string { |
|
66 | + return $this->factory->get('twofactor_backupcodes')->t('Second-factor backup codes'); |
|
67 | + } |
|
68 | + |
|
69 | + public function prepare(INotification $notification, string $languageCode): INotification { |
|
70 | + if ($notification->getApp() !== 'twofactor_backupcodes') { |
|
71 | + // Not my app => throw |
|
72 | + throw new \InvalidArgumentException(); |
|
73 | + } |
|
74 | + |
|
75 | + // Read the language from the notification |
|
76 | + $l = $this->factory->get('twofactor_backupcodes', $languageCode); |
|
77 | + |
|
78 | + switch ($notification->getSubject()) { |
|
79 | + case 'create_backupcodes': |
|
80 | + $notification->setParsedSubject( |
|
81 | + $l->t('Generate backup codes') |
|
82 | + )->setParsedMessage( |
|
83 | + $l->t('You enabled two-factor authentication but did not generate backup codes yet. They are needed to restore access to your account in case you lose your second factor.') |
|
84 | + ); |
|
85 | + |
|
86 | + $notification->setLink($this->url->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'security'])); |
|
87 | + |
|
88 | + $notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/password.svg'))); |
|
89 | + |
|
90 | + return $notification; |
|
91 | + |
|
92 | + default: |
|
93 | + // Unknown subject => Unknown notification => throw |
|
94 | + throw new \InvalidArgumentException(); |
|
95 | + } |
|
96 | + } |
|
97 | 97 | } |
@@ -31,47 +31,47 @@ |
||
31 | 31 | |
32 | 32 | class Version11301Date20191205150729 extends SimpleMigrationStep { |
33 | 33 | |
34 | - /** |
|
35 | - * @param IOutput $output |
|
36 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
37 | - * @param array $options |
|
38 | - * @return null|ISchemaWrapper |
|
39 | - */ |
|
40 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
41 | - /** @var ISchemaWrapper $schema */ |
|
42 | - $schema = $schemaClosure(); |
|
34 | + /** |
|
35 | + * @param IOutput $output |
|
36 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
37 | + * @param array $options |
|
38 | + * @return null|ISchemaWrapper |
|
39 | + */ |
|
40 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
41 | + /** @var ISchemaWrapper $schema */ |
|
42 | + $schema = $schemaClosure(); |
|
43 | 43 | |
44 | - $table = $schema->createTable('user_transfer_owner'); |
|
45 | - $table->addColumn('id', 'bigint', [ |
|
46 | - 'autoincrement' => true, |
|
47 | - 'notnull' => true, |
|
48 | - 'length' => 20, |
|
49 | - 'unsigned' => true, |
|
50 | - ]); |
|
51 | - $table->addColumn('source_user', 'string', [ |
|
52 | - 'notnull' => true, |
|
53 | - 'length' => 64, |
|
54 | - ]); |
|
55 | - $table->addColumn('target_user', 'string', [ |
|
56 | - 'notnull' => true, |
|
57 | - 'length' => 64, |
|
58 | - ]); |
|
59 | - $table->addColumn('file_id', 'bigint', [ |
|
60 | - 'notnull' => true, |
|
61 | - 'length' => 20, |
|
62 | - ]); |
|
63 | - $table->addColumn('node_name', 'string', [ |
|
64 | - 'notnull' => true, |
|
65 | - 'length' => 255, |
|
66 | - ]); |
|
67 | - $table->setPrimaryKey(['id']); |
|
44 | + $table = $schema->createTable('user_transfer_owner'); |
|
45 | + $table->addColumn('id', 'bigint', [ |
|
46 | + 'autoincrement' => true, |
|
47 | + 'notnull' => true, |
|
48 | + 'length' => 20, |
|
49 | + 'unsigned' => true, |
|
50 | + ]); |
|
51 | + $table->addColumn('source_user', 'string', [ |
|
52 | + 'notnull' => true, |
|
53 | + 'length' => 64, |
|
54 | + ]); |
|
55 | + $table->addColumn('target_user', 'string', [ |
|
56 | + 'notnull' => true, |
|
57 | + 'length' => 64, |
|
58 | + ]); |
|
59 | + $table->addColumn('file_id', 'bigint', [ |
|
60 | + 'notnull' => true, |
|
61 | + 'length' => 20, |
|
62 | + ]); |
|
63 | + $table->addColumn('node_name', 'string', [ |
|
64 | + 'notnull' => true, |
|
65 | + 'length' => 255, |
|
66 | + ]); |
|
67 | + $table->setPrimaryKey(['id']); |
|
68 | 68 | |
69 | - // Quite radical, we just assume no one updates cross beta with a pending request. |
|
70 | - // Do not try this at home |
|
71 | - if ($schema->hasTable('user_transfer_ownership')) { |
|
72 | - $schema->dropTable('user_transfer_ownership'); |
|
73 | - } |
|
69 | + // Quite radical, we just assume no one updates cross beta with a pending request. |
|
70 | + // Do not try this at home |
|
71 | + if ($schema->hasTable('user_transfer_ownership')) { |
|
72 | + $schema->dropTable('user_transfer_ownership'); |
|
73 | + } |
|
74 | 74 | |
75 | - return $schema; |
|
76 | - } |
|
75 | + return $schema; |
|
76 | + } |
|
77 | 77 | } |
@@ -27,5 +27,5 @@ |
||
27 | 27 | * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher |
28 | 28 | */ |
29 | 29 | abstract class BasicEmitter implements Emitter { |
30 | - use EmitterTrait; |
|
30 | + use EmitterTrait; |
|
31 | 31 | } |
@@ -36,12 +36,12 @@ |
||
36 | 36 | * @since 18.0.0 |
37 | 37 | */ |
38 | 38 | interface IFileCheck extends IEntityCheck { |
39 | - /** |
|
40 | - * @param IStorage $storage |
|
41 | - * @param string $path |
|
42 | - * @param bool $isDir |
|
43 | - * @since 18.0.0 |
|
44 | - */ |
|
45 | - public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void; |
|
39 | + /** |
|
40 | + * @param IStorage $storage |
|
41 | + * @param string $path |
|
42 | + * @param bool $isDir |
|
43 | + * @since 18.0.0 |
|
44 | + */ |
|
45 | + public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void; |
|
46 | 46 | |
47 | 47 | } |
@@ -31,40 +31,40 @@ |
||
31 | 31 | use OCP\WorkflowEngine\IEntity; |
32 | 32 | |
33 | 33 | trait TFileCheck { |
34 | - /** @var IStorage */ |
|
35 | - protected $storage; |
|
34 | + /** @var IStorage */ |
|
35 | + protected $storage; |
|
36 | 36 | |
37 | - /** @var string */ |
|
38 | - protected $path; |
|
37 | + /** @var string */ |
|
38 | + protected $path; |
|
39 | 39 | |
40 | - /** @var bool */ |
|
41 | - protected $isDir; |
|
40 | + /** @var bool */ |
|
41 | + protected $isDir; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param IStorage $storage |
|
45 | - * @param string $path |
|
46 | - * @param bool $isDir |
|
47 | - * @since 18.0.0 |
|
48 | - */ |
|
49 | - public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void { |
|
50 | - $this->storage = $storage; |
|
51 | - $this->path = $path; |
|
52 | - $this->isDir = $isDir; |
|
53 | - } |
|
43 | + /** |
|
44 | + * @param IStorage $storage |
|
45 | + * @param string $path |
|
46 | + * @param bool $isDir |
|
47 | + * @since 18.0.0 |
|
48 | + */ |
|
49 | + public function setFileInfo(IStorage $storage, string $path, bool $isDir = false): void { |
|
50 | + $this->storage = $storage; |
|
51 | + $this->path = $path; |
|
52 | + $this->isDir = $isDir; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @throws \OCP\Files\NotFoundException |
|
57 | - */ |
|
58 | - public function setEntitySubject(IEntity $entity, $subject): void { |
|
59 | - if ($entity instanceof File) { |
|
60 | - if (!$subject instanceof Node) { |
|
61 | - throw new \UnexpectedValueException( |
|
62 | - 'Expected Node subject for File entity, got {class}', |
|
63 | - ['app' => Application::APP_ID, 'class' => get_class($subject)] |
|
64 | - ); |
|
65 | - } |
|
66 | - $this->storage = $subject->getStorage(); |
|
67 | - $this->path = $subject->getPath(); |
|
68 | - } |
|
69 | - } |
|
55 | + /** |
|
56 | + * @throws \OCP\Files\NotFoundException |
|
57 | + */ |
|
58 | + public function setEntitySubject(IEntity $entity, $subject): void { |
|
59 | + if ($entity instanceof File) { |
|
60 | + if (!$subject instanceof Node) { |
|
61 | + throw new \UnexpectedValueException( |
|
62 | + 'Expected Node subject for File entity, got {class}', |
|
63 | + ['app' => Application::APP_ID, 'class' => get_class($subject)] |
|
64 | + ); |
|
65 | + } |
|
66 | + $this->storage = $subject->getStorage(); |
|
67 | + $this->path = $subject->getPath(); |
|
68 | + } |
|
69 | + } |
|
70 | 70 | } |
@@ -37,47 +37,47 @@ |
||
37 | 37 | |
38 | 38 | class AcceptController extends Controller { |
39 | 39 | |
40 | - /** @var ShareManager */ |
|
41 | - private $shareManager; |
|
40 | + /** @var ShareManager */ |
|
41 | + private $shareManager; |
|
42 | 42 | |
43 | - /** @var IUserSession */ |
|
44 | - private $userSession; |
|
43 | + /** @var IUserSession */ |
|
44 | + private $userSession; |
|
45 | 45 | |
46 | - /** @var IURLGenerator */ |
|
47 | - private $urlGenerator; |
|
46 | + /** @var IURLGenerator */ |
|
47 | + private $urlGenerator; |
|
48 | 48 | |
49 | - public function __construct(IRequest $request, ShareManager $shareManager, IUserSession $userSession, IURLGenerator $urlGenerator) { |
|
50 | - parent::__construct(Application::APP_ID, $request); |
|
49 | + public function __construct(IRequest $request, ShareManager $shareManager, IUserSession $userSession, IURLGenerator $urlGenerator) { |
|
50 | + parent::__construct(Application::APP_ID, $request); |
|
51 | 51 | |
52 | - $this->shareManager = $shareManager; |
|
53 | - $this->userSession = $userSession; |
|
54 | - $this->urlGenerator = $urlGenerator; |
|
55 | - } |
|
52 | + $this->shareManager = $shareManager; |
|
53 | + $this->userSession = $userSession; |
|
54 | + $this->urlGenerator = $urlGenerator; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @NoAdminRequired |
|
59 | - * @NoCSRFRequired |
|
60 | - */ |
|
61 | - public function accept(string $shareId): Response { |
|
62 | - try { |
|
63 | - $share = $this->shareManager->getShareById($shareId); |
|
64 | - } catch (ShareNotFound $e) { |
|
65 | - return new NotFoundResponse(); |
|
66 | - } |
|
57 | + /** |
|
58 | + * @NoAdminRequired |
|
59 | + * @NoCSRFRequired |
|
60 | + */ |
|
61 | + public function accept(string $shareId): Response { |
|
62 | + try { |
|
63 | + $share = $this->shareManager->getShareById($shareId); |
|
64 | + } catch (ShareNotFound $e) { |
|
65 | + return new NotFoundResponse(); |
|
66 | + } |
|
67 | 67 | |
68 | - $user = $this->userSession->getUser(); |
|
69 | - if ($user === null) { |
|
70 | - return new NotFoundResponse(); |
|
71 | - } |
|
68 | + $user = $this->userSession->getUser(); |
|
69 | + if ($user === null) { |
|
70 | + return new NotFoundResponse(); |
|
71 | + } |
|
72 | 72 | |
73 | - try { |
|
74 | - $share = $this->shareManager->acceptShare($share, $user->getUID()); |
|
75 | - } catch (\Exception $e) { |
|
76 | - // Just ignore |
|
77 | - } |
|
73 | + try { |
|
74 | + $share = $this->shareManager->acceptShare($share, $user->getUID()); |
|
75 | + } catch (\Exception $e) { |
|
76 | + // Just ignore |
|
77 | + } |
|
78 | 78 | |
79 | - $url = $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]); |
|
79 | + $url = $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $share->getNode()->getId()]); |
|
80 | 80 | |
81 | - return new RedirectResponse($url); |
|
82 | - } |
|
81 | + return new RedirectResponse($url); |
|
82 | + } |
|
83 | 83 | } |