@@ -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 | } |
@@ -33,18 +33,18 @@ |
||
33 | 33 | * @since 14.0.0 |
34 | 34 | */ |
35 | 35 | class ProviderAlreadyExistsException extends HintException { |
36 | - /** |
|
37 | - * ProviderAlreadyExistsException constructor. |
|
38 | - * |
|
39 | - * @since 14.0.0 |
|
40 | - * |
|
41 | - * @param string $newProviderId cloud federation provider ID of the new provider |
|
42 | - * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
43 | - */ |
|
44 | - public function __construct($newProviderId, $existingProviderName) { |
|
45 | - $l = \OC::$server->getL10N('federation'); |
|
46 | - $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
47 | - $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
48 | - parent::__construct($message, $hint); |
|
49 | - } |
|
36 | + /** |
|
37 | + * ProviderAlreadyExistsException constructor. |
|
38 | + * |
|
39 | + * @since 14.0.0 |
|
40 | + * |
|
41 | + * @param string $newProviderId cloud federation provider ID of the new provider |
|
42 | + * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
43 | + */ |
|
44 | + public function __construct($newProviderId, $existingProviderName) { |
|
45 | + $l = \OC::$server->getL10N('federation'); |
|
46 | + $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
47 | + $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
48 | + parent::__construct($message, $hint); |
|
49 | + } |
|
50 | 50 | } |
@@ -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> |
@@ -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 | } |
@@ -35,74 +35,74 @@ |
||
35 | 35 | use Symfony\Component\Console\Output\OutputInterface; |
36 | 36 | |
37 | 37 | class Enforce extends Command { |
38 | - private MandatoryTwoFactor $mandatoryTwoFactor; |
|
38 | + private MandatoryTwoFactor $mandatoryTwoFactor; |
|
39 | 39 | |
40 | - public function __construct(MandatoryTwoFactor $mandatoryTwoFactor) { |
|
41 | - parent::__construct(); |
|
40 | + public function __construct(MandatoryTwoFactor $mandatoryTwoFactor) { |
|
41 | + parent::__construct(); |
|
42 | 42 | |
43 | - $this->mandatoryTwoFactor = $mandatoryTwoFactor; |
|
44 | - } |
|
43 | + $this->mandatoryTwoFactor = $mandatoryTwoFactor; |
|
44 | + } |
|
45 | 45 | |
46 | - protected function configure() { |
|
47 | - $this->setName('twofactorauth:enforce'); |
|
48 | - $this->setDescription('Enabled/disable enforced two-factor authentication'); |
|
49 | - $this->addOption( |
|
50 | - 'on', |
|
51 | - null, |
|
52 | - InputOption::VALUE_NONE, |
|
53 | - 'enforce two-factor authentication' |
|
54 | - ); |
|
55 | - $this->addOption( |
|
56 | - 'off', |
|
57 | - null, |
|
58 | - InputOption::VALUE_NONE, |
|
59 | - 'don\'t enforce two-factor authenticaton' |
|
60 | - ); |
|
61 | - $this->addOption( |
|
62 | - 'group', |
|
63 | - null, |
|
64 | - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
65 | - 'enforce only for the given group(s)' |
|
66 | - ); |
|
67 | - $this->addOption( |
|
68 | - 'exclude', |
|
69 | - null, |
|
70 | - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
71 | - 'exclude mandatory two-factor auth for the given group(s)' |
|
72 | - ); |
|
73 | - } |
|
46 | + protected function configure() { |
|
47 | + $this->setName('twofactorauth:enforce'); |
|
48 | + $this->setDescription('Enabled/disable enforced two-factor authentication'); |
|
49 | + $this->addOption( |
|
50 | + 'on', |
|
51 | + null, |
|
52 | + InputOption::VALUE_NONE, |
|
53 | + 'enforce two-factor authentication' |
|
54 | + ); |
|
55 | + $this->addOption( |
|
56 | + 'off', |
|
57 | + null, |
|
58 | + InputOption::VALUE_NONE, |
|
59 | + 'don\'t enforce two-factor authenticaton' |
|
60 | + ); |
|
61 | + $this->addOption( |
|
62 | + 'group', |
|
63 | + null, |
|
64 | + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
65 | + 'enforce only for the given group(s)' |
|
66 | + ); |
|
67 | + $this->addOption( |
|
68 | + 'exclude', |
|
69 | + null, |
|
70 | + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, |
|
71 | + 'exclude mandatory two-factor auth for the given group(s)' |
|
72 | + ); |
|
73 | + } |
|
74 | 74 | |
75 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
76 | - if ($input->getOption('on')) { |
|
77 | - $enforcedGroups = $input->getOption('group'); |
|
78 | - $excludedGroups = $input->getOption('exclude'); |
|
79 | - $this->mandatoryTwoFactor->setState(new EnforcementState(true, $enforcedGroups, $excludedGroups)); |
|
80 | - } elseif ($input->getOption('off')) { |
|
81 | - $this->mandatoryTwoFactor->setState(new EnforcementState(false)); |
|
82 | - } |
|
75 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
76 | + if ($input->getOption('on')) { |
|
77 | + $enforcedGroups = $input->getOption('group'); |
|
78 | + $excludedGroups = $input->getOption('exclude'); |
|
79 | + $this->mandatoryTwoFactor->setState(new EnforcementState(true, $enforcedGroups, $excludedGroups)); |
|
80 | + } elseif ($input->getOption('off')) { |
|
81 | + $this->mandatoryTwoFactor->setState(new EnforcementState(false)); |
|
82 | + } |
|
83 | 83 | |
84 | - $state = $this->mandatoryTwoFactor->getState(); |
|
85 | - if ($state->isEnforced()) { |
|
86 | - $this->writeEnforced($output, $state); |
|
87 | - } else { |
|
88 | - $this->writeNotEnforced($output); |
|
89 | - } |
|
90 | - return 0; |
|
91 | - } |
|
84 | + $state = $this->mandatoryTwoFactor->getState(); |
|
85 | + if ($state->isEnforced()) { |
|
86 | + $this->writeEnforced($output, $state); |
|
87 | + } else { |
|
88 | + $this->writeNotEnforced($output); |
|
89 | + } |
|
90 | + return 0; |
|
91 | + } |
|
92 | 92 | |
93 | - protected function writeEnforced(OutputInterface $output, EnforcementState $state) { |
|
94 | - if (empty($state->getEnforcedGroups())) { |
|
95 | - $message = 'Two-factor authentication is enforced for all users'; |
|
96 | - } else { |
|
97 | - $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
98 | - } |
|
99 | - if (!empty($state->getExcludedGroups())) { |
|
100 | - $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
101 | - } |
|
102 | - $output->writeln($message); |
|
103 | - } |
|
93 | + protected function writeEnforced(OutputInterface $output, EnforcementState $state) { |
|
94 | + if (empty($state->getEnforcedGroups())) { |
|
95 | + $message = 'Two-factor authentication is enforced for all users'; |
|
96 | + } else { |
|
97 | + $message = 'Two-factor authentication is enforced for members of the group(s) ' . implode(', ', $state->getEnforcedGroups()); |
|
98 | + } |
|
99 | + if (!empty($state->getExcludedGroups())) { |
|
100 | + $message .= ', except members of ' . implode(', ', $state->getExcludedGroups()); |
|
101 | + } |
|
102 | + $output->writeln($message); |
|
103 | + } |
|
104 | 104 | |
105 | - protected function writeNotEnforced(OutputInterface $output) { |
|
106 | - $output->writeln('Two-factor authentication is not enforced'); |
|
107 | - } |
|
105 | + protected function writeNotEnforced(OutputInterface $output) { |
|
106 | + $output->writeln('Two-factor authentication is not enforced'); |
|
107 | + } |
|
108 | 108 | } |
@@ -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 | } |
@@ -24,33 +24,33 @@ |
||
24 | 24 | use OCP\IUser; |
25 | 25 | |
26 | 26 | interface ITrashManager extends ITrashBackend { |
27 | - /** |
|
28 | - * Add a backend for the trashbin |
|
29 | - * |
|
30 | - * @param string $storageType |
|
31 | - * @param ITrashBackend $backend |
|
32 | - * @since 15.0.0 |
|
33 | - */ |
|
34 | - public function registerBackend(string $storageType, ITrashBackend $backend); |
|
27 | + /** |
|
28 | + * Add a backend for the trashbin |
|
29 | + * |
|
30 | + * @param string $storageType |
|
31 | + * @param ITrashBackend $backend |
|
32 | + * @since 15.0.0 |
|
33 | + */ |
|
34 | + public function registerBackend(string $storageType, ITrashBackend $backend); |
|
35 | 35 | |
36 | - /** |
|
37 | - * List all trash items in the root of the trashbin |
|
38 | - * |
|
39 | - * @param IUser $user |
|
40 | - * @return ITrashItem[] |
|
41 | - * @since 15.0.0 |
|
42 | - */ |
|
43 | - public function listTrashRoot(IUser $user): array; |
|
36 | + /** |
|
37 | + * List all trash items in the root of the trashbin |
|
38 | + * |
|
39 | + * @param IUser $user |
|
40 | + * @return ITrashItem[] |
|
41 | + * @since 15.0.0 |
|
42 | + */ |
|
43 | + public function listTrashRoot(IUser $user): array; |
|
44 | 44 | |
45 | - /** |
|
46 | - * Temporally prevent files from being moved to the trash |
|
47 | - * |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function pauseTrash(); |
|
45 | + /** |
|
46 | + * Temporally prevent files from being moved to the trash |
|
47 | + * |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function pauseTrash(); |
|
51 | 51 | |
52 | - /** |
|
53 | - * @since 15.0.0 |
|
54 | - */ |
|
55 | - public function resumeTrash(); |
|
52 | + /** |
|
53 | + * @since 15.0.0 |
|
54 | + */ |
|
55 | + public function resumeTrash(); |
|
56 | 56 | } |
@@ -31,54 +31,54 @@ |
||
31 | 31 | * @since 15.0.0 |
32 | 32 | */ |
33 | 33 | interface ITrashBackend { |
34 | - /** |
|
35 | - * List all trash items in the root of the trashbin |
|
36 | - * |
|
37 | - * @param IUser $user |
|
38 | - * @return ITrashItem[] |
|
39 | - * @since 15.0.0 |
|
40 | - */ |
|
41 | - public function listTrashRoot(IUser $user): array; |
|
34 | + /** |
|
35 | + * List all trash items in the root of the trashbin |
|
36 | + * |
|
37 | + * @param IUser $user |
|
38 | + * @return ITrashItem[] |
|
39 | + * @since 15.0.0 |
|
40 | + */ |
|
41 | + public function listTrashRoot(IUser $user): array; |
|
42 | 42 | |
43 | - /** |
|
44 | - * List all trash items in a subfolder in the trashbin |
|
45 | - * |
|
46 | - * @param ITrashItem $folder |
|
47 | - * @return ITrashItem[] |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function listTrashFolder(ITrashItem $folder): array; |
|
43 | + /** |
|
44 | + * List all trash items in a subfolder in the trashbin |
|
45 | + * |
|
46 | + * @param ITrashItem $folder |
|
47 | + * @return ITrashItem[] |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function listTrashFolder(ITrashItem $folder): array; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Restore a trashbin item |
|
54 | - * |
|
55 | - * @param ITrashItem $item |
|
56 | - * @since 15.0.0 |
|
57 | - */ |
|
58 | - public function restoreItem(ITrashItem $item); |
|
52 | + /** |
|
53 | + * Restore a trashbin item |
|
54 | + * |
|
55 | + * @param ITrashItem $item |
|
56 | + * @since 15.0.0 |
|
57 | + */ |
|
58 | + public function restoreItem(ITrashItem $item); |
|
59 | 59 | |
60 | - /** |
|
61 | - * Permanently remove an item from trash |
|
62 | - * |
|
63 | - * @param ITrashItem $item |
|
64 | - * @since 15.0.0 |
|
65 | - */ |
|
66 | - public function removeItem(ITrashItem $item); |
|
60 | + /** |
|
61 | + * Permanently remove an item from trash |
|
62 | + * |
|
63 | + * @param ITrashItem $item |
|
64 | + * @since 15.0.0 |
|
65 | + */ |
|
66 | + public function removeItem(ITrashItem $item); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Move a file or folder to trash |
|
70 | - * |
|
71 | - * @param IStorage $storage |
|
72 | - * @param string $internalPath |
|
73 | - * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally |
|
74 | - * @since 15.0.0 |
|
75 | - */ |
|
76 | - public function moveToTrash(IStorage $storage, string $internalPath): bool; |
|
68 | + /** |
|
69 | + * Move a file or folder to trash |
|
70 | + * |
|
71 | + * @param IStorage $storage |
|
72 | + * @param string $internalPath |
|
73 | + * @return boolean whether or not the file was moved to trash, if false then the file should be deleted normally |
|
74 | + * @since 15.0.0 |
|
75 | + */ |
|
76 | + public function moveToTrash(IStorage $storage, string $internalPath): bool; |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param IUser $user |
|
80 | - * @param int $fileId |
|
81 | - * @return Node|null |
|
82 | - */ |
|
83 | - public function getTrashNodeById(IUser $user, int $fileId); |
|
78 | + /** |
|
79 | + * @param IUser $user |
|
80 | + * @param int $fileId |
|
81 | + * @return Node|null |
|
82 | + */ |
|
83 | + public function getTrashNodeById(IUser $user, int $fileId); |
|
84 | 84 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | public function getChildren(): array { |
68 | 68 | $entries = $this->trashManager->listTrashRoot($this->user); |
69 | 69 | |
70 | - $children = array_map(function (ITrashItem $entry) { |
|
70 | + $children = array_map(function(ITrashItem $entry) { |
|
71 | 71 | if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
72 | 72 | return new TrashFolder($this->trashManager, $entry); |
73 | 73 | } |
@@ -37,75 +37,75 @@ |
||
37 | 37 | |
38 | 38 | class TrashRoot implements ICollection { |
39 | 39 | |
40 | - /** @var IUser */ |
|
41 | - private $user; |
|
42 | - |
|
43 | - /** @var ITrashManager */ |
|
44 | - private $trashManager; |
|
45 | - |
|
46 | - public function __construct(IUser $user, ITrashManager $trashManager) { |
|
47 | - $this->user = $user; |
|
48 | - $this->trashManager = $trashManager; |
|
49 | - } |
|
50 | - |
|
51 | - public function delete() { |
|
52 | - \OCA\Files_Trashbin\Trashbin::deleteAll(); |
|
53 | - foreach ($this->trashManager->listTrashRoot($this->user) as $trashItem) { |
|
54 | - $this->trashManager->removeItem($trashItem); |
|
55 | - } |
|
56 | - } |
|
57 | - |
|
58 | - public function getName(): string { |
|
59 | - return 'trash'; |
|
60 | - } |
|
61 | - |
|
62 | - public function setName($name) { |
|
63 | - throw new Forbidden('Permission denied to rename this trashbin'); |
|
64 | - } |
|
65 | - |
|
66 | - public function createFile($name, $data = null) { |
|
67 | - throw new Forbidden('Not allowed to create files in the trashbin'); |
|
68 | - } |
|
69 | - |
|
70 | - public function createDirectory($name) { |
|
71 | - throw new Forbidden('Not allowed to create folders in the trashbin'); |
|
72 | - } |
|
73 | - |
|
74 | - public function getChildren(): array { |
|
75 | - $entries = $this->trashManager->listTrashRoot($this->user); |
|
76 | - |
|
77 | - $children = array_map(function (ITrashItem $entry) { |
|
78 | - if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
79 | - return new TrashFolder($this->trashManager, $entry); |
|
80 | - } |
|
81 | - return new TrashFile($this->trashManager, $entry); |
|
82 | - }, $entries); |
|
83 | - |
|
84 | - return $children; |
|
85 | - } |
|
86 | - |
|
87 | - public function getChild($name): ITrash { |
|
88 | - $entries = $this->getChildren(); |
|
89 | - |
|
90 | - foreach ($entries as $entry) { |
|
91 | - if ($entry->getName() === $name) { |
|
92 | - return $entry; |
|
93 | - } |
|
94 | - } |
|
95 | - |
|
96 | - throw new NotFound(); |
|
97 | - } |
|
98 | - |
|
99 | - public function childExists($name): bool { |
|
100 | - try { |
|
101 | - $this->getChild($name); |
|
102 | - return true; |
|
103 | - } catch (NotFound $e) { |
|
104 | - return false; |
|
105 | - } |
|
106 | - } |
|
107 | - |
|
108 | - public function getLastModified(): int { |
|
109 | - return 0; |
|
110 | - } |
|
40 | + /** @var IUser */ |
|
41 | + private $user; |
|
42 | + |
|
43 | + /** @var ITrashManager */ |
|
44 | + private $trashManager; |
|
45 | + |
|
46 | + public function __construct(IUser $user, ITrashManager $trashManager) { |
|
47 | + $this->user = $user; |
|
48 | + $this->trashManager = $trashManager; |
|
49 | + } |
|
50 | + |
|
51 | + public function delete() { |
|
52 | + \OCA\Files_Trashbin\Trashbin::deleteAll(); |
|
53 | + foreach ($this->trashManager->listTrashRoot($this->user) as $trashItem) { |
|
54 | + $this->trashManager->removeItem($trashItem); |
|
55 | + } |
|
56 | + } |
|
57 | + |
|
58 | + public function getName(): string { |
|
59 | + return 'trash'; |
|
60 | + } |
|
61 | + |
|
62 | + public function setName($name) { |
|
63 | + throw new Forbidden('Permission denied to rename this trashbin'); |
|
64 | + } |
|
65 | + |
|
66 | + public function createFile($name, $data = null) { |
|
67 | + throw new Forbidden('Not allowed to create files in the trashbin'); |
|
68 | + } |
|
69 | + |
|
70 | + public function createDirectory($name) { |
|
71 | + throw new Forbidden('Not allowed to create folders in the trashbin'); |
|
72 | + } |
|
73 | + |
|
74 | + public function getChildren(): array { |
|
75 | + $entries = $this->trashManager->listTrashRoot($this->user); |
|
76 | + |
|
77 | + $children = array_map(function (ITrashItem $entry) { |
|
78 | + if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
79 | + return new TrashFolder($this->trashManager, $entry); |
|
80 | + } |
|
81 | + return new TrashFile($this->trashManager, $entry); |
|
82 | + }, $entries); |
|
83 | + |
|
84 | + return $children; |
|
85 | + } |
|
86 | + |
|
87 | + public function getChild($name): ITrash { |
|
88 | + $entries = $this->getChildren(); |
|
89 | + |
|
90 | + foreach ($entries as $entry) { |
|
91 | + if ($entry->getName() === $name) { |
|
92 | + return $entry; |
|
93 | + } |
|
94 | + } |
|
95 | + |
|
96 | + throw new NotFound(); |
|
97 | + } |
|
98 | + |
|
99 | + public function childExists($name): bool { |
|
100 | + try { |
|
101 | + $this->getChild($name); |
|
102 | + return true; |
|
103 | + } catch (NotFound $e) { |
|
104 | + return false; |
|
105 | + } |
|
106 | + } |
|
107 | + |
|
108 | + public function getLastModified(): int { |
|
109 | + return 0; |
|
110 | + } |
|
111 | 111 | } |
@@ -29,49 +29,49 @@ |
||
29 | 29 | use Sabre\DAV\ICollection; |
30 | 30 | |
31 | 31 | abstract class AbstractTrashFolder extends AbstractTrash implements ICollection, ITrash { |
32 | - public function getChildren(): array { |
|
33 | - $entries = $this->trashManager->listTrashFolder($this->data); |
|
32 | + public function getChildren(): array { |
|
33 | + $entries = $this->trashManager->listTrashFolder($this->data); |
|
34 | 34 | |
35 | - $children = array_map(function (ITrashItem $entry) { |
|
36 | - if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
37 | - return new TrashFolderFolder($this->trashManager, $entry); |
|
38 | - } |
|
39 | - return new TrashFolderFile($this->trashManager, $entry); |
|
40 | - }, $entries); |
|
35 | + $children = array_map(function (ITrashItem $entry) { |
|
36 | + if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
37 | + return new TrashFolderFolder($this->trashManager, $entry); |
|
38 | + } |
|
39 | + return new TrashFolderFile($this->trashManager, $entry); |
|
40 | + }, $entries); |
|
41 | 41 | |
42 | - return $children; |
|
43 | - } |
|
42 | + return $children; |
|
43 | + } |
|
44 | 44 | |
45 | - public function getChild($name): ITrash { |
|
46 | - $entries = $this->getChildren(); |
|
45 | + public function getChild($name): ITrash { |
|
46 | + $entries = $this->getChildren(); |
|
47 | 47 | |
48 | - foreach ($entries as $entry) { |
|
49 | - if ($entry->getName() === $name) { |
|
50 | - return $entry; |
|
51 | - } |
|
52 | - } |
|
48 | + foreach ($entries as $entry) { |
|
49 | + if ($entry->getName() === $name) { |
|
50 | + return $entry; |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - throw new NotFound(); |
|
55 | - } |
|
54 | + throw new NotFound(); |
|
55 | + } |
|
56 | 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 | - } |
|
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 | 65 | |
66 | - public function setName($name) { |
|
67 | - throw new Forbidden(); |
|
68 | - } |
|
66 | + public function setName($name) { |
|
67 | + throw new Forbidden(); |
|
68 | + } |
|
69 | 69 | |
70 | - public function createFile($name, $data = null) { |
|
71 | - throw new Forbidden(); |
|
72 | - } |
|
70 | + public function createFile($name, $data = null) { |
|
71 | + throw new Forbidden(); |
|
72 | + } |
|
73 | 73 | |
74 | - public function createDirectory($name) { |
|
75 | - throw new Forbidden(); |
|
76 | - } |
|
74 | + public function createDirectory($name) { |
|
75 | + throw new Forbidden(); |
|
76 | + } |
|
77 | 77 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function getChildren(): array { |
33 | 33 | $entries = $this->trashManager->listTrashFolder($this->data); |
34 | 34 | |
35 | - $children = array_map(function (ITrashItem $entry) { |
|
35 | + $children = array_map(function(ITrashItem $entry) { |
|
36 | 36 | if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
37 | 37 | return new TrashFolderFolder($this->trashManager, $entry); |
38 | 38 | } |
@@ -26,16 +26,16 @@ |
||
26 | 26 | use OC\Authentication\Token\IToken; |
27 | 27 | |
28 | 28 | class ExpiredTokenException extends InvalidTokenException { |
29 | - /** @var IToken */ |
|
30 | - private $token; |
|
29 | + /** @var IToken */ |
|
30 | + private $token; |
|
31 | 31 | |
32 | - public function __construct(IToken $token) { |
|
33 | - parent::__construct(); |
|
32 | + public function __construct(IToken $token) { |
|
33 | + parent::__construct(); |
|
34 | 34 | |
35 | - $this->token = $token; |
|
36 | - } |
|
35 | + $this->token = $token; |
|
36 | + } |
|
37 | 37 | |
38 | - public function getToken(): IToken { |
|
39 | - return $this->token; |
|
40 | - } |
|
38 | + public function getToken(): IToken { |
|
39 | + return $this->token; |
|
40 | + } |
|
41 | 41 | } |