diff options
m--------- | 3rdparty | 0 | ||||
-rw-r--r-- | apps/comments/js/commentsmodifymenu.js | 20 | ||||
-rw-r--r-- | apps/comments/js/filesplugin.js | 10 | ||||
-rw-r--r-- | apps/comments/js/templates.js | 36 | ||||
-rw-r--r-- | apps/comments/js/templates/commentsmodifymenu.handlebars | 14 | ||||
-rw-r--r-- | apps/comments/js/templates/filesplugin.handlebars | 3 | ||||
-rw-r--r-- | apps/dav/composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | apps/dav/composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/CalendarHome.php | 5 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/Outbox.php | 132 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Principal.php | 10 | ||||
-rw-r--r-- | apps/dav/tests/unit/CalDAV/OutboxTest.php | 123 | ||||
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php | 139 | ||||
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 2 | ||||
-rw-r--r-- | core/Controller/CssController.php | 1 | ||||
-rw-r--r-- | core/Controller/JsController.php | 1 | ||||
-rw-r--r-- | core/Controller/SvgController.php | 2 | ||||
-rw-r--r-- | lib/private/Settings/Personal/Security.php | 1 | ||||
-rw-r--r-- | settings/templates/settings/personal/security.php | 9 |
19 files changed, 366 insertions, 144 deletions
diff --git a/3rdparty b/3rdparty -Subproject 3fa9e3b916013dcef794b44829b99331f5abe3e +Subproject ae66d5646abbade298a6595e5cd29d5ce7ecbca diff --git a/apps/comments/js/commentsmodifymenu.js b/apps/comments/js/commentsmodifymenu.js index 4b17cbbfbf0..fd1e3d80bd0 100644 --- a/apps/comments/js/commentsmodifymenu.js +++ b/apps/comments/js/commentsmodifymenu.js @@ -10,20 +10,6 @@ /* global Handlebars */ (function() { - var TEMPLATE_MENU = - '<ul>' + - '{{#each items}}' + - '<li>' + - '<a href="#" class="menuitem action {{name}} permanent" data-action="{{name}}">' + - '{{#if iconClass}}' + - '<span class="icon {{iconClass}}"></span>' + - '{{else}}' + - '<span class="no-icon"></span>' + - '{{/if}}' + - '<span>{{displayName}}</span>' + - '</li>' + - '{{/each}}' + - '</ul>'; /** * Construct a new CommentsModifyMenuinstance @@ -52,8 +38,6 @@ 'click a.action': '_onClickAction' }, - template: Handlebars.compile(TEMPLATE_MENU), - /** * Event handler whenever an action has been clicked within the menu * @@ -74,7 +58,7 @@ * Renders the menu with the currently set items */ render: function() { - this.$el.html(this.template({ + this.$el.html(OCA.Comments.Templates['commentsmodifymenu']({ items: this._scopes })); }, @@ -121,4 +105,4 @@ OCA.Comments = OCA.Comments || {}; OCA.Comments.CommentsModifyMenu = CommentsModifyMenu; -})(OC, OCA);
\ No newline at end of file +})(OC, OCA); diff --git a/apps/comments/js/filesplugin.js b/apps/comments/js/filesplugin.js index 8c5762065a1..939edc8c695 100644 --- a/apps/comments/js/filesplugin.js +++ b/apps/comments/js/filesplugin.js @@ -16,11 +16,6 @@ PROPERTY_COMMENTS_UNREAD: '{' + OC.Files.Client.NS_OWNCLOUD + '}comments-unread' }); - var TEMPLATE_COMMENTS_UNREAD = - '<a class="action action-comment permanent" title="{{countMessage}}" href="#">' + - '<img class="svg" src="{{iconUrl}}"/>' + - '</a>'; - OCA.Comments = _.extend({}, OCA.Comments); if (!OCA.Comments) { /** @@ -39,10 +34,7 @@ ], _formatCommentCount: function(count) { - if (!this._commentsUnreadTemplate) { - this._commentsUnreadTemplate = Handlebars.compile(TEMPLATE_COMMENTS_UNREAD); - } - return this._commentsUnreadTemplate({ + return OCA.Comments.Templates['filesplugin']({ count: count, countMessage: n('comments', '%n unread comment', '%n unread comments', count), iconUrl: OC.imagePath('core', 'actions/comment') diff --git a/apps/comments/js/templates.js b/apps/comments/js/templates.js index a5706baa27e..26ca658c772 100644 --- a/apps/comments/js/templates.js +++ b/apps/comments/js/templates.js @@ -46,6 +46,33 @@ templates['comment'] = template({"1":function(container,depth0,helpers,partials, + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isLong : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "</li>\n"; },"useData":true}); +templates['commentsmodifymenu'] = template({"1":function(container,depth0,helpers,partials,data) { + var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return " <li>\n <a href=\"#\" class=\"menuitem action " + + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper))) + + " permanent\" data-action=\"" + + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper))) + + "\">\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.iconClass : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : "") + + " <span>" + + alias4(((helper = (helper = helpers.displayName || (depth0 != null ? depth0.displayName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"displayName","hash":{},"data":data}) : helper))) + + "</span>\n </a>\n </li>\n"; +},"2":function(container,depth0,helpers,partials,data) { + var helper; + + return " <span class=\"icon " + + container.escapeExpression(((helper = (helper = helpers.iconClass || (depth0 != null ? depth0.iconClass : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"iconClass","hash":{},"data":data}) : helper))) + + "\"></span>\n"; +},"4":function(container,depth0,helpers,partials,data) { + return " <span class=\"no-icon\"></span>\n"; +},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { + var stack1; + + return "<ul>\n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.items : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "</ul>\n"; +},"useData":true}); templates['edit_comment'] = template({"1":function(container,depth0,helpers,partials,data) { var helper; @@ -75,6 +102,15 @@ templates['edit_comment'] = template({"1":function(container,depth0,helpers,part + alias4(((helper = (helper = helpers.tag || (depth0 != null ? depth0.tag : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"tag","hash":{},"data":data}) : helper))) + ">\n"; },"useData":true}); +templates['filesplugin'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { + var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return "<a class=\"action action-comment permanent\" title=\"" + + alias4(((helper = (helper = helpers.countMessage || (depth0 != null ? depth0.countMessage : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"countMessage","hash":{},"data":data}) : helper))) + + "\" href=\"#\">\n <img class=\"svg\" src=\"" + + alias4(((helper = (helper = helpers.iconUrl || (depth0 != null ? depth0.iconUrl : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"iconUrl","hash":{},"data":data}) : helper))) + + "\"/>\n</a>\n"; +},"useData":true}); templates['view'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; diff --git a/apps/comments/js/templates/commentsmodifymenu.handlebars b/apps/comments/js/templates/commentsmodifymenu.handlebars new file mode 100644 index 00000000000..28f6ffcdde6 --- /dev/null +++ b/apps/comments/js/templates/commentsmodifymenu.handlebars @@ -0,0 +1,14 @@ +<ul> + {{#each items}} + <li> + <a href="#" class="menuitem action {{name}} permanent" data-action="{{name}}"> + {{#if iconClass}} + <span class="icon {{iconClass}}"></span> + {{else}} + <span class="no-icon"></span> + {{/if}} + <span>{{displayName}}</span> + </a> + </li> + {{/each}} +</ul> diff --git a/apps/comments/js/templates/filesplugin.handlebars b/apps/comments/js/templates/filesplugin.handlebars new file mode 100644 index 00000000000..8f3699380be --- /dev/null +++ b/apps/comments/js/templates/filesplugin.handlebars @@ -0,0 +1,3 @@ +<a class="action action-comment permanent" title="{{countMessage}}" href="#"> + <img class="svg" src="{{iconUrl}}"/> +</a> diff --git a/apps/dav/composer/composer/autoload_classmap.php b/apps/dav/composer/composer/autoload_classmap.php index 8b266c156f3..b03e866ab54 100644 --- a/apps/dav/composer/composer/autoload_classmap.php +++ b/apps/dav/composer/composer/autoload_classmap.php @@ -35,6 +35,7 @@ return array( 'OCA\\DAV\\CalDAV\\CalendarObject' => $baseDir . '/../lib/CalDAV/CalendarObject.php', 'OCA\\DAV\\CalDAV\\CalendarRoot' => $baseDir . '/../lib/CalDAV/CalendarRoot.php', 'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => $baseDir . '/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php', + 'OCA\\DAV\\CalDAV\\Outbox' => $baseDir . '/../lib/CalDAV/Outbox.php', 'OCA\\DAV\\CalDAV\\Plugin' => $baseDir . '/../lib/CalDAV/Plugin.php', 'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir . '/../lib/CalDAV/Principal/Collection.php', 'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir . '/../lib/CalDAV/Principal/User.php', diff --git a/apps/dav/composer/composer/autoload_static.php b/apps/dav/composer/composer/autoload_static.php index 09eb4d257cc..0d4c8801382 100644 --- a/apps/dav/composer/composer/autoload_static.php +++ b/apps/dav/composer/composer/autoload_static.php @@ -50,6 +50,7 @@ class ComposerStaticInitDAV 'OCA\\DAV\\CalDAV\\CalendarObject' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarObject.php', 'OCA\\DAV\\CalDAV\\CalendarRoot' => __DIR__ . '/..' . '/../lib/CalDAV/CalendarRoot.php', 'OCA\\DAV\\CalDAV\\InvitationResponse\\InvitationResponseServer' => __DIR__ . '/..' . '/../lib/CalDAV/InvitationResponse/InvitationResponseServer.php', + 'OCA\\DAV\\CalDAV\\Outbox' => __DIR__ . '/..' . '/../lib/CalDAV/Outbox.php', 'OCA\\DAV\\CalDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Plugin.php', 'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/Collection.php', 'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/User.php', diff --git a/apps/dav/lib/CalDAV/CalendarHome.php b/apps/dav/lib/CalDAV/CalendarHome.php index 3e645db459f..6700b1b2496 100644 --- a/apps/dav/lib/CalDAV/CalendarHome.php +++ b/apps/dav/lib/CalDAV/CalendarHome.php @@ -29,7 +29,6 @@ use Sabre\CalDAV\Backend\NotificationSupport; use Sabre\CalDAV\Backend\SchedulingSupport; use Sabre\CalDAV\Backend\SubscriptionSupport; use Sabre\CalDAV\Schedule\Inbox; -use Sabre\CalDAV\Schedule\Outbox; use Sabre\CalDAV\Subscriptions\Subscription; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\Exception\MethodNotAllowed; @@ -81,7 +80,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { if ($this->caldavBackend instanceof SchedulingSupport) { $objects[] = new Inbox($this->caldavBackend, $this->principalInfo['uri']); - $objects[] = new Outbox($this->principalInfo['uri']); + $objects[] = new Outbox($this->config, $this->principalInfo['uri']); } // We're adding a notifications node, if it's supported by the backend. @@ -108,7 +107,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { return new Inbox($this->caldavBackend, $this->principalInfo['uri']); } if ($name === 'outbox' && $this->caldavBackend instanceof SchedulingSupport) { - return new Outbox($this->principalInfo['uri']); + return new Outbox($this->config, $this->principalInfo['uri']); } if ($name === 'notifications' && $this->caldavBackend instanceof NotificationSupport) { return new \Sabre\CalDAv\Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']); diff --git a/apps/dav/lib/CalDAV/Outbox.php b/apps/dav/lib/CalDAV/Outbox.php new file mode 100644 index 00000000000..8f0c57c7890 --- /dev/null +++ b/apps/dav/lib/CalDAV/Outbox.php @@ -0,0 +1,132 @@ +<?php +/** + * @copyright Copyright (c) 2018, Georg Ehrke + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ +namespace OCA\DAV\CalDAV; + +use OCP\IConfig; +use Sabre\CalDAV\Plugin as CalDAVPlugin; + +/** + * Class Outbox + * + * @package OCA\DAV\CalDAV + */ +class Outbox extends \Sabre\CalDAV\Schedule\Outbox { + + /** @var IConfig */ + private $config; + + /** @var null|bool */ + private $disableFreeBusy = null; + + /** + * Outbox constructor. + * + * @param IConfig $config + * @param string $principalUri + */ + public function __construct(IConfig $config, string $principalUri) { + parent::__construct($principalUri); + $this->config = $config; + } + + /** + * Returns a list of ACE's for this node. + * + * Each ACE has the following properties: + * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are + * currently the only supported privileges + * * 'principal', a url to the principal who owns the node + * * 'protected' (optional), indicating that this ACE is not allowed to + * be updated. + * + * @return array + */ + function getACL() { + // getACL is called so frequently that we cache the config result + if ($this->disableFreeBusy === null) { + $this->disableFreeBusy = ($this->config->getAppValue('dav', 'disableFreeBusy', 'no') === 'yes'); + } + + $commonAcl = [ + [ + 'privilege' => '{DAV:}read', + 'principal' => $this->getOwner(), + 'protected' => true, + ], + [ + 'privilege' => '{DAV:}read', + 'principal' => $this->getOwner() . '/calendar-proxy-read', + 'protected' => true, + ], + [ + 'privilege' => '{DAV:}read', + 'principal' => $this->getOwner() . '/calendar-proxy-write', + 'protected' => true, + ], + ]; + + // schedule-send is an aggregate privilege for: + // - schedule-send-invite + // - schedule-send-reply + // - schedule-send-freebusy + // + // If FreeBusy is disabled, we have to remove the latter privilege + + if ($this->disableFreeBusy) { + return array_merge($commonAcl, [ + [ + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', + 'principal' => $this->getOwner(), + 'protected' => true, + ], + [ + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-invite', + 'principal' => $this->getOwner() . '/calendar-proxy-write', + 'protected' => true, + ], + [ + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', + 'principal' => $this->getOwner(), + 'protected' => true, + ], + [ + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send-reply', + 'principal' => $this->getOwner() . '/calendar-proxy-write', + 'protected' => true, + ], + ]); + } + + return array_merge($commonAcl, [ + [ + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', + 'principal' => $this->getOwner(), + 'protected' => true, + ], + [ + 'privilege' => '{' . CalDAVPlugin::NS_CALDAV . '}schedule-send', + 'principal' => $this->getOwner() . '/calendar-proxy-write', + 'protected' => true, + ], + ]); + } +} diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index feba4d04624..cbfa1bc83e0 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -212,10 +212,9 @@ class Principal implements BackendInterface { protected function searchUserPrincipals(array $searchProperties, $test = 'allof') { $results = []; - // If sharing is disabled (or FreeBusy was disabled on purpose), return the empty array + // If sharing is disabled, return the empty array $shareAPIEnabled = $this->shareManager->shareApiEnabled(); - $disableFreeBusy = $this->config->getAppValue('dav', 'disableFreeBusy', $shareAPIEnabled ? 'no' : 'yes'); - if ($disableFreeBusy === 'yes') { + if (!$shareAPIEnabled) { return []; } @@ -298,10 +297,9 @@ class Principal implements BackendInterface { * @return string */ function findByUri($uri, $principalPrefix) { - // If sharing is disabled (or FreeBusy was disabled on purpose), return the empty array + // If sharing is disabled, return the empty array $shareAPIEnabled = $this->shareManager->shareApiEnabled(); - $disableFreeBusy = $this->config->getAppValue('dav', 'disableFreeBusy', $shareAPIEnabled ? 'no' : 'yes'); - if ($disableFreeBusy === 'yes') { + if (!$shareAPIEnabled) { return null; } diff --git a/apps/dav/tests/unit/CalDAV/OutboxTest.php b/apps/dav/tests/unit/CalDAV/OutboxTest.php new file mode 100644 index 00000000000..be5dc33fc61 --- /dev/null +++ b/apps/dav/tests/unit/CalDAV/OutboxTest.php @@ -0,0 +1,123 @@ +<?php +/** + * @copyright Copyright (c) 2018, Georg Ehrke + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCA\DAV\Tests\unit\CalDAV; + +use OCA\DAV\CalDAV\Outbox; +use OCP\IConfig; +use Test\TestCase; + +class OutboxTest extends TestCase { + + /** @var IConfig */ + private $config; + + /** @var Outbox */ + private $outbox; + + protected function setUp() { + parent::setUp(); + + $this->config = $this->createMock(IConfig::class); + $this->outbox = new Outbox($this->config, 'user-principal-123'); + } + + public function testGetACLFreeBusyEnabled() { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with('dav', 'disableFreeBusy', 'no') + ->will($this->returnValue('no')); + + $this->assertEquals([ + [ + 'privilege' => '{DAV:}read', + 'principal' => 'user-principal-123', + 'protected' => true, + ], + [ + 'privilege' => '{DAV:}read', + 'principal' => 'user-principal-123/calendar-proxy-read', + 'protected' => true, + ], + [ + 'privilege' => '{DAV:}read', + 'principal' => 'user-principal-123/calendar-proxy-write', + 'protected' => true, + ], + [ + 'privilege' => '{urn:ietf:params:xml:ns:caldav}schedule-send', + 'principal' => 'user-principal-123', + 'protected' => true, + ], + [ + 'privilege' => '{urn:ietf:params:xml:ns:caldav}schedule-send', + 'principal' => 'user-principal-123/calendar-proxy-write', + 'protected' => true, + ], + ], $this->outbox->getACL()); + } + + public function testGetACLFreeBusyDisabled() { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with('dav', 'disableFreeBusy', 'no') + ->will($this->returnValue('yes')); + + $this->assertEquals([ + [ + 'privilege' => '{DAV:}read', + 'principal' => 'user-principal-123', + 'protected' => true, + ], + [ + 'privilege' => '{DAV:}read', + 'principal' => 'user-principal-123/calendar-proxy-read', + 'protected' => true, + ], + [ + 'privilege' => '{DAV:}read', + 'principal' => 'user-principal-123/calendar-proxy-write', + 'protected' => true, + ], + [ + 'privilege' => '{urn:ietf:params:xml:ns:caldav}schedule-send-invite', + 'principal' => 'user-principal-123', + 'protected' => true, + ], + [ + 'privilege' => '{urn:ietf:params:xml:ns:caldav}schedule-send-invite', + 'principal' => 'user-principal-123/calendar-proxy-write', + 'protected' => true, + ], + [ + 'privilege' => '{urn:ietf:params:xml:ns:caldav}schedule-send-reply', + 'principal' => 'user-principal-123', + 'protected' => true, + ], + [ + 'privilege' => '{urn:ietf:params:xml:ns:caldav}schedule-send-reply', + 'principal' => 'user-principal-123/calendar-proxy-write', + 'protected' => true, + ], + ], $this->outbox->getACL()); + } +} diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 7e82c446760..01907c85836 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -283,37 +283,26 @@ class PrincipalTest extends TestCase { /** * @dataProvider searchPrincipalsDataProvider */ - public function testSearchPrincipals($disableFreeBusy, $sharingEnabled, $disableFBSharingCombination, $groupsOnly, $result) { + public function testSearchPrincipals($sharingEnabled, $groupsOnly, $result) { $this->shareManager->expects($this->once()) ->method('shareAPIEnabled') ->will($this->returnValue($sharingEnabled)); - $this->config->expects($this->once()) - ->method('getAppValue') - ->with('dav', 'disableFreeBusy', $sharingEnabled ? 'no' : 'yes') - ->will($this->returnValue($disableFBSharingCombination)); - - if ($disableFreeBusy === 'no') { - if ($sharingEnabled) { - $this->shareManager->expects($this->once()) - ->method('shareWithGroupMembersOnly') - ->will($this->returnValue($groupsOnly)); - - if ($groupsOnly) { - $user = $this->createMock(IUser::class); - $this->userSession->expects($this->once()) - ->method('getUser') - ->will($this->returnValue($user)); - - $this->groupManager->expects($this->at(0)) - ->method('getUserGroupIds') - ->with($user) - ->will($this->returnValue(['group1', 'group2'])); - } - } else { - $this->shareManager->expects($this->never()) - ->method('shareWithGroupMembersOnly'); - $this->groupManager->expects($this->never()) - ->method($this->anything()); + + if ($sharingEnabled) { + $this->shareManager->expects($this->once()) + ->method('shareWithGroupMembersOnly') + ->will($this->returnValue($groupsOnly)); + + if ($groupsOnly) { + $user = $this->createMock(IUser::class); + $this->userSession->expects($this->once()) + ->method('getUser') + ->will($this->returnValue($user)); + + $this->groupManager->expects($this->at(0)) + ->method('getUserGroupIds') + ->with($user) + ->will($this->returnValue(['group1', 'group2'])); } } else { $this->shareManager->expects($this->never()) @@ -322,57 +311,42 @@ class PrincipalTest extends TestCase { ->method($this->anything()); } - $user2 = $this->createMock(IUser::class); $user2->method('getUID')->will($this->returnValue('user2')); $user3 = $this->createMock(IUser::class); $user3->method('getUID')->will($this->returnValue('user3')); - if ($disableFreeBusy === 'no') { - if ($sharingEnabled) { - $this->userManager->expects($this->at(0)) - ->method('getByEmail') - ->with('user') - ->will($this->returnValue([$user2, $user3])); - } else { - $this->userManager->expects($this->never()) - ->method('getByEmail'); - } + if ($sharingEnabled) { + $this->userManager->expects($this->at(0)) + ->method('getByEmail') + ->with('user') + ->will($this->returnValue([$user2, $user3])); } else { $this->userManager->expects($this->never()) ->method('getByEmail'); } - if ($disableFreeBusy === 'no') { - if ($sharingEnabled && $groupsOnly) { - $this->groupManager->expects($this->at(1)) - ->method('getUserGroupIds') - ->with($user2) - ->will($this->returnValue(['group1', 'group3'])); - $this->groupManager->expects($this->at(2)) - ->method('getUserGroupIds') - ->with($user3) - ->will($this->returnValue(['group3', 'group4'])); - } - } else { - $this->groupManager->expects($this->never()) - ->method('getUserGroupIds'); - $this->groupManager->expects($this->never()) - ->method('getUserGroupIds'); + if ($sharingEnabled && $groupsOnly) { + $this->groupManager->expects($this->at(1)) + ->method('getUserGroupIds') + ->with($user2) + ->will($this->returnValue(['group1', 'group3'])); + $this->groupManager->expects($this->at(2)) + ->method('getUserGroupIds') + ->with($user3) + ->will($this->returnValue(['group3', 'group4'])); } + $this->assertEquals($result, $this->connector->searchPrincipals('principals/users', ['{http://sabredav.org/ns}email-address' => 'user'])); } public function searchPrincipalsDataProvider() { return [ - ['yes', true, 'yes', false, []], - ['no', true, 'no', false, ['principals/users/user2', 'principals/users/user3']], - ['yes', true, 'yes', true, []], - ['no', true, 'no', true, ['principals/users/user2']], - ['yes', false, 'yes', false, []], - ['no', false, 'yes', false, []], + [true, false, ['principals/users/user2', 'principals/users/user3']], + [true, true, ['principals/users/user2']], + [false, false, []], ]; } @@ -380,10 +354,6 @@ class PrincipalTest extends TestCase { $this->shareManager->expects($this->once()) ->method('shareApiEnabled') ->will($this->returnValue(false)); - $this->config->expects($this->once()) - ->method('getAppValue') - ->with('dav', 'disableFreeBusy', 'yes') - ->will($this->returnValue('yes')); $this->assertEquals(null, $this->connector->findByUri('mailto:user@foo.com', 'principals/users')); } @@ -391,21 +361,11 @@ class PrincipalTest extends TestCase { /** * @dataProvider findByUriWithGroupRestrictionDataProvider */ - public function testFindByUriWithGroupRestriction($disableFreeBusy, $uri, $email, $expects) { + public function testFindByUriWithGroupRestriction($uri, $email, $expects) { $this->shareManager->expects($this->once()) ->method('shareApiEnabled') ->will($this->returnValue(true)); - $this->config->expects($this->once()) - ->method('getAppValue') - ->with('dav', 'disableFreeBusy', 'no') - ->will($this->returnValue($disableFreeBusy)); - if ($disableFreeBusy === 'yes') { - $this->shareManager->expects($this->never()) - ->method('shareWithGroupMembersOnly'); - $this->userSession->expects($this->never()) - ->method('getUser'); - } else { $this->shareManager->expects($this->once()) ->method('shareWithGroupMembersOnly') ->will($this->returnValue(true)); @@ -441,39 +401,25 @@ class PrincipalTest extends TestCase { ->with($user3) ->will($this->returnValue(['group3', 'group3'])); } - } $this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users')); } public function findByUriWithGroupRestrictionDataProvider() { return [ - ['yes', 'mailto:user2@foo.bar', 'user2@foo.bar', null], - ['no', 'mailto:user2@foo.bar', 'user2@foo.bar', 'principals/users/user2'], - ['yes', 'mailto:user3@foo.bar', 'user3@foo.bar', null], - ['no', 'mailto:user3@foo.bar', 'user3@foo.bar', null], + ['mailto:user2@foo.bar', 'user2@foo.bar', 'principals/users/user2'], + ['mailto:user3@foo.bar', 'user3@foo.bar', null], ]; } /** * @dataProvider findByUriWithoutGroupRestrictionDataProvider */ - public function testFindByUriWithoutGroupRestriction($disableFreeBusy, $uri, $email, $expects) { + public function testFindByUriWithoutGroupRestriction($uri, $email, $expects) { $this->shareManager->expects($this->once()) ->method('shareApiEnabled') ->will($this->returnValue(true)); - $this->config->expects($this->once()) - ->method('getAppValue') - ->with('dav', 'disableFreeBusy', 'no') - ->will($this->returnValue($disableFreeBusy)); - - if ($disableFreeBusy === 'yes') { - $this->shareManager->expects($this->never()) - ->method('shareWithGroupMembersOnly'); - $this->userManager->expects($this->never()) - ->method('getByEmail'); - } else { $this->shareManager->expects($this->once()) ->method('shareWithGroupMembersOnly') ->will($this->returnValue(false)); @@ -487,17 +433,14 @@ class PrincipalTest extends TestCase { ->method('getByEmail') ->with($email) ->will($this->returnValue([$email === 'user2@foo.bar' ? $user2 : $user3])); - } $this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users')); } public function findByUriWithoutGroupRestrictionDataProvider() { return [ - ['yes', 'mailto:user2@foo.bar', 'user2@foo.bar', null], - ['yes', 'mailto:user3@foo.bar', 'user3@foo.bar', null], - ['no', 'mailto:user2@foo.bar', 'user2@foo.bar', 'principals/users/user2'], - ['no', 'mailto:user3@foo.bar', 'user3@foo.bar', 'principals/users/user3'], + ['mailto:user2@foo.bar', 'user2@foo.bar', 'principals/users/user2'], + ['mailto:user3@foo.bar', 'user3@foo.bar', 'principals/users/user3'], ]; } } diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index a1fa5e57836..cc8af2cae3e 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -397,6 +397,7 @@ class ThemingController extends Controller { /** * @NoCSRFRequired * @PublicPage + * @NoSameSiteCookieRequired * * @return FileDisplayResponse|NotFoundResponse * @throws NotPermittedException @@ -428,6 +429,7 @@ class ThemingController extends Controller { /** * @NoCSRFRequired * @PublicPage + * @NoSameSiteCookieRequired * * @return DataDownloadResponse */ diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index c8458eab29c..901074d0285 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -62,6 +62,7 @@ class CssController extends Controller { /** * @PublicPage * @NoCSRFRequired + * @NoSameSiteCookieRequired * * @param string $fileName css filename with extension * @param string $appName css folder name diff --git a/core/Controller/JsController.php b/core/Controller/JsController.php index f91fe8f75d5..cdf22eda5fa 100644 --- a/core/Controller/JsController.php +++ b/core/Controller/JsController.php @@ -56,6 +56,7 @@ class JsController extends Controller { /** * @PublicPage * @NoCSRFRequired + * @NoSameSiteCookieRequired * * @param string $fileName js filename with extension * @param string $appName js folder name diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php index c6bf7b94da3..f7159dd9fe1 100644 --- a/core/Controller/SvgController.php +++ b/core/Controller/SvgController.php @@ -57,6 +57,7 @@ class SvgController extends Controller { /** * @PublicPage * @NoCSRFRequired + * @NoSameSiteCookieRequired * * Generate svg from filename with the requested color * @@ -73,6 +74,7 @@ class SvgController extends Controller { /** * @PublicPage * @NoCSRFRequired + * @NoSameSiteCookieRequired * * Generate svg from filename with the requested color * diff --git a/lib/private/Settings/Personal/Security.php b/lib/private/Settings/Personal/Security.php index 0efe2d0746b..d8cd711ca08 100644 --- a/lib/private/Settings/Personal/Security.php +++ b/lib/private/Settings/Personal/Security.php @@ -106,7 +106,6 @@ class Security implements ISettings { } return [ - 'isEnabled' => $this->twoFactorManager->isTwoFactorAuthenticated($user), 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) { return [ 'provider' => $provider, diff --git a/settings/templates/settings/personal/security.php b/settings/templates/settings/personal/security.php index 6b2c37b6a88..778d711d90f 100644 --- a/settings/templates/settings/personal/security.php +++ b/settings/templates/settings/personal/security.php @@ -104,15 +104,6 @@ if($_['passwordChangeSupported']) { <div id="two-factor-auth" class="section"> <h2><?php p($l->t('Two-Factor Authentication'));?></h2> - <p class="settings-hint"> - <?php - if ($_['twoFactorProviderData']['enabled']) { - p($l->t('Two-factor authentication is enabled on your account.')); - } else { - p($l->t('Two-factor authentication is disabled on your account.')); - } - ?> - </p> <ul> <?php foreach ($_['twoFactorProviderData']['providers'] as $data) { ?> <li> |