@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function getChildren(): array { |
| 79 | 79 | $versions = $this->versionManager->getVersionsForFile($this->user, $this->file); |
| 80 | 80 | |
| 81 | - return array_map(function (IVersion $version) { |
|
| 81 | + return array_map(function(IVersion $version) { |
|
| 82 | 82 | return new VersionFile($version, $this->versionManager); |
| 83 | 83 | }, $versions); |
| 84 | 84 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | public function getName(): string { |
| 100 | - return (string)$this->file->getId(); |
|
| 100 | + return (string) $this->file->getId(); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | public function setName($name) { |
@@ -18,64 +18,64 @@ |
||
| 18 | 18 | |
| 19 | 19 | class VersionCollection implements ICollection { |
| 20 | 20 | |
| 21 | - public function __construct( |
|
| 22 | - private File $file, |
|
| 23 | - private IUser $user, |
|
| 24 | - private IVersionManager $versionManager, |
|
| 25 | - ) { |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function createFile($name, $data = null) { |
|
| 29 | - throw new Forbidden(); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - public function createDirectory($name) { |
|
| 33 | - throw new Forbidden(); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - public function getChild($name) { |
|
| 37 | - /** @var VersionFile[] $versions */ |
|
| 38 | - $versions = $this->getChildren(); |
|
| 39 | - |
|
| 40 | - foreach ($versions as $version) { |
|
| 41 | - if ($version->getName() === $name) { |
|
| 42 | - return $version; |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - throw new NotFound(); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - public function getChildren(): array { |
|
| 50 | - $versions = $this->versionManager->getVersionsForFile($this->user, $this->file); |
|
| 51 | - |
|
| 52 | - return array_map(function (IVersion $version) { |
|
| 53 | - return new VersionFile($version, $this->versionManager); |
|
| 54 | - }, $versions); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - public function childExists($name): bool { |
|
| 58 | - try { |
|
| 59 | - $this->getChild($name); |
|
| 60 | - return true; |
|
| 61 | - } catch (NotFound $e) { |
|
| 62 | - return false; |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - public function delete() { |
|
| 67 | - throw new Forbidden(); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - public function getName(): string { |
|
| 71 | - return (string)$this->file->getId(); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - public function setName($name) { |
|
| 75 | - throw new Forbidden(); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - public function getLastModified(): int { |
|
| 79 | - return 0; |
|
| 80 | - } |
|
| 21 | + public function __construct( |
|
| 22 | + private File $file, |
|
| 23 | + private IUser $user, |
|
| 24 | + private IVersionManager $versionManager, |
|
| 25 | + ) { |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + public function createFile($name, $data = null) { |
|
| 29 | + throw new Forbidden(); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + public function createDirectory($name) { |
|
| 33 | + throw new Forbidden(); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + public function getChild($name) { |
|
| 37 | + /** @var VersionFile[] $versions */ |
|
| 38 | + $versions = $this->getChildren(); |
|
| 39 | + |
|
| 40 | + foreach ($versions as $version) { |
|
| 41 | + if ($version->getName() === $name) { |
|
| 42 | + return $version; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + throw new NotFound(); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + public function getChildren(): array { |
|
| 50 | + $versions = $this->versionManager->getVersionsForFile($this->user, $this->file); |
|
| 51 | + |
|
| 52 | + return array_map(function (IVersion $version) { |
|
| 53 | + return new VersionFile($version, $this->versionManager); |
|
| 54 | + }, $versions); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + public function childExists($name): bool { |
|
| 58 | + try { |
|
| 59 | + $this->getChild($name); |
|
| 60 | + return true; |
|
| 61 | + } catch (NotFound $e) { |
|
| 62 | + return false; |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + public function delete() { |
|
| 67 | + throw new Forbidden(); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + public function getName(): string { |
|
| 71 | + return (string)$this->file->getId(); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + public function setName($name) { |
|
| 75 | + throw new Forbidden(); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + public function getLastModified(): int { |
|
| 79 | + return 0; |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -32,18 +32,18 @@ |
||
| 32 | 32 | |
| 33 | 33 | class Version1008Date20181105112049 extends SimpleMigrationStep { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @param IOutput $output |
|
| 37 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 38 | - * @param array $options |
|
| 39 | - * @return null|ISchemaWrapper |
|
| 40 | - */ |
|
| 41 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 42 | - /** @var ISchemaWrapper $schema */ |
|
| 43 | - $schema = $schemaClosure(); |
|
| 44 | - $table = $schema->getTable('calendarsubscriptions'); |
|
| 45 | - $table->dropColumn('source_copy'); |
|
| 35 | + /** |
|
| 36 | + * @param IOutput $output |
|
| 37 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 38 | + * @param array $options |
|
| 39 | + * @return null|ISchemaWrapper |
|
| 40 | + */ |
|
| 41 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 42 | + /** @var ISchemaWrapper $schema */ |
|
| 43 | + $schema = $schemaClosure(); |
|
| 44 | + $table = $schema->getTable('calendarsubscriptions'); |
|
| 45 | + $table->dropColumn('source_copy'); |
|
| 46 | 46 | |
| 47 | - return $schema; |
|
| 48 | - } |
|
| 47 | + return $schema; |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -32,18 +32,18 @@ |
||
| 32 | 32 | |
| 33 | 33 | class Version1008Date20181105104833 extends SimpleMigrationStep { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @param IOutput $output |
|
| 37 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 38 | - * @param array $options |
|
| 39 | - * @return null|ISchemaWrapper |
|
| 40 | - */ |
|
| 41 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 42 | - /** @var ISchemaWrapper $schema */ |
|
| 43 | - $schema = $schemaClosure(); |
|
| 44 | - $table = $schema->getTable('calendarsubscriptions'); |
|
| 45 | - $table->dropColumn('source'); |
|
| 35 | + /** |
|
| 36 | + * @param IOutput $output |
|
| 37 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 38 | + * @param array $options |
|
| 39 | + * @return null|ISchemaWrapper |
|
| 40 | + */ |
|
| 41 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 42 | + /** @var ISchemaWrapper $schema */ |
|
| 43 | + $schema = $schemaClosure(); |
|
| 44 | + $table = $schema->getTable('calendarsubscriptions'); |
|
| 45 | + $table->dropColumn('source'); |
|
| 46 | 46 | |
| 47 | - return $schema; |
|
| 48 | - } |
|
| 47 | + return $schema; |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -33,27 +33,27 @@ |
||
| 33 | 33 | class Version1008Date20181114084440 extends SimpleMigrationStep { |
| 34 | 34 | |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param IOutput $output |
|
| 38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | - * @param array $options |
|
| 40 | - * @return null|ISchemaWrapper |
|
| 41 | - */ |
|
| 42 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 43 | - /** @var ISchemaWrapper $schema */ |
|
| 44 | - $schema = $schemaClosure(); |
|
| 45 | - |
|
| 46 | - if ($schema->hasTable('calendarchanges')) { |
|
| 47 | - $calendarChangesTable = $schema->getTable('calendarchanges'); |
|
| 48 | - if ($calendarChangesTable->hasIndex('calendarid_calendartype_synctoken')) { |
|
| 49 | - $calendarChangesTable->dropIndex('calendarid_calendartype_synctoken'); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - if (!$calendarChangesTable->hasIndex('calid_type_synctoken')) { |
|
| 53 | - $calendarChangesTable->addIndex(['calendarid', 'calendartype', 'synctoken'], 'calid_type_synctoken'); |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - return $schema; |
|
| 58 | - } |
|
| 36 | + /** |
|
| 37 | + * @param IOutput $output |
|
| 38 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | + * @param array $options |
|
| 40 | + * @return null|ISchemaWrapper |
|
| 41 | + */ |
|
| 42 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 43 | + /** @var ISchemaWrapper $schema */ |
|
| 44 | + $schema = $schemaClosure(); |
|
| 45 | + |
|
| 46 | + if ($schema->hasTable('calendarchanges')) { |
|
| 47 | + $calendarChangesTable = $schema->getTable('calendarchanges'); |
|
| 48 | + if ($calendarChangesTable->hasIndex('calendarid_calendartype_synctoken')) { |
|
| 49 | + $calendarChangesTable->dropIndex('calendarid_calendartype_synctoken'); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + if (!$calendarChangesTable->hasIndex('calid_type_synctoken')) { |
|
| 53 | + $calendarChangesTable->addIndex(['calendarid', 'calendartype', 'synctoken'], 'calid_type_synctoken'); |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + return $schema; |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -31,68 +31,68 @@ |
||
| 31 | 31 | |
| 32 | 32 | class Version010401Date20181207190718 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 | - if (!$schema->hasTable('oauth2_clients')) { |
|
| 45 | - $table = $schema->createTable('oauth2_clients'); |
|
| 46 | - $table->addColumn('id', 'integer', [ |
|
| 47 | - 'autoincrement' => true, |
|
| 48 | - 'notnull' => true, |
|
| 49 | - 'unsigned' => true, |
|
| 50 | - ]); |
|
| 51 | - $table->addColumn('name', 'string', [ |
|
| 52 | - 'notnull' => true, |
|
| 53 | - 'length' => 64, |
|
| 54 | - ]); |
|
| 55 | - $table->addColumn('redirect_uri', 'string', [ |
|
| 56 | - 'notnull' => true, |
|
| 57 | - 'length' => 2000, |
|
| 58 | - ]); |
|
| 59 | - $table->addColumn('client_identifier', 'string', [ |
|
| 60 | - 'notnull' => true, |
|
| 61 | - 'length' => 64, |
|
| 62 | - ]); |
|
| 63 | - $table->addColumn('secret', 'string', [ |
|
| 64 | - 'notnull' => true, |
|
| 65 | - 'length' => 64, |
|
| 66 | - ]); |
|
| 67 | - $table->setPrimaryKey(['id']); |
|
| 68 | - $table->addIndex(['client_identifier'], 'oauth2_client_id_idx'); |
|
| 69 | - } |
|
| 44 | + if (!$schema->hasTable('oauth2_clients')) { |
|
| 45 | + $table = $schema->createTable('oauth2_clients'); |
|
| 46 | + $table->addColumn('id', 'integer', [ |
|
| 47 | + 'autoincrement' => true, |
|
| 48 | + 'notnull' => true, |
|
| 49 | + 'unsigned' => true, |
|
| 50 | + ]); |
|
| 51 | + $table->addColumn('name', 'string', [ |
|
| 52 | + 'notnull' => true, |
|
| 53 | + 'length' => 64, |
|
| 54 | + ]); |
|
| 55 | + $table->addColumn('redirect_uri', 'string', [ |
|
| 56 | + 'notnull' => true, |
|
| 57 | + 'length' => 2000, |
|
| 58 | + ]); |
|
| 59 | + $table->addColumn('client_identifier', 'string', [ |
|
| 60 | + 'notnull' => true, |
|
| 61 | + 'length' => 64, |
|
| 62 | + ]); |
|
| 63 | + $table->addColumn('secret', 'string', [ |
|
| 64 | + 'notnull' => true, |
|
| 65 | + 'length' => 64, |
|
| 66 | + ]); |
|
| 67 | + $table->setPrimaryKey(['id']); |
|
| 68 | + $table->addIndex(['client_identifier'], 'oauth2_client_id_idx'); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - if (!$schema->hasTable('oauth2_access_tokens')) { |
|
| 72 | - $table = $schema->createTable('oauth2_access_tokens'); |
|
| 73 | - $table->addColumn('id', 'integer', [ |
|
| 74 | - 'autoincrement' => true, |
|
| 75 | - 'notnull' => true, |
|
| 76 | - 'unsigned' => true, |
|
| 77 | - ]); |
|
| 78 | - $table->addColumn('token_id', 'integer', [ |
|
| 79 | - 'notnull' => true, |
|
| 80 | - ]); |
|
| 81 | - $table->addColumn('client_id', 'integer', [ |
|
| 82 | - 'notnull' => true, |
|
| 83 | - ]); |
|
| 84 | - $table->addColumn('hashed_code', 'string', [ |
|
| 85 | - 'notnull' => true, |
|
| 86 | - 'length' => 128, |
|
| 87 | - ]); |
|
| 88 | - $table->addColumn('encrypted_token', 'string', [ |
|
| 89 | - 'notnull' => true, |
|
| 90 | - 'length' => 786, |
|
| 91 | - ]); |
|
| 92 | - $table->setPrimaryKey(['id']); |
|
| 93 | - $table->addUniqueIndex(['hashed_code'], 'oauth2_access_hash_idx'); |
|
| 94 | - $table->addIndex(['client_id'], 'oauth2_access_client_id_idx'); |
|
| 95 | - } |
|
| 96 | - return $schema; |
|
| 97 | - } |
|
| 71 | + if (!$schema->hasTable('oauth2_access_tokens')) { |
|
| 72 | + $table = $schema->createTable('oauth2_access_tokens'); |
|
| 73 | + $table->addColumn('id', 'integer', [ |
|
| 74 | + 'autoincrement' => true, |
|
| 75 | + 'notnull' => true, |
|
| 76 | + 'unsigned' => true, |
|
| 77 | + ]); |
|
| 78 | + $table->addColumn('token_id', 'integer', [ |
|
| 79 | + 'notnull' => true, |
|
| 80 | + ]); |
|
| 81 | + $table->addColumn('client_id', 'integer', [ |
|
| 82 | + 'notnull' => true, |
|
| 83 | + ]); |
|
| 84 | + $table->addColumn('hashed_code', 'string', [ |
|
| 85 | + 'notnull' => true, |
|
| 86 | + 'length' => 128, |
|
| 87 | + ]); |
|
| 88 | + $table->addColumn('encrypted_token', 'string', [ |
|
| 89 | + 'notnull' => true, |
|
| 90 | + 'length' => 786, |
|
| 91 | + ]); |
|
| 92 | + $table->setPrimaryKey(['id']); |
|
| 93 | + $table->addUniqueIndex(['hashed_code'], 'oauth2_access_hash_idx'); |
|
| 94 | + $table->addIndex(['client_id'], 'oauth2_access_client_id_idx'); |
|
| 95 | + } |
|
| 96 | + return $schema; |
|
| 97 | + } |
|
| 98 | 98 | } |
@@ -89,8 +89,8 @@ |
||
| 89 | 89 | 'displayName' => $user->getDisplayName(), |
| 90 | 90 | 'uid' => $user->getUID(), |
| 91 | 91 | 'dn' => $user->getDN(), |
| 92 | - 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')), |
|
| 93 | - 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')), |
|
| 92 | + 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool) $input->getOption('short-date')), |
|
| 93 | + 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool) $input->getOption('short-date')), |
|
| 94 | 94 | 'homePath' => $user->getHomePath(), |
| 95 | 95 | 'sharer' => $user->getHasActiveShares() ? 'Y' : 'N', |
| 96 | 96 | ]; |
@@ -17,64 +17,64 @@ |
||
| 17 | 17 | use Symfony\Component\Console\Output\OutputInterface; |
| 18 | 18 | |
| 19 | 19 | class ShowRemnants extends Command { |
| 20 | - public function __construct( |
|
| 21 | - protected DeletedUsersIndex $dui, |
|
| 22 | - protected IDateTimeFormatter $dateFormatter, |
|
| 23 | - ) { |
|
| 24 | - parent::__construct(); |
|
| 25 | - } |
|
| 20 | + public function __construct( |
|
| 21 | + protected DeletedUsersIndex $dui, |
|
| 22 | + protected IDateTimeFormatter $dateFormatter, |
|
| 23 | + ) { |
|
| 24 | + parent::__construct(); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - protected function configure(): void { |
|
| 28 | - $this |
|
| 29 | - ->setName('ldap:show-remnants') |
|
| 30 | - ->setDescription('shows which users are not available on LDAP anymore, but have remnants in Nextcloud.') |
|
| 31 | - ->addOption('json', null, InputOption::VALUE_NONE, 'return JSON array instead of pretty table.') |
|
| 32 | - ->addOption('short-date', null, InputOption::VALUE_NONE, 'show dates in Y-m-d format'); |
|
| 33 | - } |
|
| 27 | + protected function configure(): void { |
|
| 28 | + $this |
|
| 29 | + ->setName('ldap:show-remnants') |
|
| 30 | + ->setDescription('shows which users are not available on LDAP anymore, but have remnants in Nextcloud.') |
|
| 31 | + ->addOption('json', null, InputOption::VALUE_NONE, 'return JSON array instead of pretty table.') |
|
| 32 | + ->addOption('short-date', null, InputOption::VALUE_NONE, 'show dates in Y-m-d format'); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - protected function formatDate(int $timestamp, string $default, bool $showShortDate): string { |
|
| 36 | - if (!($timestamp > 0)) { |
|
| 37 | - return $default; |
|
| 38 | - } |
|
| 39 | - if ($showShortDate) { |
|
| 40 | - return date('Y-m-d', $timestamp); |
|
| 41 | - } |
|
| 42 | - return $this->dateFormatter->formatDate($timestamp); |
|
| 43 | - } |
|
| 35 | + protected function formatDate(int $timestamp, string $default, bool $showShortDate): string { |
|
| 36 | + if (!($timestamp > 0)) { |
|
| 37 | + return $default; |
|
| 38 | + } |
|
| 39 | + if ($showShortDate) { |
|
| 40 | + return date('Y-m-d', $timestamp); |
|
| 41 | + } |
|
| 42 | + return $this->dateFormatter->formatDate($timestamp); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * executes the command, i.e. creates and outputs a table of LDAP users marked as deleted |
|
| 47 | - * |
|
| 48 | - * {@inheritdoc} |
|
| 49 | - */ |
|
| 50 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 51 | - /** @var \Symfony\Component\Console\Helper\Table $table */ |
|
| 52 | - $table = new Table($output); |
|
| 53 | - $table->setHeaders([ |
|
| 54 | - 'Nextcloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login', |
|
| 55 | - 'Detected on', 'Dir', 'Sharer' |
|
| 56 | - ]); |
|
| 57 | - $rows = []; |
|
| 58 | - $resultSet = $this->dui->getUsers(); |
|
| 59 | - foreach ($resultSet as $user) { |
|
| 60 | - $rows[] = [ |
|
| 61 | - 'ocName' => $user->getOCName(), |
|
| 62 | - 'displayName' => $user->getDisplayName(), |
|
| 63 | - 'uid' => $user->getUID(), |
|
| 64 | - 'dn' => $user->getDN(), |
|
| 65 | - 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')), |
|
| 66 | - 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')), |
|
| 67 | - 'homePath' => $user->getHomePath(), |
|
| 68 | - 'sharer' => $user->getHasActiveShares() ? 'Y' : 'N', |
|
| 69 | - ]; |
|
| 70 | - } |
|
| 45 | + /** |
|
| 46 | + * executes the command, i.e. creates and outputs a table of LDAP users marked as deleted |
|
| 47 | + * |
|
| 48 | + * {@inheritdoc} |
|
| 49 | + */ |
|
| 50 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 51 | + /** @var \Symfony\Component\Console\Helper\Table $table */ |
|
| 52 | + $table = new Table($output); |
|
| 53 | + $table->setHeaders([ |
|
| 54 | + 'Nextcloud name', 'Display Name', 'LDAP UID', 'LDAP DN', 'Last Login', |
|
| 55 | + 'Detected on', 'Dir', 'Sharer' |
|
| 56 | + ]); |
|
| 57 | + $rows = []; |
|
| 58 | + $resultSet = $this->dui->getUsers(); |
|
| 59 | + foreach ($resultSet as $user) { |
|
| 60 | + $rows[] = [ |
|
| 61 | + 'ocName' => $user->getOCName(), |
|
| 62 | + 'displayName' => $user->getDisplayName(), |
|
| 63 | + 'uid' => $user->getUID(), |
|
| 64 | + 'dn' => $user->getDN(), |
|
| 65 | + 'lastLogin' => $this->formatDate($user->getLastLogin(), '-', (bool)$input->getOption('short-date')), |
|
| 66 | + 'detectedOn' => $this->formatDate($user->getDetectedOn(), 'unknown', (bool)$input->getOption('short-date')), |
|
| 67 | + 'homePath' => $user->getHomePath(), |
|
| 68 | + 'sharer' => $user->getHasActiveShares() ? 'Y' : 'N', |
|
| 69 | + ]; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - if ($input->getOption('json')) { |
|
| 73 | - $output->writeln(json_encode($rows)); |
|
| 74 | - } else { |
|
| 75 | - $table->setRows($rows); |
|
| 76 | - $table->render(); |
|
| 77 | - } |
|
| 78 | - return self::SUCCESS; |
|
| 79 | - } |
|
| 72 | + if ($input->getOption('json')) { |
|
| 73 | + $output->writeln(json_encode($rows)); |
|
| 74 | + } else { |
|
| 75 | + $table->setRows($rows); |
|
| 76 | + $table->render(); |
|
| 77 | + } |
|
| 78 | + return self::SUCCESS; |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | public function setName($name) { |
| 54 | - throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); |
|
| 54 | + throw new Forbidden('Renaming '.self::FILENAME.' is forbidden'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @throws Forbidden |
| 66 | 66 | */ |
| 67 | 67 | public function delete() { |
| 68 | - throw new Forbidden(self::FILENAME . ' may not be deleted.'); |
|
| 68 | + throw new Forbidden(self::FILENAME.' may not be deleted.'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -86,6 +86,6 @@ discard block |
||
| 86 | 86 | * @throws Forbidden |
| 87 | 87 | */ |
| 88 | 88 | public function propPatch(PropPatch $propPatch) { |
| 89 | - throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); |
|
| 89 | + throw new Forbidden(self::FILENAME.'\'s properties may not be altered.'); |
|
| 90 | 90 | } |
| 91 | 91 | } |
@@ -12,60 +12,60 @@ |
||
| 12 | 12 | use Sabre\DAV\PropPatch; |
| 13 | 13 | |
| 14 | 14 | class AppleProvisioningNode implements INode, IProperties { |
| 15 | - public const FILENAME = 'apple-provisioning.mobileconfig'; |
|
| 15 | + public const FILENAME = 'apple-provisioning.mobileconfig'; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @param ITimeFactory $timeFactory |
|
| 19 | - */ |
|
| 20 | - public function __construct( |
|
| 21 | - protected ITimeFactory $timeFactory, |
|
| 22 | - ) { |
|
| 23 | - } |
|
| 17 | + /** |
|
| 18 | + * @param ITimeFactory $timeFactory |
|
| 19 | + */ |
|
| 20 | + public function __construct( |
|
| 21 | + protected ITimeFactory $timeFactory, |
|
| 22 | + ) { |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @return string |
|
| 27 | - */ |
|
| 28 | - public function getName() { |
|
| 29 | - return self::FILENAME; |
|
| 30 | - } |
|
| 25 | + /** |
|
| 26 | + * @return string |
|
| 27 | + */ |
|
| 28 | + public function getName() { |
|
| 29 | + return self::FILENAME; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | - public function setName($name) { |
|
| 34 | - throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); |
|
| 35 | - } |
|
| 33 | + public function setName($name) { |
|
| 34 | + throw new Forbidden('Renaming ' . self::FILENAME . ' is forbidden'); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @return null |
|
| 39 | - */ |
|
| 40 | - public function getLastModified() { |
|
| 41 | - return null; |
|
| 42 | - } |
|
| 37 | + /** |
|
| 38 | + * @return null |
|
| 39 | + */ |
|
| 40 | + public function getLastModified() { |
|
| 41 | + return null; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @throws Forbidden |
|
| 46 | - */ |
|
| 47 | - public function delete() { |
|
| 48 | - throw new Forbidden(self::FILENAME . ' may not be deleted.'); |
|
| 49 | - } |
|
| 44 | + /** |
|
| 45 | + * @throws Forbidden |
|
| 46 | + */ |
|
| 47 | + public function delete() { |
|
| 48 | + throw new Forbidden(self::FILENAME . ' may not be deleted.'); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param array $properties |
|
| 53 | - * @return array |
|
| 54 | - */ |
|
| 55 | - public function getProperties($properties) { |
|
| 56 | - $datetime = $this->timeFactory->getDateTime(); |
|
| 51 | + /** |
|
| 52 | + * @param array $properties |
|
| 53 | + * @return array |
|
| 54 | + */ |
|
| 55 | + public function getProperties($properties) { |
|
| 56 | + $datetime = $this->timeFactory->getDateTime(); |
|
| 57 | 57 | |
| 58 | - return [ |
|
| 59 | - '{DAV:}getcontentlength' => 42, |
|
| 60 | - '{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC7231), |
|
| 61 | - ]; |
|
| 62 | - } |
|
| 58 | + return [ |
|
| 59 | + '{DAV:}getcontentlength' => 42, |
|
| 60 | + '{DAV:}getlastmodified' => $datetime->format(\DateTimeInterface::RFC7231), |
|
| 61 | + ]; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @param PropPatch $propPatch |
|
| 66 | - * @throws Forbidden |
|
| 67 | - */ |
|
| 68 | - public function propPatch(PropPatch $propPatch) { |
|
| 69 | - throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); |
|
| 70 | - } |
|
| 64 | + /** |
|
| 65 | + * @param PropPatch $propPatch |
|
| 66 | + * @throws Forbidden |
|
| 67 | + */ |
|
| 68 | + public function propPatch(PropPatch $propPatch) { |
|
| 69 | + throw new Forbidden(self::FILENAME . '\'s properties may not be altered.'); |
|
| 70 | + } |
|
| 71 | 71 | } |
@@ -30,10 +30,10 @@ |
||
| 30 | 30 | * @since 16.0.0 |
| 31 | 31 | */ |
| 32 | 32 | interface IConfigHandler { |
| 33 | - /** |
|
| 34 | - * @param mixed $optionValue |
|
| 35 | - * @return mixed the same type as $optionValue |
|
| 36 | - * @since 16.0.0 |
|
| 37 | - */ |
|
| 38 | - public function handle($optionValue); |
|
| 33 | + /** |
|
| 34 | + * @param mixed $optionValue |
|
| 35 | + * @return mixed the same type as $optionValue |
|
| 36 | + * @since 16.0.0 |
|
| 37 | + */ |
|
| 38 | + public function handle($optionValue); |
|
| 39 | 39 | } |
@@ -27,12 +27,12 @@ |
||
| 27 | 27 | * Allow the backend to mark groups to be excluded from being shown in search dialogs |
| 28 | 28 | */ |
| 29 | 29 | interface IHideFromCollaborationBackend { |
| 30 | - /** |
|
| 31 | - * Check if a group should be hidden from search dialogs |
|
| 32 | - * |
|
| 33 | - * @param string $groupId |
|
| 34 | - * @return bool |
|
| 35 | - * @since 16.0.0 |
|
| 36 | - */ |
|
| 37 | - public function hideGroup(string $groupId): bool; |
|
| 30 | + /** |
|
| 31 | + * Check if a group should be hidden from search dialogs |
|
| 32 | + * |
|
| 33 | + * @param string $groupId |
|
| 34 | + * @return bool |
|
| 35 | + * @since 16.0.0 |
|
| 36 | + */ |
|
| 37 | + public function hideGroup(string $groupId): bool; |
|
| 38 | 38 | } |