Notification remove

This commit is contained in:
yuri
2016-02-01 17:36:53 +02:00
parent ed7d24bc8f
commit 926e243aa3
12 changed files with 193 additions and 13 deletions
+45
View File
@@ -0,0 +1,45 @@
<?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\Entities\User;
use \Espo\ORM\Entity;
class Notification extends \Espo\Core\Acl\Base
{
public function checkIsOwner(User $user, Entity $entity)
{
if ($user->id === $entity->get('userId')) {
return true;
}
return false;
}
}
@@ -0,0 +1,45 @@
<?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\Entities\User;
use \Espo\ORM\Entity;
class Notification extends \Espo\Core\AclPortal\Base
{
public function checkIsOwner(User $user, Entity $entity)
{
if ($user->id === $entity->get('userId')) {
return true;
}
return false;
}
}
+1 -1
View File
@@ -25,7 +25,7 @@
*
* 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\Controllers;
+26 -1
View File
@@ -31,7 +31,7 @@ namespace Espo\Controllers;
use \Espo\Core\Exceptions\Error;
class Notification extends \Espo\Core\Controllers\Base
class Notification extends \Espo\Core\Controllers\Record
{
public static $defaultAction = 'list';
@@ -71,5 +71,30 @@ class Notification extends \Espo\Core\Controllers\Base
$userId = $this->getUser()->id;
return $this->getService('Notification')->markAllRead($userId);
}
public function actionExport($params, $data, $request)
{
throw new Error();
}
public function actionMassUpdate($params, $data, $request)
{
throw new Error();
}
public function actionCreateLink($params, $data, $request)
{
throw new Error();
}
public function actionRemoveLink($params, $data, $request)
{
throw new Error();
}
public function actionMerge($params, $data, $request)
{
throw new Error();
}
}
@@ -50,6 +50,12 @@
"delete": "no",
"create": "no"
},
"Notification": {
"read": "own",
"edit": "no",
"delete": "own",
"create": "no"
},
"Role": false,
"PortalRole": false
},
@@ -15,6 +15,12 @@
"delete": "own",
"create": "yes"
},
"Notification": {
"read": "own",
"edit": "no",
"delete": "own",
"create": "no"
},
"Portal": false,
"Attachment": {
"read": "own",
+1 -8
View File
@@ -36,15 +36,8 @@ use Espo\ORM\Entity;
use Espo\Core\Utils\Json;
class Notification extends \Espo\Core\Services\Base
class Notification extends \Espo\Services\Record
{
protected $dependencies = array(
'entityManager',
'user',
'metadata',
'aclManager'
);
protected function getEntityManager()
{
return $this->injections['entityManager'];
+1 -1
View File
@@ -50,7 +50,7 @@ class Stream extends \Espo\Core\Services\Base
'container',
);
protected $emailsWithContentEntityList = array('Case');
protected $emailsWithContentEntityList = ['Case'];
protected $auditedFieldsCache = array();
@@ -0,0 +1,13 @@
<div class="list-row-buttons pull-right">
<div class="btn-group">
<button type="button" class="btn btn-link btn-sm dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<li><a href="javascript:" class="action" data-action="quickRemove" data-id="{{model.id}}">{{translate 'Remove'}}</a></li>
</ul>
</div>
</div>
{{#unless isRead}}
<span class="badge-circle badge-circle-warning"></span>
{{/unless}}
@@ -0,0 +1,47 @@
/************************************************************************
* 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/notification/fields/read-with-menu', 'views/fields/base', function (Dep) {
return Dep.extend({
type: 'read',
listTemplate: 'notification/fields/read-with-menu',
detailTemplate: 'notification/fields/read-with-menu',
data: function () {
return {
isRead: this.model.get('read')
};
},
});
});
@@ -76,7 +76,7 @@ Espo.define('views/notification/list', 'view', function (Dep) {
],
right: {
name: 'read',
view: 'views/notification/fields/read',
view: 'views/notification/fields/read-with-menu',
width: '10px'
}
}
+1 -1
View File
@@ -1024,7 +1024,7 @@ Espo.define('views/record/list', 'view', function (Dep) {
if (!id) return;
var model = this.collection.get(id);
if (!this.getAcl().checkModel(model, 'delete')) {
if (!this.getAcl().checkScope(this.scope, 'delete')) {
this.notify('Access denied', 'error');
return false;
}