@@ -28,11 +28,11 @@ |
||
| 28 | 28 | use OCP\WorkflowEngine\IManager; |
| 29 | 29 | |
| 30 | 30 | class Personal extends ASettings { |
| 31 | - public function getScope(): int { |
|
| 32 | - return IManager::SCOPE_USER; |
|
| 33 | - } |
|
| 31 | + public function getScope(): int { |
|
| 32 | + return IManager::SCOPE_USER; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function getSection(): ?string { |
|
| 36 | - return $this->manager->isUserScopeEnabled() ? 'workflow' : null; |
|
| 37 | - } |
|
| 35 | + public function getSection(): ?string { |
|
| 36 | + return $this->manager->isUserScopeEnabled() ? 'workflow' : null; |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -29,39 +29,39 @@ |
||
| 29 | 29 | * @since 8.2.0 |
| 30 | 30 | */ |
| 31 | 31 | interface ICompositeExpression { |
| 32 | - /** |
|
| 33 | - * Adds multiple parts to composite expression. |
|
| 34 | - * |
|
| 35 | - * @param array $parts |
|
| 36 | - * |
|
| 37 | - * @return ICompositeExpression |
|
| 38 | - * @since 8.2.0 |
|
| 39 | - */ |
|
| 40 | - public function addMultiple(array $parts = []): ICompositeExpression; |
|
| 32 | + /** |
|
| 33 | + * Adds multiple parts to composite expression. |
|
| 34 | + * |
|
| 35 | + * @param array $parts |
|
| 36 | + * |
|
| 37 | + * @return ICompositeExpression |
|
| 38 | + * @since 8.2.0 |
|
| 39 | + */ |
|
| 40 | + public function addMultiple(array $parts = []): ICompositeExpression; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Adds an expression to composite expression. |
|
| 44 | - * |
|
| 45 | - * @param mixed $part |
|
| 46 | - * |
|
| 47 | - * @return ICompositeExpression |
|
| 48 | - * @since 8.2.0 |
|
| 49 | - */ |
|
| 50 | - public function add($part): ICompositeExpression; |
|
| 42 | + /** |
|
| 43 | + * Adds an expression to composite expression. |
|
| 44 | + * |
|
| 45 | + * @param mixed $part |
|
| 46 | + * |
|
| 47 | + * @return ICompositeExpression |
|
| 48 | + * @since 8.2.0 |
|
| 49 | + */ |
|
| 50 | + public function add($part): ICompositeExpression; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Retrieves the amount of expressions on composite expression. |
|
| 54 | - * |
|
| 55 | - * @return integer |
|
| 56 | - * @since 8.2.0 |
|
| 57 | - */ |
|
| 58 | - public function count(): int; |
|
| 52 | + /** |
|
| 53 | + * Retrieves the amount of expressions on composite expression. |
|
| 54 | + * |
|
| 55 | + * @return integer |
|
| 56 | + * @since 8.2.0 |
|
| 57 | + */ |
|
| 58 | + public function count(): int; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Returns the type of this composite expression (AND/OR). |
|
| 62 | - * |
|
| 63 | - * @return string |
|
| 64 | - * @since 8.2.0 |
|
| 65 | - */ |
|
| 66 | - public function getType(): string; |
|
| 60 | + /** |
|
| 61 | + * Returns the type of this composite expression (AND/OR). |
|
| 62 | + * |
|
| 63 | + * @return string |
|
| 64 | + * @since 8.2.0 |
|
| 65 | + */ |
|
| 66 | + public function getType(): string; |
|
| 67 | 67 | } |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $gid = $input->getArgument('groupid'); |
| 68 | 68 | $group = $this->groupManager->get($gid); |
| 69 | 69 | if (!$group instanceof IGroup) { |
| 70 | - $output->writeln('<error>Group "' . $gid . '" does not exist.</error>'); |
|
| 70 | + $output->writeln('<error>Group "'.$gid.'" does not exist.</error>'); |
|
| 71 | 71 | return 1; |
| 72 | 72 | } else { |
| 73 | 73 | $groupOutput = [ |
@@ -35,56 +35,56 @@ |
||
| 35 | 35 | use Symfony\Component\Console\Output\OutputInterface; |
| 36 | 36 | |
| 37 | 37 | class Info extends Base { |
| 38 | - public function __construct( |
|
| 39 | - protected IGroupManager $groupManager, |
|
| 40 | - ) { |
|
| 41 | - parent::__construct(); |
|
| 42 | - } |
|
| 38 | + public function __construct( |
|
| 39 | + protected IGroupManager $groupManager, |
|
| 40 | + ) { |
|
| 41 | + parent::__construct(); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - protected function configure() { |
|
| 45 | - $this |
|
| 46 | - ->setName('group:info') |
|
| 47 | - ->setDescription('Show information about a group') |
|
| 48 | - ->addArgument( |
|
| 49 | - 'groupid', |
|
| 50 | - InputArgument::REQUIRED, |
|
| 51 | - 'Group id' |
|
| 52 | - )->addOption( |
|
| 53 | - 'output', |
|
| 54 | - null, |
|
| 55 | - InputOption::VALUE_OPTIONAL, |
|
| 56 | - 'Output format (plain, json or json_pretty, default is plain)', |
|
| 57 | - $this->defaultOutputFormat |
|
| 58 | - ); |
|
| 59 | - } |
|
| 44 | + protected function configure() { |
|
| 45 | + $this |
|
| 46 | + ->setName('group:info') |
|
| 47 | + ->setDescription('Show information about a group') |
|
| 48 | + ->addArgument( |
|
| 49 | + 'groupid', |
|
| 50 | + InputArgument::REQUIRED, |
|
| 51 | + 'Group id' |
|
| 52 | + )->addOption( |
|
| 53 | + 'output', |
|
| 54 | + null, |
|
| 55 | + InputOption::VALUE_OPTIONAL, |
|
| 56 | + 'Output format (plain, json or json_pretty, default is plain)', |
|
| 57 | + $this->defaultOutputFormat |
|
| 58 | + ); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 62 | - $gid = $input->getArgument('groupid'); |
|
| 63 | - $group = $this->groupManager->get($gid); |
|
| 64 | - if (!$group instanceof IGroup) { |
|
| 65 | - $output->writeln('<error>Group "' . $gid . '" does not exist.</error>'); |
|
| 66 | - return 1; |
|
| 67 | - } else { |
|
| 68 | - $groupOutput = [ |
|
| 69 | - 'groupID' => $gid, |
|
| 70 | - 'displayName' => $group->getDisplayName(), |
|
| 71 | - 'backends' => $group->getBackendNames(), |
|
| 72 | - ]; |
|
| 61 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 62 | + $gid = $input->getArgument('groupid'); |
|
| 63 | + $group = $this->groupManager->get($gid); |
|
| 64 | + if (!$group instanceof IGroup) { |
|
| 65 | + $output->writeln('<error>Group "' . $gid . '" does not exist.</error>'); |
|
| 66 | + return 1; |
|
| 67 | + } else { |
|
| 68 | + $groupOutput = [ |
|
| 69 | + 'groupID' => $gid, |
|
| 70 | + 'displayName' => $group->getDisplayName(), |
|
| 71 | + 'backends' => $group->getBackendNames(), |
|
| 72 | + ]; |
|
| 73 | 73 | |
| 74 | - $this->writeArrayInOutputFormat($input, $output, $groupOutput); |
|
| 75 | - return 0; |
|
| 76 | - } |
|
| 77 | - } |
|
| 74 | + $this->writeArrayInOutputFormat($input, $output, $groupOutput); |
|
| 75 | + return 0; |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @param string $argumentName |
|
| 81 | - * @param CompletionContext $context |
|
| 82 | - * @return string[] |
|
| 83 | - */ |
|
| 84 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
| 85 | - if ($argumentName === 'groupid') { |
|
| 86 | - return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord())); |
|
| 87 | - } |
|
| 88 | - return []; |
|
| 89 | - } |
|
| 79 | + /** |
|
| 80 | + * @param string $argumentName |
|
| 81 | + * @param CompletionContext $context |
|
| 82 | + * @return string[] |
|
| 83 | + */ |
|
| 84 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
| 85 | + if ($argumentName === 'groupid') { |
|
| 86 | + return array_map(static fn (IGroup $group) => $group->getGID(), $this->groupManager->search($context->getCurrentWord())); |
|
| 87 | + } |
|
| 88 | + return []; |
|
| 89 | + } |
|
| 90 | 90 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * sort the actions by priority and name |
| 118 | 118 | */ |
| 119 | 119 | private function sortActions(): void { |
| 120 | - usort($this->actions, function (IAction $action1, IAction $action2) { |
|
| 120 | + usort($this->actions, function(IAction $action1, IAction $action2) { |
|
| 121 | 121 | $prio1 = $action1->getPriority(); |
| 122 | 122 | $prio2 = $action2->getPriority(); |
| 123 | 123 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function jsonSerialize(): array { |
| 156 | 156 | $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null; |
| 157 | - $otherActions = array_map(function (IAction $action) { |
|
| 157 | + $otherActions = array_map(function(IAction $action) { |
|
| 158 | 158 | return $action->jsonSerialize(); |
| 159 | 159 | }, array_slice($this->actions, 1)); |
| 160 | 160 | |
@@ -14,170 +14,170 @@ |
||
| 14 | 14 | use function array_merge; |
| 15 | 15 | |
| 16 | 16 | class Entry implements IEntry { |
| 17 | - public const PROPERTY_STATUS_MESSAGE_TIMESTAMP = 'statusMessageTimestamp'; |
|
| 18 | - |
|
| 19 | - /** @var string|int|null */ |
|
| 20 | - private $id = null; |
|
| 21 | - |
|
| 22 | - private string $fullName = ''; |
|
| 23 | - |
|
| 24 | - /** @var string[] */ |
|
| 25 | - private array $emailAddresses = []; |
|
| 26 | - |
|
| 27 | - private ?string $avatar = null; |
|
| 28 | - |
|
| 29 | - private ?string $profileTitle = null; |
|
| 30 | - |
|
| 31 | - private ?string $profileUrl = null; |
|
| 32 | - |
|
| 33 | - /** @var IAction[] */ |
|
| 34 | - private array $actions = []; |
|
| 35 | - |
|
| 36 | - private array $properties = []; |
|
| 37 | - |
|
| 38 | - private ?string $status = null; |
|
| 39 | - private ?string $statusMessage = null; |
|
| 40 | - private ?int $statusMessageTimestamp = null; |
|
| 41 | - private ?string $statusIcon = null; |
|
| 42 | - |
|
| 43 | - public function setId(string $id): void { |
|
| 44 | - $this->id = $id; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - public function setFullName(string $displayName): void { |
|
| 48 | - $this->fullName = $displayName; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - public function getFullName(): string { |
|
| 52 | - return $this->fullName; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - public function addEMailAddress(string $address): void { |
|
| 56 | - $this->emailAddresses[] = $address; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @return string[] |
|
| 61 | - */ |
|
| 62 | - public function getEMailAddresses(): array { |
|
| 63 | - return $this->emailAddresses; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - public function setAvatar(string $avatar): void { |
|
| 67 | - $this->avatar = $avatar; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - public function getAvatar(): ?string { |
|
| 71 | - return $this->avatar; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - public function setProfileTitle(string $profileTitle): void { |
|
| 75 | - $this->profileTitle = $profileTitle; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - public function getProfileTitle(): ?string { |
|
| 79 | - return $this->profileTitle; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - public function setProfileUrl(string $profileUrl): void { |
|
| 83 | - $this->profileUrl = $profileUrl; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - public function getProfileUrl(): ?string { |
|
| 87 | - return $this->profileUrl; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - public function addAction(IAction $action): void { |
|
| 91 | - $this->actions[] = $action; |
|
| 92 | - $this->sortActions(); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - public function setStatus(string $status, |
|
| 96 | - ?string $statusMessage = null, |
|
| 97 | - ?int $statusMessageTimestamp = null, |
|
| 98 | - ?string $icon = null): void { |
|
| 99 | - $this->status = $status; |
|
| 100 | - $this->statusMessage = $statusMessage; |
|
| 101 | - $this->statusMessageTimestamp = $statusMessageTimestamp; |
|
| 102 | - $this->statusIcon = $icon; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * @return IAction[] |
|
| 107 | - */ |
|
| 108 | - public function getActions(): array { |
|
| 109 | - return $this->actions; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * sort the actions by priority and name |
|
| 114 | - */ |
|
| 115 | - private function sortActions(): void { |
|
| 116 | - usort($this->actions, function (IAction $action1, IAction $action2) { |
|
| 117 | - $prio1 = $action1->getPriority(); |
|
| 118 | - $prio2 = $action2->getPriority(); |
|
| 119 | - |
|
| 120 | - if ($prio1 === $prio2) { |
|
| 121 | - // Ascending order for same priority |
|
| 122 | - return strcasecmp($action1->getName(), $action2->getName()); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - // Descending order when priority differs |
|
| 126 | - return $prio2 - $prio1; |
|
| 127 | - }); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - public function setProperty(string $propertyName, mixed $value) { |
|
| 131 | - $this->properties[$propertyName] = $value; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * @param array $properties key-value array containing additional properties |
|
| 136 | - */ |
|
| 137 | - public function setProperties(array $properties): void { |
|
| 138 | - $this->properties = array_merge($this->properties, $properties); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - public function getProperty(string $key): mixed { |
|
| 142 | - if (!isset($this->properties[$key])) { |
|
| 143 | - return null; |
|
| 144 | - } |
|
| 145 | - return $this->properties[$key]; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * @return array{id: int|string|null, fullName: string, avatar: string|null, topAction: mixed, actions: array, lastMessage: '', emailAddresses: string[], profileTitle: string|null, profileUrl: string|null, status: string|null, statusMessage: null|string, statusMessageTimestamp: null|int, statusIcon: null|string, isUser: bool, uid: mixed} |
|
| 150 | - */ |
|
| 151 | - public function jsonSerialize(): array { |
|
| 152 | - $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null; |
|
| 153 | - $otherActions = array_map(function (IAction $action) { |
|
| 154 | - return $action->jsonSerialize(); |
|
| 155 | - }, array_slice($this->actions, 1)); |
|
| 156 | - |
|
| 157 | - return [ |
|
| 158 | - 'id' => $this->id, |
|
| 159 | - 'fullName' => $this->fullName, |
|
| 160 | - 'avatar' => $this->getAvatar(), |
|
| 161 | - 'topAction' => $topAction, |
|
| 162 | - 'actions' => $otherActions, |
|
| 163 | - 'lastMessage' => '', |
|
| 164 | - 'emailAddresses' => $this->getEMailAddresses(), |
|
| 165 | - 'profileTitle' => $this->profileTitle, |
|
| 166 | - 'profileUrl' => $this->profileUrl, |
|
| 167 | - 'status' => $this->status, |
|
| 168 | - 'statusMessage' => $this->statusMessage, |
|
| 169 | - 'statusMessageTimestamp' => $this->statusMessageTimestamp, |
|
| 170 | - 'statusIcon' => $this->statusIcon, |
|
| 171 | - 'isUser' => $this->getProperty('isUser') === true, |
|
| 172 | - 'uid' => $this->getProperty('UID'), |
|
| 173 | - ]; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - public function getStatusMessage(): ?string { |
|
| 177 | - return $this->statusMessage; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - public function getStatusMessageTimestamp(): ?int { |
|
| 181 | - return $this->statusMessageTimestamp; |
|
| 182 | - } |
|
| 17 | + public const PROPERTY_STATUS_MESSAGE_TIMESTAMP = 'statusMessageTimestamp'; |
|
| 18 | + |
|
| 19 | + /** @var string|int|null */ |
|
| 20 | + private $id = null; |
|
| 21 | + |
|
| 22 | + private string $fullName = ''; |
|
| 23 | + |
|
| 24 | + /** @var string[] */ |
|
| 25 | + private array $emailAddresses = []; |
|
| 26 | + |
|
| 27 | + private ?string $avatar = null; |
|
| 28 | + |
|
| 29 | + private ?string $profileTitle = null; |
|
| 30 | + |
|
| 31 | + private ?string $profileUrl = null; |
|
| 32 | + |
|
| 33 | + /** @var IAction[] */ |
|
| 34 | + private array $actions = []; |
|
| 35 | + |
|
| 36 | + private array $properties = []; |
|
| 37 | + |
|
| 38 | + private ?string $status = null; |
|
| 39 | + private ?string $statusMessage = null; |
|
| 40 | + private ?int $statusMessageTimestamp = null; |
|
| 41 | + private ?string $statusIcon = null; |
|
| 42 | + |
|
| 43 | + public function setId(string $id): void { |
|
| 44 | + $this->id = $id; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + public function setFullName(string $displayName): void { |
|
| 48 | + $this->fullName = $displayName; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + public function getFullName(): string { |
|
| 52 | + return $this->fullName; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + public function addEMailAddress(string $address): void { |
|
| 56 | + $this->emailAddresses[] = $address; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @return string[] |
|
| 61 | + */ |
|
| 62 | + public function getEMailAddresses(): array { |
|
| 63 | + return $this->emailAddresses; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + public function setAvatar(string $avatar): void { |
|
| 67 | + $this->avatar = $avatar; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + public function getAvatar(): ?string { |
|
| 71 | + return $this->avatar; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + public function setProfileTitle(string $profileTitle): void { |
|
| 75 | + $this->profileTitle = $profileTitle; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + public function getProfileTitle(): ?string { |
|
| 79 | + return $this->profileTitle; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + public function setProfileUrl(string $profileUrl): void { |
|
| 83 | + $this->profileUrl = $profileUrl; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + public function getProfileUrl(): ?string { |
|
| 87 | + return $this->profileUrl; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + public function addAction(IAction $action): void { |
|
| 91 | + $this->actions[] = $action; |
|
| 92 | + $this->sortActions(); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + public function setStatus(string $status, |
|
| 96 | + ?string $statusMessage = null, |
|
| 97 | + ?int $statusMessageTimestamp = null, |
|
| 98 | + ?string $icon = null): void { |
|
| 99 | + $this->status = $status; |
|
| 100 | + $this->statusMessage = $statusMessage; |
|
| 101 | + $this->statusMessageTimestamp = $statusMessageTimestamp; |
|
| 102 | + $this->statusIcon = $icon; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * @return IAction[] |
|
| 107 | + */ |
|
| 108 | + public function getActions(): array { |
|
| 109 | + return $this->actions; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * sort the actions by priority and name |
|
| 114 | + */ |
|
| 115 | + private function sortActions(): void { |
|
| 116 | + usort($this->actions, function (IAction $action1, IAction $action2) { |
|
| 117 | + $prio1 = $action1->getPriority(); |
|
| 118 | + $prio2 = $action2->getPriority(); |
|
| 119 | + |
|
| 120 | + if ($prio1 === $prio2) { |
|
| 121 | + // Ascending order for same priority |
|
| 122 | + return strcasecmp($action1->getName(), $action2->getName()); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + // Descending order when priority differs |
|
| 126 | + return $prio2 - $prio1; |
|
| 127 | + }); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + public function setProperty(string $propertyName, mixed $value) { |
|
| 131 | + $this->properties[$propertyName] = $value; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * @param array $properties key-value array containing additional properties |
|
| 136 | + */ |
|
| 137 | + public function setProperties(array $properties): void { |
|
| 138 | + $this->properties = array_merge($this->properties, $properties); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + public function getProperty(string $key): mixed { |
|
| 142 | + if (!isset($this->properties[$key])) { |
|
| 143 | + return null; |
|
| 144 | + } |
|
| 145 | + return $this->properties[$key]; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * @return array{id: int|string|null, fullName: string, avatar: string|null, topAction: mixed, actions: array, lastMessage: '', emailAddresses: string[], profileTitle: string|null, profileUrl: string|null, status: string|null, statusMessage: null|string, statusMessageTimestamp: null|int, statusIcon: null|string, isUser: bool, uid: mixed} |
|
| 150 | + */ |
|
| 151 | + public function jsonSerialize(): array { |
|
| 152 | + $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null; |
|
| 153 | + $otherActions = array_map(function (IAction $action) { |
|
| 154 | + return $action->jsonSerialize(); |
|
| 155 | + }, array_slice($this->actions, 1)); |
|
| 156 | + |
|
| 157 | + return [ |
|
| 158 | + 'id' => $this->id, |
|
| 159 | + 'fullName' => $this->fullName, |
|
| 160 | + 'avatar' => $this->getAvatar(), |
|
| 161 | + 'topAction' => $topAction, |
|
| 162 | + 'actions' => $otherActions, |
|
| 163 | + 'lastMessage' => '', |
|
| 164 | + 'emailAddresses' => $this->getEMailAddresses(), |
|
| 165 | + 'profileTitle' => $this->profileTitle, |
|
| 166 | + 'profileUrl' => $this->profileUrl, |
|
| 167 | + 'status' => $this->status, |
|
| 168 | + 'statusMessage' => $this->statusMessage, |
|
| 169 | + 'statusMessageTimestamp' => $this->statusMessageTimestamp, |
|
| 170 | + 'statusIcon' => $this->statusIcon, |
|
| 171 | + 'isUser' => $this->getProperty('isUser') === true, |
|
| 172 | + 'uid' => $this->getProperty('UID'), |
|
| 173 | + ]; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + public function getStatusMessage(): ?string { |
|
| 177 | + return $this->statusMessage; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + public function getStatusMessageTimestamp(): ?int { |
|
| 181 | + return $this->statusMessageTimestamp; |
|
| 182 | + } |
|
| 183 | 183 | } |
@@ -29,15 +29,15 @@ |
||
| 29 | 29 | namespace OCA\AdminAudit\Actions; |
| 30 | 30 | |
| 31 | 31 | class Trashbin extends Action { |
| 32 | - public function delete(array $params): void { |
|
| 33 | - $this->log('File "%s" deleted from trash bin.', |
|
| 34 | - ['path' => $params['path']], ['path'] |
|
| 35 | - ); |
|
| 36 | - } |
|
| 32 | + public function delete(array $params): void { |
|
| 33 | + $this->log('File "%s" deleted from trash bin.', |
|
| 34 | + ['path' => $params['path']], ['path'] |
|
| 35 | + ); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function restore(array $params): void { |
|
| 39 | - $this->log('File "%s" restored from trash bin.', |
|
| 40 | - ['path' => $params['filePath']], ['path'] |
|
| 41 | - ); |
|
| 42 | - } |
|
| 38 | + public function restore(array $params): void { |
|
| 39 | + $this->log('File "%s" restored from trash bin.', |
|
| 40 | + ['path' => $params['filePath']], ['path'] |
|
| 41 | + ); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -29,22 +29,22 @@ |
||
| 29 | 29 | * @since 22.0.0 |
| 30 | 30 | */ |
| 31 | 31 | class AlreadySharedException extends GenericShareException { |
| 32 | - /** @var IShare */ |
|
| 33 | - private $existingShare; |
|
| 32 | + /** @var IShare */ |
|
| 33 | + private $existingShare; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @since 22.0.0 |
|
| 37 | - */ |
|
| 38 | - public function __construct(string $message, IShare $existingShare) { |
|
| 39 | - parent::__construct($message); |
|
| 35 | + /** |
|
| 36 | + * @since 22.0.0 |
|
| 37 | + */ |
|
| 38 | + public function __construct(string $message, IShare $existingShare) { |
|
| 39 | + parent::__construct($message); |
|
| 40 | 40 | |
| 41 | - $this->existingShare = $existingShare; |
|
| 42 | - } |
|
| 41 | + $this->existingShare = $existingShare; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @since 22.0.0 |
|
| 46 | - */ |
|
| 47 | - public function getExistingShare(): IShare { |
|
| 48 | - return $this->existingShare; |
|
| 49 | - } |
|
| 44 | + /** |
|
| 45 | + * @since 22.0.0 |
|
| 46 | + */ |
|
| 47 | + public function getExistingShare(): IShare { |
|
| 48 | + return $this->existingShare; |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function register(IRegistrationContext $context): void { |
| 61 | 61 | $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); |
| 62 | 62 | |
| 63 | - $context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) { |
|
| 63 | + $context->registerService(NewUserMailHelper::class, function(ContainerInterface $c) { |
|
| 64 | 64 | return new NewUserMailHelper( |
| 65 | 65 | $c->get(Defaults::class), |
| 66 | 66 | $c->get(IURLGenerator::class), |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | Util::getDefaultEmailAddress('no-reply') |
| 74 | 74 | ); |
| 75 | 75 | }); |
| 76 | - $context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) { |
|
| 76 | + $context->registerService(ProvisioningApiMiddleware::class, function(ContainerInterface $c) { |
|
| 77 | 77 | $user = $c->get(IUserManager::class)->get($c->get('UserId')); |
| 78 | 78 | $isAdmin = false; |
| 79 | 79 | $isSubAdmin = false; |
@@ -54,48 +54,48 @@ |
||
| 54 | 54 | use Psr\Container\ContainerInterface; |
| 55 | 55 | |
| 56 | 56 | class Application extends App implements IBootstrap { |
| 57 | - public function __construct(array $urlParams = []) { |
|
| 58 | - parent::__construct('provisioning_api', $urlParams); |
|
| 59 | - } |
|
| 57 | + public function __construct(array $urlParams = []) { |
|
| 58 | + parent::__construct('provisioning_api', $urlParams); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function register(IRegistrationContext $context): void { |
|
| 62 | - $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); |
|
| 61 | + public function register(IRegistrationContext $context): void { |
|
| 62 | + $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class); |
|
| 63 | 63 | |
| 64 | - $context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) { |
|
| 65 | - return new NewUserMailHelper( |
|
| 66 | - $c->get(Defaults::class), |
|
| 67 | - $c->get(IURLGenerator::class), |
|
| 68 | - $c->get(IFactory::class), |
|
| 69 | - $c->get(IMailer::class), |
|
| 70 | - $c->get(ISecureRandom::class), |
|
| 71 | - $c->get(ITimeFactory::class), |
|
| 72 | - $c->get(IConfig::class), |
|
| 73 | - $c->get(ICrypto::class), |
|
| 74 | - Util::getDefaultEmailAddress('no-reply') |
|
| 75 | - ); |
|
| 76 | - }); |
|
| 77 | - $context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) { |
|
| 78 | - $user = $c->get(IUserManager::class)->get($c->get('UserId')); |
|
| 79 | - $isAdmin = false; |
|
| 80 | - $isSubAdmin = false; |
|
| 64 | + $context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) { |
|
| 65 | + return new NewUserMailHelper( |
|
| 66 | + $c->get(Defaults::class), |
|
| 67 | + $c->get(IURLGenerator::class), |
|
| 68 | + $c->get(IFactory::class), |
|
| 69 | + $c->get(IMailer::class), |
|
| 70 | + $c->get(ISecureRandom::class), |
|
| 71 | + $c->get(ITimeFactory::class), |
|
| 72 | + $c->get(IConfig::class), |
|
| 73 | + $c->get(ICrypto::class), |
|
| 74 | + Util::getDefaultEmailAddress('no-reply') |
|
| 75 | + ); |
|
| 76 | + }); |
|
| 77 | + $context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) { |
|
| 78 | + $user = $c->get(IUserManager::class)->get($c->get('UserId')); |
|
| 79 | + $isAdmin = false; |
|
| 80 | + $isSubAdmin = false; |
|
| 81 | 81 | |
| 82 | - if ($user instanceof IUser) { |
|
| 83 | - $groupManager = $c->get(IGroupManager::class); |
|
| 84 | - assert($groupManager instanceof GroupManager); |
|
| 85 | - $isAdmin = $groupManager->isAdmin($user->getUID()); |
|
| 86 | - $isSubAdmin = $groupManager->getSubAdmin()->isSubAdmin($user); |
|
| 87 | - } |
|
| 82 | + if ($user instanceof IUser) { |
|
| 83 | + $groupManager = $c->get(IGroupManager::class); |
|
| 84 | + assert($groupManager instanceof GroupManager); |
|
| 85 | + $isAdmin = $groupManager->isAdmin($user->getUID()); |
|
| 86 | + $isSubAdmin = $groupManager->getSubAdmin()->isSubAdmin($user); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - return new ProvisioningApiMiddleware( |
|
| 90 | - $c->get(IControllerMethodReflector::class), |
|
| 91 | - $isAdmin, |
|
| 92 | - $isSubAdmin |
|
| 93 | - ); |
|
| 94 | - }); |
|
| 95 | - $context->registerMiddleware(ProvisioningApiMiddleware::class); |
|
| 96 | - $context->registerCapability(Capabilities::class); |
|
| 97 | - } |
|
| 89 | + return new ProvisioningApiMiddleware( |
|
| 90 | + $c->get(IControllerMethodReflector::class), |
|
| 91 | + $isAdmin, |
|
| 92 | + $isSubAdmin |
|
| 93 | + ); |
|
| 94 | + }); |
|
| 95 | + $context->registerMiddleware(ProvisioningApiMiddleware::class); |
|
| 96 | + $context->registerCapability(Capabilities::class); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - public function boot(IBootContext $context): void { |
|
| 100 | - } |
|
| 99 | + public function boot(IBootContext $context): void { |
|
| 100 | + } |
|
| 101 | 101 | } |
@@ -30,31 +30,31 @@ |
||
| 30 | 30 | * Fallback implementation for moveFromCache |
| 31 | 31 | */ |
| 32 | 32 | trait MoveFromCacheTrait { |
| 33 | - /** |
|
| 34 | - * store meta data for a file or folder |
|
| 35 | - * |
|
| 36 | - * @param string $file |
|
| 37 | - * @param array $data |
|
| 38 | - * |
|
| 39 | - * @return int file id |
|
| 40 | - * @throws \RuntimeException |
|
| 41 | - */ |
|
| 42 | - abstract public function put($file, array $data); |
|
| 33 | + /** |
|
| 34 | + * store meta data for a file or folder |
|
| 35 | + * |
|
| 36 | + * @param string $file |
|
| 37 | + * @param array $data |
|
| 38 | + * |
|
| 39 | + * @return int file id |
|
| 40 | + * @throws \RuntimeException |
|
| 41 | + */ |
|
| 42 | + abstract public function put($file, array $data); |
|
| 43 | 43 | |
| 44 | - abstract public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int; |
|
| 44 | + abstract public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Move a file or folder in the cache |
|
| 48 | - * |
|
| 49 | - * @param \OCP\Files\Cache\ICache $sourceCache |
|
| 50 | - * @param string $sourcePath |
|
| 51 | - * @param string $targetPath |
|
| 52 | - */ |
|
| 53 | - public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { |
|
| 54 | - $sourceEntry = $sourceCache->get($sourcePath); |
|
| 46 | + /** |
|
| 47 | + * Move a file or folder in the cache |
|
| 48 | + * |
|
| 49 | + * @param \OCP\Files\Cache\ICache $sourceCache |
|
| 50 | + * @param string $sourcePath |
|
| 51 | + * @param string $targetPath |
|
| 52 | + */ |
|
| 53 | + public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { |
|
| 54 | + $sourceEntry = $sourceCache->get($sourcePath); |
|
| 55 | 55 | |
| 56 | - $this->copyFromCache($sourceCache, $sourceEntry, $targetPath); |
|
| 56 | + $this->copyFromCache($sourceCache, $sourceEntry, $targetPath); |
|
| 57 | 57 | |
| 58 | - $sourceCache->remove($sourcePath); |
|
| 59 | - } |
|
| 58 | + $sourceCache->remove($sourcePath); |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -31,22 +31,22 @@ |
||
| 31 | 31 | use OCP\Migration\SimpleMigrationStep; |
| 32 | 32 | |
| 33 | 33 | class Version21000Date20210309185127 extends SimpleMigrationStep { |
| 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): ?ISchemaWrapper { |
|
| 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): ?ISchemaWrapper { |
|
| 41 | + /** @var ISchemaWrapper $schema */ |
|
| 42 | + $schema = $schemaClosure(); |
|
| 43 | 43 | |
| 44 | - $table = $schema->getTable('known_users'); |
|
| 45 | - if (!$table->hasIndex('ku_known_user')) { |
|
| 46 | - $table->addIndex(['known_user'], 'ku_known_user'); |
|
| 47 | - return $schema; |
|
| 48 | - } |
|
| 44 | + $table = $schema->getTable('known_users'); |
|
| 45 | + if (!$table->hasIndex('ku_known_user')) { |
|
| 46 | + $table->addIndex(['known_user'], 'ku_known_user'); |
|
| 47 | + return $schema; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return null; |
|
| 51 | - } |
|
| 50 | + return null; |
|
| 51 | + } |
|
| 52 | 52 | } |