This commit is contained in:
yuri
2016-01-05 13:00:30 +02:00
parent 3177945146
commit e4d6b13d27
11 changed files with 159 additions and 20 deletions

View File

@@ -0,0 +1,41 @@
<?php
/************************************************************************
* 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.
************************************************************************/
namespace Espo\Acl;
use \Espo\ORM\Entity;
class User extends \Espo\Core\Acl\Base
{
public function checkIsOwner(\Espo\Entities\User $user, Entity $entity)
{
return $user->id === $entity->id;
}
}

View File

@@ -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)

View File

@@ -0,0 +1,41 @@
<?php
/************************************************************************
* 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.
************************************************************************/
namespace Espo\AclPortal;
use \Espo\ORM\Entity;
class User extends \Espo\Core\AclPortal\Base
{
public function checkIsOwner(\Espo\Entities\User $user, Entity $entity)
{
return $user->id === $entity->id;
}
}

View File

@@ -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) {

View File

@@ -2,7 +2,7 @@
"mandatory": {
"scopeLevel": {
"User": {
"read": "no",
"read": "own",
"edit": "no",
"delete": "no",
"stream": "no"

View File

@@ -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"
}
}

View File

@@ -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
);
}

View File

@@ -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 = [];

View File

@@ -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
});
});

View File

@@ -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({

View File

@@ -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--) {