diff --git a/application/Espo/Acl/User.php b/application/Espo/Acl/User.php new file mode 100644 index 0000000000..1edba5aeeb --- /dev/null +++ b/application/Espo/Acl/User.php @@ -0,0 +1,41 @@ +id === $entity->id; + } +} + diff --git a/application/Espo/AclPortal/Email.php b/application/Espo/AclPortal/Email.php index 9c7beabeb5..fc2599f155 100644 --- a/application/Espo/AclPortal/Email.php +++ b/application/Espo/AclPortal/Email.php @@ -32,7 +32,7 @@ namespace Espo\AclPortal; use \Espo\Entities\User; use \Espo\ORM\Entity; -class Email extends \Espo\Core\Acl\Base +class Email extends \Espo\Core\AclPortal\Base { public function checkEntityRead(User $user, Entity $entity, $data) diff --git a/application/Espo/AclPortal/User.php b/application/Espo/AclPortal/User.php new file mode 100644 index 0000000000..9833d95676 --- /dev/null +++ b/application/Espo/AclPortal/User.php @@ -0,0 +1,41 @@ +id === $entity->id; + } +} + diff --git a/application/Espo/Hooks/Note/Notifications.php b/application/Espo/Hooks/Note/Notifications.php index 20f85e7fb1..88210ec69a 100644 --- a/application/Espo/Hooks/Note/Notifications.php +++ b/application/Espo/Hooks/Note/Notifications.php @@ -119,7 +119,8 @@ class Notifications extends \Espo\Core\Hooks\Base } else if ($targetType === 'all') { $targetUserList = $this->getEntityManager()->getRepository('User')->find(array( 'whereClause' => array( - 'isActive' => true + 'isActive' => true, + 'isPortalUser' => false ) )); foreach ($targetUserList as $user) { diff --git a/application/Espo/Resources/metadata/app/aclPortal.json b/application/Espo/Resources/metadata/app/aclPortal.json index 6b1f463692..9770a29cc6 100644 --- a/application/Espo/Resources/metadata/app/aclPortal.json +++ b/application/Espo/Resources/metadata/app/aclPortal.json @@ -2,7 +2,7 @@ "mandatory": { "scopeLevel": { "User": { - "read": "no", + "read": "own", "edit": "no", "delete": "no", "stream": "no" diff --git a/application/Espo/Resources/metadata/clientDefs/Note.json b/application/Espo/Resources/metadata/clientDefs/Note.json index 55e9e99c3d..5236236dc0 100644 --- a/application/Espo/Resources/metadata/clientDefs/Note.json +++ b/application/Espo/Resources/metadata/clientDefs/Note.json @@ -1,10 +1,13 @@ { "collection": "collections/note", "recordViews":{ - "edit":"Note.Record.Edit", - "editQuick":"Note.Record.Edit" + "edit":"views/note/record/edit", + "editQuick":"views/note/record/edit" + }, + "modalViews": { + "edit": "views/note/modals/edit" }, "itemViews": { - "Post": "Stream.Notes.Post" + "Post": "views/stream/notes/post" } } diff --git a/application/Espo/SelectManagers/User.php b/application/Espo/SelectManagers/User.php index 09b8cc9030..e72ee66093 100644 --- a/application/Espo/SelectManagers/User.php +++ b/application/Espo/SelectManagers/User.php @@ -48,7 +48,16 @@ class User extends \Espo\Core\SelectManagers\Base protected function filterActive(&$result) { $result['whereClause'][] = array( - 'isActive' => true + 'isActive' => true, + 'isPortalUser' => false + ); + } + + protected function filterActivePortalUsers(&$result) + { + $result['whereClause'][] = array( + 'isActive' => true, + 'isPortalUser' => true ); } diff --git a/application/Espo/Services/Stream.php b/application/Espo/Services/Stream.php index 1d660932e3..21873506da 100644 --- a/application/Espo/Services/Stream.php +++ b/application/Espo/Services/Stream.php @@ -388,20 +388,22 @@ class Stream extends \Espo\Core\Services\Base ) "; - $sqlPartList[] = " - ( - SELECT {$selectSqlPart} - FROM `note` AS `note` - LEFT JOIN `user` AS `createdBy` ON note.created_by_id = createdBy.id - WHERE note.deleted = 0 AND + if (!$user->get('isPortalUser') || $user->get('isAdmin')) { + $sqlPartList[] = " ( - note.parent_id IS NULL AND - note.is_global = 1 + SELECT {$selectSqlPart} + FROM `note` AS `note` + LEFT JOIN `user` AS `createdBy` ON note.created_by_id = createdBy.id + WHERE note.deleted = 0 AND + ( + note.parent_id IS NULL AND + note.is_global = 1 + ) + {where} + ORDER BY number DESC ) - {where} - ORDER BY number DESC - ) - "; + "; + } $teamIdList = $user->getTeamIdList(); $teamIdQuotedList = []; diff --git a/frontend/client/src/views/note/modals/edit.js b/frontend/client/src/views/note/modals/edit.js new file mode 100644 index 0000000000..5fe3bc8e27 --- /dev/null +++ b/frontend/client/src/views/note/modals/edit.js @@ -0,0 +1,38 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM - Open Source CRM application. + * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko + * Website: http://www.espocrm.com + * + * EspoCRM is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EspoCRM 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EspoCRM. If not, see http://www.gnu.org/licenses/. + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU General Public License version 3. + * + * In accordance with Section 7(b) of the GNU General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. + ************************************************************************/ + +Espo.define('views/note/modals/edit', 'views/modals/edit', function (Dep) { + + return Dep.extend({ + + fullFormDisabled: true + + }); +}); + + diff --git a/frontend/client/src/views/note/record/edit.js b/frontend/client/src/views/note/record/edit.js index 529ae69c58..3094cdf7d7 100644 --- a/frontend/client/src/views/note/record/edit.js +++ b/frontend/client/src/views/note/record/edit.js @@ -26,7 +26,7 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('Views.Note.Record.Edit', 'Views.Record.Edit', function (Dep) { +Espo.define('views/note/record/edit', 'views/record/edit', function (Dep) { return Dep.extend({ diff --git a/frontend/client/src/views/stream/record/list.js b/frontend/client/src/views/stream/record/list.js index 0ebc3b8e55..2cbeefe707 100644 --- a/frontend/client/src/views/stream/record/list.js +++ b/frontend/client/src/views/stream/record/list.js @@ -93,6 +93,10 @@ Espo.define('views/stream/record/list', 'views/record/list-expanded', function ( var $list = this.$el.find(this.listContainerEl); var success = function () { + if (initialCount === 0) { + this.reRender(); + return; + } var rowCount = collection.length - initialCount; var rowsReady = 0; for (var i = rowCount - 1; i >= 0; i--) {