@@ -35,13 +35,13 @@ |
||
35 | 35 | */ |
36 | 36 | interface IProvidesPersonalSettings extends IProvider { |
37 | 37 | |
38 | - /** |
|
39 | - * @param IUser $user |
|
40 | - * |
|
41 | - * @return IPersonalProviderSettings |
|
42 | - * |
|
43 | - * @since 15.0.0 |
|
44 | - */ |
|
45 | - public function getPersonalSettings(IUser $user): IPersonalProviderSettings; |
|
38 | + /** |
|
39 | + * @param IUser $user |
|
40 | + * |
|
41 | + * @return IPersonalProviderSettings |
|
42 | + * |
|
43 | + * @since 15.0.0 |
|
44 | + */ |
|
45 | + public function getPersonalSettings(IUser $user): IPersonalProviderSettings; |
|
46 | 46 | |
47 | 47 | } |
@@ -32,19 +32,19 @@ |
||
32 | 32 | */ |
33 | 33 | class ProviderAlreadyExistsException extends HintException { |
34 | 34 | |
35 | - /** |
|
36 | - * ProviderAlreadyExistsException constructor. |
|
37 | - * |
|
38 | - * @since 14.0.0 |
|
39 | - * |
|
40 | - * @param string $newProviderId cloud federation provider ID of the new provider |
|
41 | - * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
42 | - */ |
|
43 | - public function __construct($newProviderId, $existingProviderName) { |
|
44 | - $l = \OC::$server->getL10N('federation'); |
|
45 | - $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
46 | - $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
47 | - parent::__construct($message, $hint); |
|
48 | - } |
|
35 | + /** |
|
36 | + * ProviderAlreadyExistsException constructor. |
|
37 | + * |
|
38 | + * @since 14.0.0 |
|
39 | + * |
|
40 | + * @param string $newProviderId cloud federation provider ID of the new provider |
|
41 | + * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
42 | + */ |
|
43 | + public function __construct($newProviderId, $existingProviderName) { |
|
44 | + $l = \OC::$server->getL10N('federation'); |
|
45 | + $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
46 | + $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
47 | + parent::__construct($message, $hint); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function __construct($newProviderId, $existingProviderName) { |
44 | 44 | $l = \OC::$server->getL10N('federation'); |
45 | - $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
45 | + $message = 'ID "'.$newProviderId.'" already used by cloud federation provider "'.$existingProviderName.'"'; |
|
46 | 46 | $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
47 | 47 | parent::__construct($message, $hint); |
48 | 48 | } |
@@ -8,6 +8,6 @@ |
||
8 | 8 | </p> |
9 | 9 | <br /> |
10 | 10 | <p> |
11 | - <?php print_unescaped($l->t('Further information how to configure this can be found in the %1$sdocumentation%2$s.', ['<a href="' . $_['docUrl'] . '" target="blank">', '</a>'])); ?> |
|
11 | + <?php print_unescaped($l->t('Further information how to configure this can be found in the %1$sdocumentation%2$s.', ['<a href="'.$_['docUrl'].'" target="blank">', '</a>'])); ?> |
|
12 | 12 | </p> |
13 | 13 | </div> |
@@ -31,18 +31,18 @@ |
||
31 | 31 | */ |
32 | 32 | interface ITimeFactory { |
33 | 33 | |
34 | - /** |
|
35 | - * @return int the result of a call to time() |
|
36 | - * @since 8.0.0 |
|
37 | - */ |
|
38 | - public function getTime(): int; |
|
34 | + /** |
|
35 | + * @return int the result of a call to time() |
|
36 | + * @since 8.0.0 |
|
37 | + */ |
|
38 | + public function getTime(): int; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param string $time |
|
42 | - * @param \DateTimeZone $timezone |
|
43 | - * @return \DateTime |
|
44 | - * @since 15.0.0 |
|
45 | - */ |
|
46 | - public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; |
|
40 | + /** |
|
41 | + * @param string $time |
|
42 | + * @param \DateTimeZone $timezone |
|
43 | + * @return \DateTime |
|
44 | + * @since 15.0.0 |
|
45 | + */ |
|
46 | + public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; |
|
47 | 47 | |
48 | 48 | } |
@@ -98,10 +98,10 @@ |
||
98 | 98 | if (empty($state->getEnforcedGroups())) { |
99 | 99 | $message = 'Two-factor authentication is enforced for all users'; |
100 | 100 | } else { |
101 | - $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
101 | + $message = 'Two-factor authentication is enforced for members of the group(s) '.implode(', ', $state->getEnforcedGroups()); |
|
102 | 102 | } |
103 | 103 | if (!empty($state->getExcludedGroups())) { |
104 | - $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
104 | + $message .= ', except members of '.implode(', ', $state->getExcludedGroups()); |
|
105 | 105 | } |
106 | 106 | $output->writeln($message); |
107 | 107 | } |
@@ -36,81 +36,81 @@ |
||
36 | 36 | |
37 | 37 | class Enforce extends Command { |
38 | 38 | |
39 | - /** @var MandatoryTwoFactor */ |
|
40 | - private $mandatoryTwoFactor; |
|
39 | + /** @var MandatoryTwoFactor */ |
|
40 | + private $mandatoryTwoFactor; |
|
41 | 41 | |
42 | - public function __construct(MandatoryTwoFactor $mandatoryTwoFactor) { |
|
43 | - parent::__construct(); |
|
42 | + public function __construct(MandatoryTwoFactor $mandatoryTwoFactor) { |
|
43 | + parent::__construct(); |
|
44 | 44 | |
45 | - $this->mandatoryTwoFactor = $mandatoryTwoFactor; |
|
46 | - } |
|
45 | + $this->mandatoryTwoFactor = $mandatoryTwoFactor; |
|
46 | + } |
|
47 | 47 | |
48 | - protected function configure() { |
|
49 | - $this->setName('twofactorauth:enforce'); |
|
50 | - $this->setDescription('Enabled/disable enforced two-factor authentication'); |
|
51 | - $this->addOption( |
|
52 | - 'on', |
|
53 | - null, |
|
54 | - InputOption::VALUE_NONE, |
|
55 | - 'enforce two-factor authentication' |
|
56 | - ); |
|
57 | - $this->addOption( |
|
58 | - 'off', |
|
59 | - null, |
|
60 | - InputOption::VALUE_NONE, |
|
61 | - 'don\'t enforce two-factor authenticaton' |
|
62 | - ); |
|
63 | - $this->addOption( |
|
64 | - 'group', |
|
65 | - null, |
|
66 | - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
67 | - 'enforce only for the given group(s)' |
|
68 | - ); |
|
69 | - $this->addOption( |
|
70 | - 'exclude', |
|
71 | - null, |
|
72 | - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
73 | - 'exclude mandatory two-factor auth for the given group(s)' |
|
74 | - ); |
|
75 | - } |
|
48 | + protected function configure() { |
|
49 | + $this->setName('twofactorauth:enforce'); |
|
50 | + $this->setDescription('Enabled/disable enforced two-factor authentication'); |
|
51 | + $this->addOption( |
|
52 | + 'on', |
|
53 | + null, |
|
54 | + InputOption::VALUE_NONE, |
|
55 | + 'enforce two-factor authentication' |
|
56 | + ); |
|
57 | + $this->addOption( |
|
58 | + 'off', |
|
59 | + null, |
|
60 | + InputOption::VALUE_NONE, |
|
61 | + 'don\'t enforce two-factor authenticaton' |
|
62 | + ); |
|
63 | + $this->addOption( |
|
64 | + 'group', |
|
65 | + null, |
|
66 | + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
67 | + 'enforce only for the given group(s)' |
|
68 | + ); |
|
69 | + $this->addOption( |
|
70 | + 'exclude', |
|
71 | + null, |
|
72 | + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
73 | + 'exclude mandatory two-factor auth for the given group(s)' |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | |
77 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
78 | - if ($input->getOption('on')) { |
|
79 | - $enforcedGroups = $input->getOption('group'); |
|
80 | - $excludedGroups = $input->getOption('exclude'); |
|
81 | - $this->mandatoryTwoFactor->setState(new EnforcementState(true, $enforcedGroups, $excludedGroups)); |
|
82 | - } elseif ($input->getOption('off')) { |
|
83 | - $this->mandatoryTwoFactor->setState(new EnforcementState(false)); |
|
84 | - } |
|
77 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
78 | + if ($input->getOption('on')) { |
|
79 | + $enforcedGroups = $input->getOption('group'); |
|
80 | + $excludedGroups = $input->getOption('exclude'); |
|
81 | + $this->mandatoryTwoFactor->setState(new EnforcementState(true, $enforcedGroups, $excludedGroups)); |
|
82 | + } elseif ($input->getOption('off')) { |
|
83 | + $this->mandatoryTwoFactor->setState(new EnforcementState(false)); |
|
84 | + } |
|
85 | 85 | |
86 | - $state = $this->mandatoryTwoFactor->getState(); |
|
87 | - if ($state->isEnforced()) { |
|
88 | - $this->writeEnforced($output, $state); |
|
89 | - } else { |
|
90 | - $this->writeNotEnforced($output); |
|
91 | - } |
|
92 | - return 0; |
|
93 | - } |
|
86 | + $state = $this->mandatoryTwoFactor->getState(); |
|
87 | + if ($state->isEnforced()) { |
|
88 | + $this->writeEnforced($output, $state); |
|
89 | + } else { |
|
90 | + $this->writeNotEnforced($output); |
|
91 | + } |
|
92 | + return 0; |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * @param OutputInterface $output |
|
97 | - */ |
|
98 | - protected function writeEnforced(OutputInterface $output, EnforcementState $state) { |
|
99 | - if (empty($state->getEnforcedGroups())) { |
|
100 | - $message = 'Two-factor authentication is enforced for all users'; |
|
101 | - } else { |
|
102 | - $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
103 | - } |
|
104 | - if (!empty($state->getExcludedGroups())) { |
|
105 | - $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
106 | - } |
|
107 | - $output->writeln($message); |
|
108 | - } |
|
95 | + /** |
|
96 | + * @param OutputInterface $output |
|
97 | + */ |
|
98 | + protected function writeEnforced(OutputInterface $output, EnforcementState $state) { |
|
99 | + if (empty($state->getEnforcedGroups())) { |
|
100 | + $message = 'Two-factor authentication is enforced for all users'; |
|
101 | + } else { |
|
102 | + $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
103 | + } |
|
104 | + if (!empty($state->getExcludedGroups())) { |
|
105 | + $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
106 | + } |
|
107 | + $output->writeln($message); |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * @param OutputInterface $output |
|
112 | - */ |
|
113 | - protected function writeNotEnforced(OutputInterface $output) { |
|
114 | - $output->writeln('Two-factor authentication is not enforced'); |
|
115 | - } |
|
110 | + /** |
|
111 | + * @param OutputInterface $output |
|
112 | + */ |
|
113 | + protected function writeNotEnforced(OutputInterface $output) { |
|
114 | + $output->writeln('Two-factor authentication is not enforced'); |
|
115 | + } |
|
116 | 116 | } |
@@ -46,103 +46,103 @@ |
||
46 | 46 | class DashboardManager implements IDashboardManager { |
47 | 47 | |
48 | 48 | |
49 | - /** @var IWidgetsService */ |
|
50 | - private $widgetsService; |
|
51 | - |
|
52 | - /** @var IEventsService */ |
|
53 | - private $eventsService; |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * @param IEventsService $eventsService |
|
58 | - */ |
|
59 | - public function registerEventsService(IEventsService $eventsService) { |
|
60 | - $this->eventsService = $eventsService; |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @param IWidgetsService $widgetsService |
|
66 | - */ |
|
67 | - public function registerWidgetsService(IWidgetsService $widgetsService) { |
|
68 | - $this->widgetsService = $widgetsService; |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @param string $widgetId |
|
74 | - * @param string $userId |
|
75 | - * |
|
76 | - * @return IWidgetConfig |
|
77 | - * @throws DashboardAppNotAvailableException |
|
78 | - */ |
|
79 | - public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig { |
|
80 | - return $this->getWidgetsService()->getWidgetConfig($widgetId, $userId); |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * @param string $widgetId |
|
86 | - * @param array $users |
|
87 | - * @param array $payload |
|
88 | - * @param string $uniqueId |
|
89 | - * |
|
90 | - * @throws DashboardAppNotAvailableException |
|
91 | - */ |
|
92 | - public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = '') { |
|
93 | - $this->getEventsService()->createUsersEvent($widgetId, $users, $payload, $uniqueId); |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param string $widgetId |
|
99 | - * @param array $groups |
|
100 | - * @param array $payload |
|
101 | - * @param string $uniqueId |
|
102 | - * |
|
103 | - * @throws DashboardAppNotAvailableException |
|
104 | - */ |
|
105 | - public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = '') { |
|
106 | - $this->getEventsService()->createGroupsEvent($widgetId, $groups, $payload, $uniqueId); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * @param string $widgetId |
|
112 | - * @param array $payload |
|
113 | - * @param string $uniqueId |
|
114 | - * |
|
115 | - * @throws DashboardAppNotAvailableException |
|
116 | - */ |
|
117 | - public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = '') { |
|
118 | - $this->getEventsService()->createGlobalEvent($widgetId, $payload, $uniqueId); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @return IWidgetsService |
|
124 | - * @throws DashboardAppNotAvailableException |
|
125 | - */ |
|
126 | - private function getWidgetsService() { |
|
127 | - if ($this->widgetsService === null) { |
|
128 | - throw new DashboardAppNotAvailableException('No IWidgetsService registered'); |
|
129 | - } |
|
130 | - |
|
131 | - return $this->widgetsService; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @return IEventsService |
|
137 | - * @throws DashboardAppNotAvailableException |
|
138 | - */ |
|
139 | - private function getEventsService() { |
|
140 | - if ($this->eventsService === null) { |
|
141 | - throw new DashboardAppNotAvailableException('No IEventsService registered'); |
|
142 | - } |
|
143 | - |
|
144 | - return $this->eventsService; |
|
145 | - } |
|
49 | + /** @var IWidgetsService */ |
|
50 | + private $widgetsService; |
|
51 | + |
|
52 | + /** @var IEventsService */ |
|
53 | + private $eventsService; |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * @param IEventsService $eventsService |
|
58 | + */ |
|
59 | + public function registerEventsService(IEventsService $eventsService) { |
|
60 | + $this->eventsService = $eventsService; |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @param IWidgetsService $widgetsService |
|
66 | + */ |
|
67 | + public function registerWidgetsService(IWidgetsService $widgetsService) { |
|
68 | + $this->widgetsService = $widgetsService; |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @param string $widgetId |
|
74 | + * @param string $userId |
|
75 | + * |
|
76 | + * @return IWidgetConfig |
|
77 | + * @throws DashboardAppNotAvailableException |
|
78 | + */ |
|
79 | + public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig { |
|
80 | + return $this->getWidgetsService()->getWidgetConfig($widgetId, $userId); |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * @param string $widgetId |
|
86 | + * @param array $users |
|
87 | + * @param array $payload |
|
88 | + * @param string $uniqueId |
|
89 | + * |
|
90 | + * @throws DashboardAppNotAvailableException |
|
91 | + */ |
|
92 | + public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = '') { |
|
93 | + $this->getEventsService()->createUsersEvent($widgetId, $users, $payload, $uniqueId); |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param string $widgetId |
|
99 | + * @param array $groups |
|
100 | + * @param array $payload |
|
101 | + * @param string $uniqueId |
|
102 | + * |
|
103 | + * @throws DashboardAppNotAvailableException |
|
104 | + */ |
|
105 | + public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = '') { |
|
106 | + $this->getEventsService()->createGroupsEvent($widgetId, $groups, $payload, $uniqueId); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * @param string $widgetId |
|
112 | + * @param array $payload |
|
113 | + * @param string $uniqueId |
|
114 | + * |
|
115 | + * @throws DashboardAppNotAvailableException |
|
116 | + */ |
|
117 | + public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = '') { |
|
118 | + $this->getEventsService()->createGlobalEvent($widgetId, $payload, $uniqueId); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @return IWidgetsService |
|
124 | + * @throws DashboardAppNotAvailableException |
|
125 | + */ |
|
126 | + private function getWidgetsService() { |
|
127 | + if ($this->widgetsService === null) { |
|
128 | + throw new DashboardAppNotAvailableException('No IWidgetsService registered'); |
|
129 | + } |
|
130 | + |
|
131 | + return $this->widgetsService; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @return IEventsService |
|
137 | + * @throws DashboardAppNotAvailableException |
|
138 | + */ |
|
139 | + private function getEventsService() { |
|
140 | + if ($this->eventsService === null) { |
|
141 | + throw new DashboardAppNotAvailableException('No IEventsService registered'); |
|
142 | + } |
|
143 | + |
|
144 | + return $this->eventsService; |
|
145 | + } |
|
146 | 146 | |
147 | 147 | } |
148 | 148 |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | ], |
75 | 75 | [ |
76 | 76 | 'privilege' => '{DAV:}read', |
77 | - 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
77 | + 'principal' => $this->getOwner().'/calendar-proxy-read', |
|
78 | 78 | 'protected' => true, |
79 | 79 | ], |
80 | 80 | [ |
81 | 81 | 'privilege' => '{DAV:}read', |
82 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
82 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
83 | 83 | 'protected' => true, |
84 | 84 | ], |
85 | 85 | ]; |
@@ -94,23 +94,23 @@ discard block |
||
94 | 94 | if ($this->disableFreeBusy) { |
95 | 95 | return array_merge($commonAcl, [ |
96 | 96 | [ |
97 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
97 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send-invite', |
|
98 | 98 | 'principal' => $this->getOwner(), |
99 | 99 | 'protected' => true, |
100 | 100 | ], |
101 | 101 | [ |
102 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
103 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
102 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send-invite', |
|
103 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
104 | 104 | 'protected' => true, |
105 | 105 | ], |
106 | 106 | [ |
107 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
107 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send-reply', |
|
108 | 108 | 'principal' => $this->getOwner(), |
109 | 109 | 'protected' => true, |
110 | 110 | ], |
111 | 111 | [ |
112 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
113 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
112 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send-reply', |
|
113 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
114 | 114 | 'protected' => true, |
115 | 115 | ], |
116 | 116 | ]); |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | |
119 | 119 | return array_merge($commonAcl, [ |
120 | 120 | [ |
121 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
121 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send', |
|
122 | 122 | 'principal' => $this->getOwner(), |
123 | 123 | 'protected' => true, |
124 | 124 | ], |
125 | 125 | [ |
126 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
127 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
126 | + 'privilege' => '{'.CalDAVPlugin::NS_CALDAV.'}schedule-send', |
|
127 | + 'principal' => $this->getOwner().'/calendar-proxy-write', |
|
128 | 128 | 'protected' => true, |
129 | 129 | ], |
130 | 130 | ]); |
@@ -34,102 +34,102 @@ |
||
34 | 34 | */ |
35 | 35 | class Outbox extends \Sabre\CalDAV\Schedule\Outbox { |
36 | 36 | |
37 | - /** @var IConfig */ |
|
38 | - private $config; |
|
37 | + /** @var IConfig */ |
|
38 | + private $config; |
|
39 | 39 | |
40 | - /** @var null|bool */ |
|
41 | - private $disableFreeBusy = null; |
|
40 | + /** @var null|bool */ |
|
41 | + private $disableFreeBusy = null; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Outbox constructor. |
|
45 | - * |
|
46 | - * @param IConfig $config |
|
47 | - * @param string $principalUri |
|
48 | - */ |
|
49 | - public function __construct(IConfig $config, string $principalUri) { |
|
50 | - parent::__construct($principalUri); |
|
51 | - $this->config = $config; |
|
52 | - } |
|
43 | + /** |
|
44 | + * Outbox constructor. |
|
45 | + * |
|
46 | + * @param IConfig $config |
|
47 | + * @param string $principalUri |
|
48 | + */ |
|
49 | + public function __construct(IConfig $config, string $principalUri) { |
|
50 | + parent::__construct($principalUri); |
|
51 | + $this->config = $config; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Returns a list of ACE's for this node. |
|
56 | - * |
|
57 | - * Each ACE has the following properties: |
|
58 | - * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
59 | - * currently the only supported privileges |
|
60 | - * * 'principal', a url to the principal who owns the node |
|
61 | - * * 'protected' (optional), indicating that this ACE is not allowed to |
|
62 | - * be updated. |
|
63 | - * |
|
64 | - * @return array |
|
65 | - */ |
|
66 | - public function getACL() { |
|
67 | - // getACL is called so frequently that we cache the config result |
|
68 | - if ($this->disableFreeBusy === null) { |
|
69 | - $this->disableFreeBusy = ($this->config->getAppValue('dav', 'disableFreeBusy', 'no') === 'yes'); |
|
70 | - } |
|
54 | + /** |
|
55 | + * Returns a list of ACE's for this node. |
|
56 | + * |
|
57 | + * Each ACE has the following properties: |
|
58 | + * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
59 | + * currently the only supported privileges |
|
60 | + * * 'principal', a url to the principal who owns the node |
|
61 | + * * 'protected' (optional), indicating that this ACE is not allowed to |
|
62 | + * be updated. |
|
63 | + * |
|
64 | + * @return array |
|
65 | + */ |
|
66 | + public function getACL() { |
|
67 | + // getACL is called so frequently that we cache the config result |
|
68 | + if ($this->disableFreeBusy === null) { |
|
69 | + $this->disableFreeBusy = ($this->config->getAppValue('dav', 'disableFreeBusy', 'no') === 'yes'); |
|
70 | + } |
|
71 | 71 | |
72 | - $commonAcl = [ |
|
73 | - [ |
|
74 | - 'privilege' => '{DAV:}read', |
|
75 | - 'principal' => $this->getOwner(), |
|
76 | - 'protected' => true, |
|
77 | - ], |
|
78 | - [ |
|
79 | - 'privilege' => '{DAV:}read', |
|
80 | - 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
81 | - 'protected' => true, |
|
82 | - ], |
|
83 | - [ |
|
84 | - 'privilege' => '{DAV:}read', |
|
85 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
86 | - 'protected' => true, |
|
87 | - ], |
|
88 | - ]; |
|
72 | + $commonAcl = [ |
|
73 | + [ |
|
74 | + 'privilege' => '{DAV:}read', |
|
75 | + 'principal' => $this->getOwner(), |
|
76 | + 'protected' => true, |
|
77 | + ], |
|
78 | + [ |
|
79 | + 'privilege' => '{DAV:}read', |
|
80 | + 'principal' => $this->getOwner() . '/calendar-proxy-read', |
|
81 | + 'protected' => true, |
|
82 | + ], |
|
83 | + [ |
|
84 | + 'privilege' => '{DAV:}read', |
|
85 | + 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
86 | + 'protected' => true, |
|
87 | + ], |
|
88 | + ]; |
|
89 | 89 | |
90 | - // schedule-send is an aggregate privilege for: |
|
91 | - // - schedule-send-invite |
|
92 | - // - schedule-send-reply |
|
93 | - // - schedule-send-freebusy |
|
94 | - // |
|
95 | - // If FreeBusy is disabled, we have to remove the latter privilege |
|
90 | + // schedule-send is an aggregate privilege for: |
|
91 | + // - schedule-send-invite |
|
92 | + // - schedule-send-reply |
|
93 | + // - schedule-send-freebusy |
|
94 | + // |
|
95 | + // If FreeBusy is disabled, we have to remove the latter privilege |
|
96 | 96 | |
97 | - if ($this->disableFreeBusy) { |
|
98 | - return array_merge($commonAcl, [ |
|
99 | - [ |
|
100 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
101 | - 'principal' => $this->getOwner(), |
|
102 | - 'protected' => true, |
|
103 | - ], |
|
104 | - [ |
|
105 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
106 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
107 | - 'protected' => true, |
|
108 | - ], |
|
109 | - [ |
|
110 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
111 | - 'principal' => $this->getOwner(), |
|
112 | - 'protected' => true, |
|
113 | - ], |
|
114 | - [ |
|
115 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
116 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
117 | - 'protected' => true, |
|
118 | - ], |
|
119 | - ]); |
|
120 | - } |
|
97 | + if ($this->disableFreeBusy) { |
|
98 | + return array_merge($commonAcl, [ |
|
99 | + [ |
|
100 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
101 | + 'principal' => $this->getOwner(), |
|
102 | + 'protected' => true, |
|
103 | + ], |
|
104 | + [ |
|
105 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', |
|
106 | + 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
107 | + 'protected' => true, |
|
108 | + ], |
|
109 | + [ |
|
110 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
111 | + 'principal' => $this->getOwner(), |
|
112 | + 'protected' => true, |
|
113 | + ], |
|
114 | + [ |
|
115 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', |
|
116 | + 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
117 | + 'protected' => true, |
|
118 | + ], |
|
119 | + ]); |
|
120 | + } |
|
121 | 121 | |
122 | - return array_merge($commonAcl, [ |
|
123 | - [ |
|
124 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
125 | - 'principal' => $this->getOwner(), |
|
126 | - 'protected' => true, |
|
127 | - ], |
|
128 | - [ |
|
129 | - 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
130 | - 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
131 | - 'protected' => true, |
|
132 | - ], |
|
133 | - ]); |
|
134 | - } |
|
122 | + return array_merge($commonAcl, [ |
|
123 | + [ |
|
124 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
125 | + 'principal' => $this->getOwner(), |
|
126 | + 'protected' => true, |
|
127 | + ], |
|
128 | + [ |
|
129 | + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', |
|
130 | + 'principal' => $this->getOwner() . '/calendar-proxy-write', |
|
131 | + 'protected' => true, |
|
132 | + ], |
|
133 | + ]); |
|
134 | + } |
|
135 | 135 | } |
@@ -73,17 +73,17 @@ |
||
73 | 73 | |
74 | 74 | try { |
75 | 75 | $jobStartTime = $this->time->getTime(); |
76 | - $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); |
|
76 | + $logger->debug('Run '.get_class($this).' job with ID '.$this->getId(), ['app' => 'cron']); |
|
77 | 77 | $this->run($this->argument); |
78 | 78 | $timeTaken = $this->time->getTime() - $jobStartTime; |
79 | 79 | |
80 | - $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); |
|
80 | + $logger->debug('Finished '.get_class($this).' job with ID '.$this->getId().' in '.$timeTaken.' seconds', ['app' => 'cron']); |
|
81 | 81 | $jobList->setExecutionTime($this, $timeTaken); |
82 | 82 | } catch (\Exception $e) { |
83 | 83 | if ($logger) { |
84 | 84 | $logger->logException($e, [ |
85 | 85 | 'app' => 'core', |
86 | - 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' |
|
86 | + 'message' => 'Error while running background job (class: '.get_class($this).', arguments: '.print_r($this->argument, true).')' |
|
87 | 87 | ]); |
88 | 88 | } |
89 | 89 | } |
@@ -40,106 +40,106 @@ |
||
40 | 40 | */ |
41 | 41 | abstract class Job implements IJob { |
42 | 42 | |
43 | - /** @var int $id */ |
|
44 | - protected $id; |
|
45 | - |
|
46 | - /** @var int $lastRun */ |
|
47 | - protected $lastRun; |
|
48 | - |
|
49 | - /** @var mixed $argument */ |
|
50 | - protected $argument; |
|
51 | - |
|
52 | - /** @var ITimeFactory */ |
|
53 | - protected $time; |
|
54 | - |
|
55 | - /** |
|
56 | - * @since 15.0.0 |
|
57 | - */ |
|
58 | - public function __construct(ITimeFactory $time) { |
|
59 | - $this->time = $time; |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * The function to prepare the execution of the job. |
|
64 | - * |
|
65 | - * |
|
66 | - * @param IJobList $jobList |
|
67 | - * @param ILogger|null $logger |
|
68 | - * |
|
69 | - * @since 15.0.0 |
|
70 | - */ |
|
71 | - public function execute(IJobList $jobList, ILogger $logger = null) { |
|
72 | - $jobList->setLastRun($this); |
|
73 | - if ($logger === null) { |
|
74 | - $logger = \OC::$server->getLogger(); |
|
75 | - } |
|
76 | - |
|
77 | - try { |
|
78 | - $jobStartTime = $this->time->getTime(); |
|
79 | - $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); |
|
80 | - $this->run($this->argument); |
|
81 | - $timeTaken = $this->time->getTime() - $jobStartTime; |
|
82 | - |
|
83 | - $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); |
|
84 | - $jobList->setExecutionTime($this, $timeTaken); |
|
85 | - } catch (\Exception $e) { |
|
86 | - if ($logger) { |
|
87 | - $logger->logException($e, [ |
|
88 | - 'app' => 'core', |
|
89 | - 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' |
|
90 | - ]); |
|
91 | - } |
|
92 | - } |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * @since 15.0.0 |
|
97 | - */ |
|
98 | - final public function setId(int $id) { |
|
99 | - $this->id = $id; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * @since 15.0.0 |
|
104 | - */ |
|
105 | - final public function setLastRun(int $lastRun) { |
|
106 | - $this->lastRun = $lastRun; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * @since 15.0.0 |
|
111 | - */ |
|
112 | - public function setArgument($argument) { |
|
113 | - $this->argument = $argument; |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @since 15.0.0 |
|
118 | - */ |
|
119 | - final public function getId(): int { |
|
120 | - return $this->id; |
|
121 | - } |
|
122 | - |
|
123 | - /** |
|
124 | - * @since 15.0.0 |
|
125 | - */ |
|
126 | - final public function getLastRun(): int { |
|
127 | - return $this->lastRun; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @since 15.0.0 |
|
132 | - */ |
|
133 | - public function getArgument() { |
|
134 | - return $this->argument; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * The actual function that is called to run the job |
|
139 | - * |
|
140 | - * @param $argument |
|
141 | - * |
|
142 | - * @since 15.0.0 |
|
143 | - */ |
|
144 | - abstract protected function run($argument); |
|
43 | + /** @var int $id */ |
|
44 | + protected $id; |
|
45 | + |
|
46 | + /** @var int $lastRun */ |
|
47 | + protected $lastRun; |
|
48 | + |
|
49 | + /** @var mixed $argument */ |
|
50 | + protected $argument; |
|
51 | + |
|
52 | + /** @var ITimeFactory */ |
|
53 | + protected $time; |
|
54 | + |
|
55 | + /** |
|
56 | + * @since 15.0.0 |
|
57 | + */ |
|
58 | + public function __construct(ITimeFactory $time) { |
|
59 | + $this->time = $time; |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * The function to prepare the execution of the job. |
|
64 | + * |
|
65 | + * |
|
66 | + * @param IJobList $jobList |
|
67 | + * @param ILogger|null $logger |
|
68 | + * |
|
69 | + * @since 15.0.0 |
|
70 | + */ |
|
71 | + public function execute(IJobList $jobList, ILogger $logger = null) { |
|
72 | + $jobList->setLastRun($this); |
|
73 | + if ($logger === null) { |
|
74 | + $logger = \OC::$server->getLogger(); |
|
75 | + } |
|
76 | + |
|
77 | + try { |
|
78 | + $jobStartTime = $this->time->getTime(); |
|
79 | + $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']); |
|
80 | + $this->run($this->argument); |
|
81 | + $timeTaken = $this->time->getTime() - $jobStartTime; |
|
82 | + |
|
83 | + $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']); |
|
84 | + $jobList->setExecutionTime($this, $timeTaken); |
|
85 | + } catch (\Exception $e) { |
|
86 | + if ($logger) { |
|
87 | + $logger->logException($e, [ |
|
88 | + 'app' => 'core', |
|
89 | + 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' |
|
90 | + ]); |
|
91 | + } |
|
92 | + } |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * @since 15.0.0 |
|
97 | + */ |
|
98 | + final public function setId(int $id) { |
|
99 | + $this->id = $id; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * @since 15.0.0 |
|
104 | + */ |
|
105 | + final public function setLastRun(int $lastRun) { |
|
106 | + $this->lastRun = $lastRun; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * @since 15.0.0 |
|
111 | + */ |
|
112 | + public function setArgument($argument) { |
|
113 | + $this->argument = $argument; |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @since 15.0.0 |
|
118 | + */ |
|
119 | + final public function getId(): int { |
|
120 | + return $this->id; |
|
121 | + } |
|
122 | + |
|
123 | + /** |
|
124 | + * @since 15.0.0 |
|
125 | + */ |
|
126 | + final public function getLastRun(): int { |
|
127 | + return $this->lastRun; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @since 15.0.0 |
|
132 | + */ |
|
133 | + public function getArgument() { |
|
134 | + return $this->argument; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * The actual function that is called to run the job |
|
139 | + * |
|
140 | + * @param $argument |
|
141 | + * |
|
142 | + * @since 15.0.0 |
|
143 | + */ |
|
144 | + abstract protected function run($argument); |
|
145 | 145 | } |
@@ -33,16 +33,16 @@ |
||
33 | 33 | */ |
34 | 34 | abstract class QueuedJob extends Job { |
35 | 35 | |
36 | - /** |
|
37 | - * run the job, then remove it from the joblist |
|
38 | - * |
|
39 | - * @param IJobList $jobList |
|
40 | - * @param ILogger|null $logger |
|
41 | - * |
|
42 | - * @since 15.0.0 |
|
43 | - */ |
|
44 | - final public function execute($jobList, ILogger $logger = null) { |
|
45 | - $jobList->remove($this, $this->argument); |
|
46 | - parent::execute($jobList, $logger); |
|
47 | - } |
|
36 | + /** |
|
37 | + * run the job, then remove it from the joblist |
|
38 | + * |
|
39 | + * @param IJobList $jobList |
|
40 | + * @param ILogger|null $logger |
|
41 | + * |
|
42 | + * @since 15.0.0 |
|
43 | + */ |
|
44 | + final public function execute($jobList, ILogger $logger = null) { |
|
45 | + $jobList->remove($this, $this->argument); |
|
46 | + parent::execute($jobList, $logger); |
|
47 | + } |
|
48 | 48 | } |