Compare commits

...

7 Commits

Author SHA1 Message Date
yuri e743f61913 version 2018-09-10 12:17:15 +03:00
yuri 7f4e5dd01a note acl populate script 2018-09-10 12:15:42 +03:00
yuri 8a1b58cf7c fix kanban css 2018-09-10 11:22:22 +03:00
yuri 2a20766912 fix UniquId 2018-09-10 10:29:34 +03:00
yuri b49679eb90 fix notification id 2018-09-10 10:27:09 +03:00
yuri b2ea073c16 fix notifications 2018-09-10 10:24:09 +03:00
yuri 54085a59c3 fix meeting acl 2018-09-07 14:38:02 +03:00
10 changed files with 114 additions and 6 deletions
+12
View File
@@ -31,6 +31,18 @@ namespace Espo\Entities;
class Note extends \Espo\Core\ORM\Entity
{
private $aclIsProcessed = false;
public function setAclIsProcessed()
{
$this->aclIsProcessed = true;
}
public function isAclProcessed()
{
return $this->aclIsProcessed;
}
public function loadAttachments()
{
$data = $this->get('data');
+11 -2
View File
@@ -133,10 +133,19 @@ class Notifications extends \Espo\Core\Hooks\Base
$targetType = $parentType;
}
$teamIdList = $entity->getLinkMultipleIdList('teams');
$userIdList = $entity->getLinkMultipleIdList('users');
$skipAclCheck = false;
if (!$entity->isAclProcessed()) {
$skipAclCheck = true;
} else {
$teamIdList = $entity->getLinkMultipleIdList('teams');
$userIdList = $entity->getLinkMultipleIdList('users');
}
foreach ($userList as $user) {
if ($skipAclCheck) {
$notifyUserIdList[] = $user->id;
continue;
}
if ($user->isAdmin()) {
$notifyUserIdList[] = $user->id;
continue;
@@ -34,6 +34,8 @@ use \Espo\ORM\Entity;
class Meeting extends \Espo\Core\Acl\Base
{
protected $ownerUserIdAttribute = 'usersIds';
public function checkEntityRead(User $user, Entity $entity, $data)
{
if ($this->checkEntity($user, $entity, $data, 'read')) {
+1 -1
View File
@@ -44,7 +44,7 @@ class UniqueId extends \Espo\Core\ORM\Repositories\RDB
protected function getNewEntity()
{
$entity = parent::getNewEntity();
$entity->set('name', uniqid());
$entity->set('name', \Espo\Core\Utils\Util::generateId());
return $entity;
}
}
+72
View File
@@ -261,6 +261,7 @@ class App extends \Espo\Core\Services\Base
}
}
// TODO remove in 5.5.0
public function jobPopulateArrayValues()
{
$scopeList = array_keys($this->getMetadata()->get(['scopes']));
@@ -310,4 +311,75 @@ class App extends \Espo\Core\Services\Base
}
}
}
// TODO remove in 5.5.0
public function jobPopulateNotesTeamUser()
{
$aclManager = $this->getInjection('container')->get('aclManager');
$sql = $this->getEntityManager()->getQuery()->createSelectQuery('Note', [
'whereClause' => [
'parentId!=' => null,
'type=' => ['Relate', 'CreateRelated', 'EmailReceived', 'EmailSent', 'Assign', 'Create'],
],
'limit' => 100000,
'orderBy' => [['number', 'DESC']]
]);
$sth = $this->getEntityManager()->getPdo()->prepare($sql);
$sth->execute();
$i = 0;
while ($dataRow = $sth->fetch(\PDO::FETCH_ASSOC)) {
$i++;
$note = $this->getEntityManager()->getEntityFactory()->create('Note');
$note->set($dataRow);
$note->setAsFetched();
if ($note->get('relatedId') && $note->get('relatedType')) {
$targetType = $note->get('relatedType');
$targetId = $note->get('relatedId');
} else if ($note->get('parentId') && $note->get('parentType')) {
$targetType = $note->get('parentType');
$targetId = $note->get('parentId');
} else {
continue;
}
if (!$this->getEntityManager()->hasRepository($targetType)) continue;
try {
$entity = $this->getEntityManager()->getEntity($targetType, $targetId);
if (!$entity) continue;
$ownerUserIdAttribute = $aclManager->getImplementation($targetType)->getOwnerUserIdAttribute($entity);
$toSave = false;
if ($ownerUserIdAttribute) {
if ($entity->getAttributeParam($ownerUserIdAttribute, 'isLinkMultipleIdList')) {
$link = $entity->getAttributeParam($ownerUserIdAttribute, 'relation');
$userIdList = $entity->getLinkMultipleIdList($link);
} else {
$userId = $entity->get($ownerUserIdAttribute);
if ($userId) {
$userIdList = [$userId];
} else {
$userIdList = [];
}
}
if (!empty($userIdList)) {
$note->set('usersIds', $userIdList);
$toSave = true;
}
}
if ($entity->hasLinkMultipleField('teams')) {
$teamIdList = $entity->getLinkMultipleIdList('teams');
if (!empty($teamIdList)) {
$note->set('teamsIds', $teamIdList);
$toSave = true;
}
}
if ($toSave) {
$this->getEntityManager()->saveEntity($note);
}
} catch (\Exception $e) {}
}
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ class Notification extends \Espo\Services\Record
$userId = $user->id;
if (!$this->checkUserNoteAccess($user, $note)) continue;
if ($note->get('createdById') === $user->id) continue;
$id = uniqid();
$id = \Espo\Core\Utils\Util::generateId();
$arr[] = "(".$query->quote($id).", ".$query->quote($encodedData).", ".$query->quote('Note').", ".$query->quote($userId).", ".$query->quote($now).", ".$query->quote($note->id).", ".$query->quote('Note').", ".$query->quote($note->get('parentId')).", ".$query->quote($note->get('parentType')).")";
}
+4
View File
@@ -889,6 +889,10 @@ class Stream extends \Espo\Core\Services\Base
protected function processNoteTeamsUsers(Entity $note, Entity $entity)
{
$note->setAclIsProcessed();
$note->set('teamsIds', []);
$note->set('usersIds', []);
if ($entity->hasLinkMultipleField('teams') && $entity->has('teamsIds')) {
$teamIdList = $entity->get('teamsIds');
if (!empty($teamIdList)) {
+1 -1
View File
@@ -20,7 +20,7 @@
<tr class="kanban-row">
{{#each groupDataList}}
<th data-name="{{name}}" class="group-header">
<div>{{label}}</div>
<div><span class="kanban-group-label">{{label}}</span></div>
</th>
{{/each}}
</tr>
+9
View File
@@ -309,6 +309,15 @@ div.list-kanban > div.kanban-columns-container {
overflow: hidden;
> th {
overflow: visible;
min-width: 0;
max-height: 28px;
.kanban-group-label {
display: inline-block;
max-width: ~"calc(100% - 15px)";
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "espocrm",
"version": "5.4.1",
"version": "5.4.2",
"description": "",
"main": "index.php",
"repository": {