summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/Avatars/AvatarHome.php120
-rw-r--r--apps/dav/lib/Avatars/AvatarNode.php98
-rw-r--r--apps/dav/lib/Avatars/RootCollection.php29
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php2
-rw-r--r--apps/dav/lib/RootCollection.php4
-rw-r--r--apps/dav/tests/unit/Avatars/AvatarHomeTest.php125
-rw-r--r--apps/dav/tests/unit/Avatars/AvatarNodeTest.php48
-rw-r--r--apps/dav/tests/unit/phpunit.xml4
-rw-r--r--apps/encryption/templates/mail.php2
-rw-r--r--apps/federatedfilesharing/settings-personal.php2
-rw-r--r--apps/sharebymail/templates/mail.php2
-rw-r--r--apps/theming/lib/Capabilities.php2
-rw-r--r--apps/theming/lib/Controller/ThemingController.php4
-rw-r--r--apps/theming/lib/IconBuilder.php4
-rw-r--r--apps/theming/lib/Settings/Admin.php2
-rw-r--r--apps/theming/lib/ThemingDefaults.php6
-rw-r--r--apps/theming/tests/CapabilitiesTest.php2
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php4
-rw-r--r--apps/theming/tests/IconBuilderTest.php6
-rw-r--r--apps/theming/tests/Settings/AdminTest.php4
-rw-r--r--apps/theming/tests/ThemingDefaultsTest.php10
-rw-r--r--apps/user_ldap/lib/Command/Search.php5
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php4
-rw-r--r--apps/user_ldap/templates/settings.php6
-rw-r--r--core/templates/layout.base.php4
-rw-r--r--core/templates/layout.guest.php4
-rw-r--r--core/templates/layout.user.php4
-rw-r--r--core/templates/mail.php2
-rw-r--r--lib/private/legacy/defaults.php15
-rw-r--r--settings/templates/email.new_user.php2
-rw-r--r--themes/example/defaults.php2
31 files changed, 481 insertions, 47 deletions
diff --git a/apps/dav/lib/Avatars/AvatarHome.php b/apps/dav/lib/Avatars/AvatarHome.php
new file mode 100644
index 00000000000..17ac37dc8af
--- /dev/null
+++ b/apps/dav/lib/Avatars/AvatarHome.php
@@ -0,0 +1,120 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2016, ownCloud GmbH
+ * @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\Avatars;
+
+
+use OCP\IAvatarManager;
+use Sabre\DAV\Exception\Forbidden;
+use Sabre\DAV\Exception\MethodNotAllowed;
+use Sabre\DAV\Exception\NotFound;
+use Sabre\DAV\ICollection;
+use Sabre\Uri;
+
+class AvatarHome implements ICollection {
+
+ /** @var array */
+ private $principalInfo;
+ /** @var IAvatarManager */
+ private $avatarManager;
+
+ /**
+ * AvatarHome constructor.
+ *
+ * @param array $principalInfo
+ * @param IAvatarManager $avatarManager
+ */
+ public function __construct($principalInfo, IAvatarManager $avatarManager) {
+ $this->principalInfo = $principalInfo;
+ $this->avatarManager = $avatarManager;
+ }
+
+ public function createFile($name, $data = null) {
+ throw new Forbidden('Permission denied to create a file');
+ }
+
+ public function createDirectory($name) {
+ throw new Forbidden('Permission denied to create a folder');
+ }
+
+ public function getChild($name) {
+ $elements = pathinfo($name);
+ $ext = isset($elements['extension']) ? $elements['extension'] : '';
+ $size = (int)(isset($elements['filename']) ? $elements['filename'] : '64');
+ if (!in_array($ext, ['jpeg', 'png'], true)) {
+ throw new MethodNotAllowed('File format not allowed');
+ }
+ if ($size <= 0 || $size > 1024) {
+ throw new MethodNotAllowed('Invalid image size');
+ }
+ $avatar = $this->avatarManager->getAvatar($this->getName());
+ if ($avatar === null || !$avatar->exists()) {
+ throw new NotFound();
+ }
+ return new AvatarNode($size, $ext, $avatar);
+ }
+
+ public function getChildren() {
+ try {
+ return [
+ $this->getChild('96.jpeg')
+ ];
+ } catch(NotFound $exception) {
+ return [];
+ }
+ }
+
+ public function childExists($name) {
+ try {
+ $ret = $this->getChild($name);
+ return $ret !== null;
+ } catch (NotFound $ex) {
+ return false;
+ } catch (MethodNotAllowed $ex) {
+ return false;
+ }
+ }
+
+ public function delete() {
+ throw new Forbidden('Permission denied to delete this folder');
+ }
+
+ public function getName() {
+ list(,$name) = Uri\split($this->principalInfo['uri']);
+ return $name;
+ }
+
+ public function setName($name) {
+ throw new Forbidden('Permission denied to rename this folder');
+ }
+
+ /**
+ * Returns the last modification time, as a unix timestamp
+ *
+ * @return int|null
+ */
+ public function getLastModified() {
+ return null;
+ }
+
+
+}
diff --git a/apps/dav/lib/Avatars/AvatarNode.php b/apps/dav/lib/Avatars/AvatarNode.php
new file mode 100644
index 00000000000..4030f482510
--- /dev/null
+++ b/apps/dav/lib/Avatars/AvatarNode.php
@@ -0,0 +1,98 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2016, ownCloud GmbH
+ * @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\Avatars;
+
+
+use OCP\IAvatar;
+use Sabre\DAV\File;
+
+class AvatarNode extends File {
+ private $ext;
+ private $size;
+ private $avatar;
+
+ /**
+ * AvatarNode constructor.
+ *
+ * @param integer $size
+ * @param string $ext
+ * @param IAvatar $avatar
+ */
+ public function __construct($size, $ext, $avatar) {
+ $this->size = $size;
+ $this->ext = $ext;
+ $this->avatar = $avatar;
+ }
+
+ /**
+ * Returns the name of the node.
+ *
+ * This is used to generate the url.
+ *
+ * @return string
+ */
+ public function getName() {
+ return "$this->size.$this->ext";
+ }
+
+ public function get() {
+ $image = $this->avatar->get($this->size);
+ $res = $image->resource();
+
+ ob_start();
+ if ($this->ext === 'png') {
+ imagepng($res);
+ } else {
+ imagejpeg($res);
+ }
+
+ return ob_get_clean();
+ }
+
+ /**
+ * Returns the mime-type for a file
+ *
+ * If null is returned, we'll assume application/octet-stream
+ *
+ * @return string|null
+ */
+ public function getContentType() {
+ if ($this->ext === 'png') {
+ return 'image/png';
+ }
+ return 'image/jpeg';
+ }
+
+ public function getETag() {
+ return $this->avatar->getFile($this->size)->getEtag();
+ }
+
+ public function getLastModified() {
+ $timestamp = $this->avatar->getFile($this->size)->getMTime();
+ if (!empty($timestamp)) {
+ return (int)$timestamp;
+ }
+ return $timestamp;
+
+ }
+}
diff --git a/apps/dav/lib/Avatars/RootCollection.php b/apps/dav/lib/Avatars/RootCollection.php
new file mode 100644
index 00000000000..d7c7ff4e9fb
--- /dev/null
+++ b/apps/dav/lib/Avatars/RootCollection.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace OCA\DAV\Avatars;
+
+use Sabre\DAVACL\AbstractPrincipalCollection;
+
+
+class RootCollection extends AbstractPrincipalCollection {
+
+ /**
+ * This method returns a node for a principal.
+ *
+ * The passed array contains principal information, and is guaranteed to
+ * at least contain a uri item. Other properties may or may not be
+ * supplied by the authentication backend.
+ *
+ * @param array $principalInfo
+ * @return AvatarHome
+ */
+ public function getChildForPrincipal(array $principalInfo) {
+ $avatarManager = \OC::$server->getAvatarManager();
+ return new AvatarHome($principalInfo, $avatarManager);
+ }
+
+ public function getName() {
+ return 'avatars';
+ }
+
+}
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php
index 9da416312d0..8713f61767b 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -223,8 +223,8 @@ class Principal implements BackendInterface {
$email = $user->getEMailAddress();
if (!empty($email)) {
$principal['{http://sabredav.org/ns}email-address'] = $email;
- return $principal;
}
+
return $principal;
}
diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php
index 478f0929c20..a243ec6d00a 100644
--- a/apps/dav/lib/RootCollection.php
+++ b/apps/dav/lib/RootCollection.php
@@ -99,6 +99,9 @@ class RootCollection extends SimpleCollection {
$uploadCollection = new Upload\RootCollection($userPrincipalBackend, 'principals/users');
$uploadCollection->disableListing = $disableListing;
+ $avatarCollection = new Avatars\RootCollection($userPrincipalBackend, 'principals/users');
+ $avatarCollection->disableListing = $disableListing;
+
$children = [
new SimpleCollection('principals', [
$userPrincipals,
@@ -114,6 +117,7 @@ class RootCollection extends SimpleCollection {
$systemTagRelationsCollection,
$commentsCollection,
$uploadCollection,
+ $avatarCollection
];
parent::__construct('root', $children);
diff --git a/apps/dav/tests/unit/Avatars/AvatarHomeTest.php b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php
new file mode 100644
index 00000000000..ca8306e79a8
--- /dev/null
+++ b/apps/dav/tests/unit/Avatars/AvatarHomeTest.php
@@ -0,0 +1,125 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2017, ownCloud GmbH
+ * @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\Avatars;
+
+
+use OCA\DAV\Avatars\AvatarHome;
+use OCA\DAV\Avatars\AvatarNode;
+use OCP\IAvatar;
+use OCP\IAvatarManager;
+use Sabre\DAV\Exception\MethodNotAllowed;
+use Sabre\DAV\Exception\NotFound;
+use Test\TestCase;
+
+class AvatarHomeTest extends TestCase {
+
+ /** @var AvatarHome */
+ private $home;
+
+ /** @var IAvatarManager | \PHPUnit_Framework_MockObject_MockObject */
+ private $avatarManager;
+
+ public function setUp() {
+ $this->avatarManager = $this->createMock(IAvatarManager::class);
+ $this->home = new AvatarHome(['uri' => 'principals/users/admin'], $this->avatarManager);
+ }
+
+ /**
+ * @expectedException \Sabre\DAV\Exception\Forbidden
+ * @dataProvider providesForbiddenMethods
+ */
+ public function testForbiddenMethods($method) {
+ $this->home->$method('');
+ }
+
+ public function providesForbiddenMethods() {
+ return [
+ ['createFile'],
+ ['createDirectory'],
+ ['delete'],
+ ['setName']
+ ];
+ }
+
+ public function testGetName() {
+ $n = $this->home->getName();
+ self::assertEquals('admin', $n);
+ }
+
+ public function providesTestGetChild() {
+ return [
+ [MethodNotAllowed::class, false, ''],
+ [MethodNotAllowed::class, false, 'bla.foo'],
+ [MethodNotAllowed::class, false, 'bla.png'],
+ [NotFound::class, false, '512.png'],
+ [null, true, '512.png'],
+ ];
+ }
+
+ /**
+ * @dataProvider providesTestGetChild
+ */
+ public function testGetChild($expectedException, $hasAvatar, $path) {
+ if ($expectedException !== null) {
+ $this->expectException($expectedException);
+ }
+ $avatar = null;
+ if ($hasAvatar) {
+ $avatar = $this->createMock(IAvatar::class);
+ $avatar->expects($this->once())->method('exists')->willReturn(true);
+ }
+ $this->avatarManager->expects($this->any())->method('getAvatar')->with('admin')->willReturn($avatar);
+ $avatarNode = $this->home->getChild($path);
+ $this->assertInstanceOf(AvatarNode::class, $avatarNode);
+ }
+
+ public function testGetChildren() {
+ $avatarNodes = $this->home->getChildren();
+ self::assertEquals(0, count($avatarNodes));
+
+ $avatar = $this->createMock(IAvatar::class);
+ $avatar->expects($this->once())->method('exists')->willReturn(true);
+ $this->avatarManager->expects($this->any())->method('getAvatar')->with('admin')->willReturn($avatar);
+ $avatarNodes = $this->home->getChildren();
+ self::assertEquals(1, count($avatarNodes));
+ }
+
+ /**
+ * @dataProvider providesTestGetChild
+ */
+ public function testChildExists($expectedException, $hasAvatar, $path) {
+ $avatar = null;
+ if ($hasAvatar) {
+ $avatar = $this->createMock(IAvatar::class);
+ $avatar->expects($this->once())->method('exists')->willReturn(true);
+ }
+ $this->avatarManager->expects($this->any())->method('getAvatar')->with('admin')->willReturn($avatar);
+ $childExists = $this->home->childExists($path);
+ $this->assertEquals($hasAvatar, $childExists);
+ }
+
+ public function testGetLastModified() {
+ self::assertNull($this->home->getLastModified());
+ }
+
+}
diff --git a/apps/dav/tests/unit/Avatars/AvatarNodeTest.php b/apps/dav/tests/unit/Avatars/AvatarNodeTest.php
new file mode 100644
index 00000000000..8e56ea6f6df
--- /dev/null
+++ b/apps/dav/tests/unit/Avatars/AvatarNodeTest.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2017, ownCloud GmbH
+ * @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\Avatars;
+
+
+use OCA\DAV\Avatars\AvatarNode;
+use OCP\IAvatar;
+use Test\TestCase;
+
+class AvatarNodeTest extends TestCase {
+
+ public function testGetName() {
+ /** @var IAvatar | \PHPUnit_Framework_MockObject_MockObject $a */
+ $a = $this->createMock(IAvatar::class);
+ $n = new AvatarNode(1024, 'png', $a);
+ $this->assertEquals('1024.png', $n->getName());
+ }
+
+ public function testGetContentType() {
+ /** @var IAvatar | \PHPUnit_Framework_MockObject_MockObject $a */
+ $a = $this->createMock(IAvatar::class);
+ $n = new AvatarNode(1024, 'png', $a);
+ $this->assertEquals('image/png', $n->getContentType());
+
+ $n = new AvatarNode(1024, 'jpeg', $a);
+ $this->assertEquals('image/jpeg', $n->getContentType());
+ }
+}
diff --git a/apps/dav/tests/unit/phpunit.xml b/apps/dav/tests/unit/phpunit.xml
index e483515ca7a..3f0a9107aaa 100644
--- a/apps/dav/tests/unit/phpunit.xml
+++ b/apps/dav/tests/unit/phpunit.xml
@@ -11,9 +11,9 @@
<!-- filters for code coverage -->
<filter>
<whitelist>
- <directory suffix=".php">../../dav</directory>
+ <directory suffix=".php">../../../dav</directory>
<exclude>
- <directory suffix=".php">../../dav/tests</directory>
+ <directory suffix=".php">../../../dav/tests</directory>
</exclude>
</whitelist>
</filter>
diff --git a/apps/encryption/templates/mail.php b/apps/encryption/templates/mail.php
index 3754b4b3e58..6e9f9885d33 100644
--- a/apps/encryption/templates/mail.php
+++ b/apps/encryption/templates/mail.php
@@ -6,7 +6,7 @@
<tr><td>
<table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr>
- <td colspan="2" bgcolor="<?php p($theme->getMailHeaderColor());?>">
+ <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>">
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
</td>
</tr>
diff --git a/apps/federatedfilesharing/settings-personal.php b/apps/federatedfilesharing/settings-personal.php
index 522cb297898..71353cdef2e 100644
--- a/apps/federatedfilesharing/settings-personal.php
+++ b/apps/federatedfilesharing/settings-personal.php
@@ -42,7 +42,7 @@ $cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
$url = 'https://nextcloud.com/federation#' . $cloudID;
$logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
$theme = \OC::$server->getThemingDefaults();
-$color = $theme->getMailHeaderColor();
+$color = $theme->getColorPrimary();
$textColor = "#ffffff";
if(\OC::$server->getAppManager()->isEnabledForUser("theming")) {
$logoPath = $theme->getLogo();
diff --git a/apps/sharebymail/templates/mail.php b/apps/sharebymail/templates/mail.php
index ea3531809a9..daf12fe034a 100644
--- a/apps/sharebymail/templates/mail.php
+++ b/apps/sharebymail/templates/mail.php
@@ -27,7 +27,7 @@
<tr><td>
<table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr>
- <td colspan="2" bgcolor="<?php p($theme->getMailHeaderColor());?>">
+ <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>">
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
</td>
</tr>
diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php
index b483cc80aed..2a9e9a3c6cf 100644
--- a/apps/theming/lib/Capabilities.php
+++ b/apps/theming/lib/Capabilities.php
@@ -60,7 +60,7 @@ class Capabilities implements ICapability {
'name' => $this->theming->getName(),
'url' => $this->theming->getBaseUrl(),
'slogan' => $this->theming->getSlogan(),
- 'color' => $this->theming->getMailHeaderColor(),
+ 'color' => $this->theming->getColorPrimary(),
'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()),
'background' => $this->url->getAbsoluteURL($this->theming->getBackground()),
],
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 2aa79df2464..093134e6c5e 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -451,8 +451,8 @@ class ThemingController extends Controller {
name: ' . json_encode($this->template->getName()) . ',
url: ' . json_encode($this->template->getBaseUrl()) . ',
slogan: ' . json_encode($this->template->getSlogan()) . ',
- color: ' . json_encode($this->template->getMailHeaderColor()) . ',
- inverted: ' . json_encode($this->util->invertTextColor($this->template->getMailHeaderColor())) . ',
+ color: ' . json_encode($this->template->getColorPrimary()) . ',
+ inverted: ' . json_encode($this->util->invertTextColor($this->template->getColorPrimary())) . ',
cacheBuster: ' . json_encode($cacheBusterValue). '
};
})();';
diff --git a/apps/theming/lib/IconBuilder.php b/apps/theming/lib/IconBuilder.php
index 39a7722f0a5..7db24c4a2b0 100644
--- a/apps/theming/lib/IconBuilder.php
+++ b/apps/theming/lib/IconBuilder.php
@@ -97,7 +97,7 @@ class IconBuilder {
return false;
}
- $color = $this->themingDefaults->getMailHeaderColor();
+ $color = $this->themingDefaults->getColorPrimary();
$mime = mime_content_type($appIcon);
// generate background image with rounded corners
@@ -178,7 +178,7 @@ class IconBuilder {
}
$svg = file_get_contents($imageFile);
if ($svg !== false && $svg !== "") {
- $color = $this->util->elementColor($this->themingDefaults->getMailHeaderColor());
+ $color = $this->util->elementColor($this->themingDefaults->getColorPrimary());
$svg = $this->util->colorizeSvg($svg, $color);
return $svg;
} else {
diff --git a/apps/theming/lib/Settings/Admin.php b/apps/theming/lib/Settings/Admin.php
index 22ab5650e5b..c8074f386af 100644
--- a/apps/theming/lib/Settings/Admin.php
+++ b/apps/theming/lib/Settings/Admin.php
@@ -70,7 +70,7 @@ class Admin implements ISettings {
'name' => $this->themingDefaults->getEntity(),
'url' => $this->themingDefaults->getBaseUrl(),
'slogan' => $this->themingDefaults->getSlogan(),
- 'color' => $this->themingDefaults->getMailHeaderColor(),
+ 'color' => $this->themingDefaults->getColorPrimary(),
'logo' => $this->themingDefaults->getLogo(),
'logoMime' => $this->config->getAppValue('theming', 'logoMime', ''),
'background' => $this->themingDefaults->getBackground(),
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 20625116213..5a863b1eb22 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -78,7 +78,7 @@ class ThemingDefaults extends \OC_Defaults {
$this->name = $defaults->getName();
$this->url = $defaults->getBaseUrl();
$this->slogan = $defaults->getSlogan();
- $this->color = $defaults->getMailHeaderColor();
+ $this->color = $defaults->getColorPrimary();
}
public function getName() {
@@ -119,7 +119,7 @@ class ThemingDefaults extends \OC_Defaults {
*
* @return string
*/
- public function getMailHeaderColor() {
+ public function getColorPrimary() {
return $this->config->getAppValue('theming', 'color', $this->color);
}
@@ -214,7 +214,7 @@ class ThemingDefaults extends \OC_Defaults {
$returnValue = $this->getSlogan();
break;
case 'color':
- $returnValue = $this->getMailHeaderColor();
+ $returnValue = $this->getColorPrimary();
break;
default:
$returnValue = '';
diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php
index 218fca505ed..1c379797736 100644
--- a/apps/theming/tests/CapabilitiesTest.php
+++ b/apps/theming/tests/CapabilitiesTest.php
@@ -106,7 +106,7 @@ class CapabilitiesTest extends TestCase {
->method('getSlogan')
->willReturn($slogan);
$this->theming->expects($this->once())
- ->method('getMailHeaderColor')
+ ->method('getColorPrimary')
->willReturn($color);
$this->theming->expects($this->once())
->method('getLogo')
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index 3afcdb847b6..cc7f73f742f 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -983,7 +983,7 @@ class ThemingControllerTest extends TestCase {
->willReturn("");
$this->template
->expects($this->at(3))
- ->method('getMailHeaderColor')
+ ->method('getColorPrimary')
->willReturn("#000");
@@ -1018,7 +1018,7 @@ class ThemingControllerTest extends TestCase {
->willReturn("awesome");
$this->template
->expects($this->any())
- ->method('getMailHeaderColor')
+ ->method('getColorPrimary')
->willReturn("#ffffff");
$expectedResponse = '(function() {
diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php
index da27795ce2c..423e3e86dbc 100644
--- a/apps/theming/tests/IconBuilderTest.php
+++ b/apps/theming/tests/IconBuilderTest.php
@@ -87,7 +87,7 @@ class IconBuilderTest extends TestCase {
public function testRenderAppIcon($app, $color, $file) {
$this->checkImagick();
$this->themingDefaults->expects($this->once())
- ->method('getMailHeaderColor')
+ ->method('getColorPrimary')
->willReturn($color);
$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
@@ -112,7 +112,7 @@ class IconBuilderTest extends TestCase {
public function testGetTouchIcon($app, $color, $file) {
$this->checkImagick();
$this->themingDefaults->expects($this->once())
- ->method('getMailHeaderColor')
+ ->method('getColorPrimary')
->willReturn($color);
$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
@@ -138,7 +138,7 @@ class IconBuilderTest extends TestCase {
public function testGetFavicon($app, $color, $file) {
$this->checkImagick();
$this->themingDefaults->expects($this->once())
- ->method('getMailHeaderColor')
+ ->method('getColorPrimary')
->willReturn($color);
$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
diff --git a/apps/theming/tests/Settings/AdminTest.php b/apps/theming/tests/Settings/AdminTest.php
index d4f5490d352..70939677582 100644
--- a/apps/theming/tests/Settings/AdminTest.php
+++ b/apps/theming/tests/Settings/AdminTest.php
@@ -78,7 +78,7 @@ class AdminTest extends TestCase {
->willReturn('MySlogan');
$this->themingDefaults
->expects($this->once())
- ->method('getMailHeaderColor')
+ ->method('getColorPrimary')
->willReturn('#fff');
$this->urlGenerator
->expects($this->once())
@@ -128,7 +128,7 @@ class AdminTest extends TestCase {
->willReturn('MySlogan');
$this->themingDefaults
->expects($this->once())
- ->method('getMailHeaderColor')
+ ->method('getColorPrimary')
->willReturn('#fff');
$this->urlGenerator
->expects($this->once())
diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php
index cd3a90e760a..72ccaa57d77 100644
--- a/apps/theming/tests/ThemingDefaultsTest.php
+++ b/apps/theming/tests/ThemingDefaultsTest.php
@@ -73,7 +73,7 @@ class ThemingDefaultsTest extends TestCase {
->willReturn('Safe Data');
$this->defaults
->expects($this->at(3))
- ->method('getMailHeaderColor')
+ ->method('getColorPrimary')
->willReturn('#000');
$this->template = new ThemingDefaults(
$this->config,
@@ -232,24 +232,24 @@ class ThemingDefaultsTest extends TestCase {
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer">Name</a>', $this->template->getShortFooter());
}
- public function testGetMailHeaderColorWithDefault() {
+ public function testgetColorPrimaryWithDefault() {
$this->config
->expects($this->once())
->method('getAppValue')
->with('theming', 'color', '#000')
->willReturn('#000');
- $this->assertEquals('#000', $this->template->getMailHeaderColor());
+ $this->assertEquals('#000', $this->template->getColorPrimary());
}
- public function testGetMailHeaderColorWithCustom() {
+ public function testgetColorPrimaryWithCustom() {
$this->config
->expects($this->once())
->method('getAppValue')
->with('theming', 'color', '#000')
->willReturn('#fff');
- $this->assertEquals('#fff', $this->template->getMailHeaderColor());
+ $this->assertEquals('#fff', $this->template->getColorPrimary());
}
public function testSet() {
diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php
index 17e506855b2..57970b1ac5d 100644
--- a/apps/user_ldap/lib/Command/Search.php
+++ b/apps/user_ldap/lib/Command/Search.php
@@ -114,6 +114,11 @@ class Search extends Command {
$proxy = new Group_Proxy($configPrefixes, $ldapWrapper);
$getMethod = 'getGroups';
$printID = false;
+ // convert the limit of groups to null. This will show all the groups available instead of
+ // nothing, and will match the same behaviour the search for users has.
+ if ($limit === 0) {
+ $limit = null;
+ }
} else {
$proxy = new User_Proxy($configPrefixes, $ldapWrapper, $this->ocConfig);
$getMethod = 'getDisplayNames';
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index d620a00f849..fb9920d3cc2 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -496,9 +496,11 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface {
// if possible, read out membership via memberOf. It's far faster than
// performing a search, which still is a fallback later.
+ // memberof doesn't support memberuid, so skip it here.
if(intval($this->access->connection->hasMemberOfFilterSupport) === 1
&& intval($this->access->connection->useMemberOfToDetectMembership) === 1
- ) {
+ && strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid'
+ ) {
$groupDNs = $this->_getGroupDNsFromMemberOf($userDN);
if (is_array($groupDNs)) {
foreach ($groupDNs as $dn) {
diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php
index e53456c703c..6942b2eb2b1 100644
--- a/apps/user_ldap/templates/settings.php
+++ b/apps/user_ldap/templates/settings.php
@@ -106,9 +106,9 @@ style('user_ldap', 'settings');
</div>
<h3><?php p($l->t('Special Attributes'));?></h3>
<div>
- <p><label for="ldap_quota_attr"><?php p($l->t('Quota Field'));?></label><input type="text" id="ldap_quota_attr" name="ldap_quota_attr" data-default="<?php p($_['ldap_quota_attr_default']); ?>"/></p>
- <p><label for="ldap_quota_def"><?php p($l->t('Quota Default'));?></label><input type="text" id="ldap_quota_def" name="ldap_quota_def" data-default="<?php p($_['ldap_quota_def_default']); ?>" title="<?php p($l->t('in bytes'));?>" /></p>
- <p><label for="ldap_email_attr"><?php p($l->t('Email Field'));?></label><input type="text" id="ldap_email_attr" name="ldap_email_attr" data-default="<?php p($_['ldap_email_attr_default']); ?>" /></p>
+ <p><label for="ldap_quota_attr"><?php p($l->t('Quota Field'));?></label><input type="text" id="ldap_quota_attr" name="ldap_quota_attr" data-default="<?php p($_['ldap_quota_attr_default']); ?>" title="<?php p($l->t('Leave empty for user\'s default quota. Otherwise, specify an LDAP/AD attribute.'));?>" /></p>
+ <p><label for="ldap_quota_def"><?php p($l->t('Quota Default'));?></label><input type="text" id="ldap_quota_def" name="ldap_quota_def" data-default="<?php p($_['ldap_quota_def_default']); ?>" title="<?php p($l->t('Override default quota for LDAP users who do not have a quota set in the Quota Field.'));?>" /></p>
+ <p><label for="ldap_email_attr"><?php p($l->t('Email Field'));?></label><input type="text" id="ldap_email_attr" name="ldap_email_attr" data-default="<?php p($_['ldap_email_attr_default']); ?>" title="<?php p($l->t('Set the user\'s email from their LDAP attribute. Leave it empty for default behaviour.'));?>" /></p>
<p><label for="home_folder_naming_rule"><?php p($l->t('User Home Folder Naming Rule'));?></label><input type="text" id="home_folder_naming_rule" name="home_folder_naming_rule" title="<?php p($l->t('Leave empty for user name (default). Otherwise, specify an LDAP/AD attribute.'));?>" data-default="<?php p($_['home_folder_naming_rule_default']); ?>" /></p>
</div>
</div>
diff --git a/core/templates/layout.base.php b/core/templates/layout.base.php
index 4ae33341e2f..e2e61e67e2c 100644
--- a/core/templates/layout.base.php
+++ b/core/templates/layout.base.php
@@ -8,10 +8,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="referrer" content="never">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
- <meta name="theme-color" content="<?php p($theme->getMailHeaderColor()); ?>">
+ <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
<link rel="icon" href="<?php print_unescaped(image_path('', 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path('', 'favicon-touch.png')); ?>">
- <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getMailHeaderColor()); ?>">
+ <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
<?php if (isset($_['inline_ocjs'])): ?>
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
<?php print_unescaped($_['inline_ocjs']); ?>
diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php
index 9b89ed6300f..1e2559d6960 100644
--- a/core/templates/layout.guest.php
+++ b/core/templates/layout.guest.php
@@ -9,10 +9,10 @@
<meta name="referrer" content="never">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-itunes-app" content="app-id=<?php p($theme->getiTunesAppId()); ?>">
- <meta name="theme-color" content="<?php p($theme->getMailHeaderColor()); ?>">
+ <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
<link rel="icon" href="<?php print_unescaped(image_path('', 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path('', 'favicon-touch.png')); ?>">
- <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getMailHeaderColor()); ?>">
+ <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
<?php if (isset($_['inline_ocjs'])): ?>
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
<?php print_unescaped($_['inline_ocjs']); ?>
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index 439567fe6a1..40e47c7e582 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -16,10 +16,10 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid']!='files')? $_['application']:$theme->getTitle()); ?>">
<meta name="mobile-web-app-capable" content="yes">
- <meta name="theme-color" content="<?php p($theme->getMailHeaderColor()); ?>">
+ <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
<link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path($_['appid'], 'favicon-touch.png')); ?>">
- <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path($_['appid'], 'favicon-mask.svg')); ?>" color="<?php p($theme->getMailHeaderColor()); ?>">
+ <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path($_['appid'], 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
<link rel="manifest" href="<?php print_unescaped(image_path($_['appid'], 'manifest.json')); ?>">
<?php if (isset($_['inline_ocjs'])): ?>
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
diff --git a/core/templates/mail.php b/core/templates/mail.php
index 3721d50e27b..cda33490e85 100644
--- a/core/templates/mail.php
+++ b/core/templates/mail.php
@@ -2,7 +2,7 @@
<tr><td>
<table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr>
-<td colspan="2" bgcolor="<?php p($theme->getMailHeaderColor());?>">
+<td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>">
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
</td>
</tr>
diff --git a/lib/private/legacy/defaults.php b/lib/private/legacy/defaults.php
index ea41d80076e..9fd9b621a14 100644
--- a/lib/private/legacy/defaults.php
+++ b/lib/private/legacy/defaults.php
@@ -46,7 +46,7 @@ class OC_Defaults {
private $defaultDocVersion;
private $defaultSlogan;
private $defaultLogoClaim;
- private $defaultMailHeaderColor;
+ private $defaultColorPrimary;
function __construct() {
$this->l = \OC::$server->getL10N('lib');
@@ -63,7 +63,7 @@ class OC_Defaults {
$this->defaultDocVersion = '11'; // used to generate doc links
$this->defaultSlogan = $this->l->t('a safe home for all your data');
$this->defaultLogoClaim = '';
- $this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */
+ $this->defaultColorPrimary = '#0082c9';
$themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
if (file_exists($themePath)) {
@@ -272,15 +272,18 @@ class OC_Defaults {
}
/**
- * Returns mail header color
+ * Returns primary color
* @return string
*/
- public function getMailHeaderColor() {
+ public function getColorPrimary() {
+
+ if ($this->themeExist('getColorPrimary')) {
+ return $this->theme->getColorPrimary();
+ }
if ($this->themeExist('getMailHeaderColor')) {
return $this->theme->getMailHeaderColor();
- } else {
- return $this->defaultMailHeaderColor;
}
+ return $this->defaultColorPrimary;
}
public function shouldReplaceIcons() {
diff --git a/settings/templates/email.new_user.php b/settings/templates/email.new_user.php
index bd2d4249d9a..9418c21c6cb 100644
--- a/settings/templates/email.new_user.php
+++ b/settings/templates/email.new_user.php
@@ -2,7 +2,7 @@
<tr><td>
<table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr>
- <td colspan="2" bgcolor="<?php p($theme->getMailHeaderColor());?>" bordercolor="<?php p($theme->getMailHeaderColor());?>" border>
+ <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>" bordercolor="<?php p($theme->getColorPrimary());?>" border>
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
</td>
</tr>
diff --git a/themes/example/defaults.php b/themes/example/defaults.php
index 1a2389d0bc2..3d0ae9c1c74 100644
--- a/themes/example/defaults.php
+++ b/themes/example/defaults.php
@@ -147,7 +147,7 @@ class OC_Theme {
* Returns mail header color
* @return string
*/
- public function getMailHeaderColor() {
+ public function getColorPrimary() {
return '#745bca';
}