From 23ee06e123480d214ee24d7a6bad4c18cb148da2 Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 14 Mar 2016 16:50:44 +0200 Subject: [PATCH 1/4] hide panels and buttons from portal user --- client/src/views/user/detail.js | 35 +++++++++++++------------- client/src/views/user/record/detail.js | 5 ++++ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/client/src/views/user/detail.js b/client/src/views/user/detail.js index 6153d8f274..20926b8362 100644 --- a/client/src/views/user/detail.js +++ b/client/src/views/user/detail.js @@ -40,27 +40,28 @@ Espo.define('views/user/detail', 'views/detail', function (Dep) { action: "preferences" }); + if (!this.model.get('isPortalUser')) { + if ((this.getAcl().check('EmailAccountScope') && this.model.id == this.getUser().id) || this.getUser().isAdmin()) { + this.menu.buttons.push({ + name: 'emailAccounts', + label: "Email Accounts", + style: 'default', + action: "emailAccounts" + }); + } - if ((this.getAcl().check('EmailAccountScope') && this.model.id == this.getUser().id) || this.getUser().isAdmin()) { - this.menu.buttons.push({ - name: 'emailAccounts', - label: "Email Accounts", - style: 'default', - action: "emailAccounts" - }); - } - - if (this.model.id == this.getUser().id && this.getAcl().checkScope('ExternalAccount')) { - this.menu.buttons.push({ - name: 'externalAccounts', - label: 'External Accounts', - style: 'default', - action: "externalAccounts" - }); + if (this.model.id == this.getUser().id && this.getAcl().checkScope('ExternalAccount')) { + this.menu.buttons.push({ + name: 'externalAccounts', + label: 'External Accounts', + style: 'default', + action: "externalAccounts" + }); + } } } - if (this.getAcl().checkScope('Calendar')) { + if (this.getAcl().checkScope('Calendar') && !this.model.get('isPortalUser')) { var showActivities = this.getAcl().checkUserPermission(this.model); if (!showActivities) { if (this.getAcl().get('userPermission') === 'team') { diff --git a/client/src/views/user/record/detail.js b/client/src/views/user/record/detail.js index ab418e1d70..8e4712a580 100644 --- a/client/src/views/user/record/detail.js +++ b/client/src/views/user/record/detail.js @@ -57,6 +57,11 @@ Espo.define('views/user/record/detail', 'views/record/detail', function (Dep) { } } + if (this.model.get('isPortalUser')) { + this.hidePanel('activities'); + this.hidePanel('history'); + } + if (this.model.id == this.getUser().id) { this.listenTo(this.model, 'after:save', function () { this.getUser().set(this.model.toJSON()); From d5fa18975eedfd4d7dcdb96064d543004e3a94b1 Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 14 Mar 2016 16:54:35 +0200 Subject: [PATCH 2/4] try catch for send password --- application/Espo/Services/User.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/Espo/Services/User.php b/application/Espo/Services/User.php index baab0fc2da..bd28df9ace 100644 --- a/application/Espo/Services/User.php +++ b/application/Espo/Services/User.php @@ -224,7 +224,9 @@ class User extends Record if (!is_null($newPassword) && !empty($data['sendAccessInfo'])) { if ($user->isActive()) { - $this->sendPassword($user, $newPassword); + try { + $this->sendPassword($user, $newPassword); + } catch (\Exception $e) {} } } From 557a48ec6a169eba86891b858a415e342c8c9fa9 Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 15 Mar 2016 16:01:43 +0200 Subject: [PATCH 3/4] isDraggable --- client/src/ui.js | 6 +++--- client/src/views/modal.js | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/ui.js b/client/src/ui.js index 901d4824c5..1aea7d0748 100644 --- a/client/src/ui.js +++ b/client/src/ui.js @@ -40,11 +40,11 @@ Espo.define('ui', [], function () { this.height = false; this.buttons = []; this.removeOnClose = true; - this.graggable = false; + this.draggable = false; this.container = 'body' this.onRemove = function () {}; - var params = ['className', 'backdrop', 'keyboard', 'closeButton', 'header', 'body', 'width', 'height', 'fitHeight', 'buttons', 'removeOnClose', 'graggable', 'container', 'onRemove']; + var params = ['className', 'backdrop', 'keyboard', 'closeButton', 'header', 'body', 'width', 'height', 'fitHeight', 'buttons', 'removeOnClose', 'draggable', 'container', 'onRemove']; params.forEach(function (param) { if (param in options) { this[param] = options[param]; @@ -99,7 +99,7 @@ Espo.define('ui', [], function () { } }.bind(this)); - if (this.graggable) { + if (this.draggable) { this.$el.find('header').css('cursor', 'pointer'); this.$el.draggable({ handle: 'header', diff --git a/client/src/views/modal.js b/client/src/views/modal.js index 1b24aec151..5f6c451016 100644 --- a/client/src/views/modal.js +++ b/client/src/views/modal.js @@ -53,6 +53,8 @@ Espo.define('views/modal', 'view', function (Dep) { escapeDisabled: false, + isDraggable: false, + events: { 'click .action': function (e) { var $target = $(e.currentTarget); @@ -135,6 +137,7 @@ Espo.define('views/modal', 'view', function (Dep) { width: this.width, keyboard: !this.escapeDisabled, fitHeight: this.fitHeight, + draggable: this.isDraggable, onRemove: function () { this.onDialogClose(); }.bind(this) From 5783f4e7083001d5e4961d2692f5e8060459b591 Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 16 Mar 2016 12:48:18 +0200 Subject: [PATCH 4/4] fix autoincrement --- application/Espo/ORM/DB/Mapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/Espo/ORM/DB/Mapper.php b/application/Espo/ORM/DB/Mapper.php index dfbd36d8f0..d1cb0fb9bb 100644 --- a/application/Espo/ORM/DB/Mapper.php +++ b/application/Espo/ORM/DB/Mapper.php @@ -798,7 +798,7 @@ abstract class Mapper implements IMapper foreach ($entity->fields as $field => $fieldDefs) { if ($entity->has($field)) { if ($onlyStorable) { - if (!empty($fieldDefs['notStorable']) || isset($fieldDefs['source']) && $fieldDefs['source'] != 'db') + if (!empty($fieldDefs['notStorable']) || !empty($fieldDefs['autoincrement']) || isset($fieldDefs['source']) && $fieldDefs['source'] != 'db') continue; if ($fieldDefs['type'] == IEntity::FOREIGN) continue;