ref
This commit is contained in:
@@ -26,37 +26,39 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl-portal/email', ['acl-portal'], function (Dep) {
|
||||
import AclPortal from 'acl-portal';
|
||||
|
||||
return Dep.extend({
|
||||
class EmailAclPortal extends AclPortal {
|
||||
|
||||
checkModelRead: function (model, data, precise) {
|
||||
var result = this.checkModel(model, data, 'read', precise);
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
checkModelRead(model, data, precise) {
|
||||
let result = this.checkModel(model, data, 'read', precise);
|
||||
|
||||
if (result) {
|
||||
if (result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (data === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let d = data || {};
|
||||
|
||||
if (d.read === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (model.has('usersIds')) {
|
||||
if (~(model.get('usersIds') || []).indexOf(this.getUser().id)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (precise) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (data === false) {
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
var d = data || {};
|
||||
if (d.read === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (model.has('usersIds')) {
|
||||
if (~(model.get('usersIds') || []).indexOf(this.getUser().id)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (precise) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
});
|
||||
});
|
||||
export default EmailAclPortal;
|
||||
|
||||
@@ -26,15 +26,17 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl-portal/notification', ['acl-portal'], function (Dep) {
|
||||
import AclPortal from 'acl-portal';
|
||||
|
||||
return Dep.extend({
|
||||
class NotificationAclPortal extends AclPortal {
|
||||
|
||||
checkIsOwner: function (model) {
|
||||
if (this.getUser().id === model.get('userId')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
});
|
||||
});
|
||||
checkIsOwner(model) {
|
||||
if (this.getUser().id === model.get('userId')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export default NotificationAclPortal;
|
||||
|
||||
@@ -26,16 +26,17 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl-portal/preferences', ['acl-portal'], function (Dep) {
|
||||
import AclPortal from 'acl-portal';
|
||||
|
||||
return Dep.extend({
|
||||
class PreferencesAclPortal extends AclPortal {
|
||||
|
||||
checkIsOwner: function (model) {
|
||||
if (this.getUser().id === model.id) {
|
||||
return true;
|
||||
}
|
||||
checkIsOwner(model) {
|
||||
if (this.getUser().id === model.id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export default PreferencesAclPortal;
|
||||
|
||||
+78
-74
@@ -26,92 +26,96 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl/email', ['acl'], function (Dep) {
|
||||
import Acl from 'acl';
|
||||
|
||||
return Dep.extend({
|
||||
class EmailAcl extends Acl {
|
||||
|
||||
checkModelRead: function (model, data, precise) {
|
||||
var result = this.checkModel(model, data, 'read', precise);
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
checkModelRead(model, data, precise) {
|
||||
let result = this.checkModel(model, data, 'read', precise);
|
||||
|
||||
if (result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (data === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var d = data || {};
|
||||
if (d.read === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (model.has('usersIds')) {
|
||||
if (~(model.get('usersIds') || []).indexOf(this.getUser().id)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (precise) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
checkIsOwner: function (model) {
|
||||
if (
|
||||
this.getUser().id === model.get('assignedUserId') ||
|
||||
this.getUser().id === model.get('createdById')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!model.has('assignedUsersIds')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (~(model.get('assignedUsersIds') || []).indexOf(this.getUser().id)) {
|
||||
return true;
|
||||
}
|
||||
if (result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (data === false) {
|
||||
return false;
|
||||
},
|
||||
}
|
||||
|
||||
checkModelEdit: function (model, data, precise) {
|
||||
if (
|
||||
model.get('status') === 'Draft' &&
|
||||
model.get('createdById') === this.getUser().id
|
||||
) {
|
||||
let d = data || {};
|
||||
|
||||
if (d.read === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (model.has('usersIds')) {
|
||||
if (~(model.get('usersIds') || []).indexOf(this.getUser().id)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (precise) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.checkModel(model, data, 'edit', precise);
|
||||
},
|
||||
return result;
|
||||
}
|
||||
|
||||
checkModelDelete: function (model, data, precise) {
|
||||
var result = this.checkModel(model, data, 'delete', precise);
|
||||
checkIsOwner(model) {
|
||||
if (
|
||||
this.getUser().id === model.get('assignedUserId') ||
|
||||
this.getUser().id === model.get('createdById')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
if (!model.has('assignedUsersIds')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (~(model.get('assignedUsersIds') || []).indexOf(this.getUser().id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
checkModelEdit(model, data, precise) {
|
||||
if (
|
||||
model.get('status') === 'Draft' &&
|
||||
model.get('createdById') === this.getUser().id
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.checkModel(model, data, 'edit', precise);
|
||||
}
|
||||
|
||||
checkModelDelete(model, data, precise) {
|
||||
let result = this.checkModel(model, data, 'delete', precise);
|
||||
|
||||
if (result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (data === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let d = data || {};
|
||||
|
||||
if (d.read === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (model.get('createdById') === this.getUser().id) {
|
||||
if (model.get('status') !== 'Sent' && model.get('status') !== 'Archived') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (data === false) {
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
var d = data || {};
|
||||
if (d.read === 'no') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (model.get('createdById') === this.getUser().id) {
|
||||
if (model.get('status') !== 'Sent' && model.get('status') !== 'Archived') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
});
|
||||
});
|
||||
export default EmailAcl;
|
||||
|
||||
+14
-13
@@ -26,19 +26,20 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl/foreign', ['acl'], function (Dep) {
|
||||
import Acl from 'acl';
|
||||
|
||||
/**
|
||||
* To be used for entities for which access is determined by access to a foreign record.
|
||||
*/
|
||||
return Dep.extend({
|
||||
/**
|
||||
* To be used for entities for which access is determined by access to a foreign record.
|
||||
*/
|
||||
class ForeignAcl extends Acl {
|
||||
|
||||
checkIsOwner: function (model) {
|
||||
return true;
|
||||
},
|
||||
checkIsOwner(model) {
|
||||
return true;
|
||||
}
|
||||
|
||||
checkInTeam: function (model) {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
});
|
||||
checkInTeam(model) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export default ForeignAcl;
|
||||
|
||||
+20
-18
@@ -26,28 +26,30 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl/import', ['acl'], function (Dep) {
|
||||
import Acl from 'acl';
|
||||
|
||||
return Dep.extend({
|
||||
class ImportAcl extends Acl {
|
||||
|
||||
checkScope: function (data, action, precise, entityAccessData) {
|
||||
return !!data;
|
||||
},
|
||||
checkScope(data, action, precise, entityAccessData) {
|
||||
return !!data;
|
||||
}
|
||||
|
||||
checkModelRead: function (model, data, precise) {
|
||||
// noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols
|
||||
checkModelRead(model, data, precise) {
|
||||
return true;
|
||||
}
|
||||
|
||||
checkIsOwner(model) {
|
||||
if (this.getUser().id === model.get('createdById')) {
|
||||
return true;
|
||||
},
|
||||
}
|
||||
|
||||
checkIsOwner: function (model) {
|
||||
if (this.getUser().id === model.get('createdById')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
checkModelDelete(model, data, precise) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
checkModelDelete: function (model, data, precise) {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
});
|
||||
export default ImportAcl;
|
||||
|
||||
@@ -26,16 +26,17 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl/notification', ['acl'], function (Dep) {
|
||||
import Acl from 'acl';
|
||||
|
||||
return Dep.extend({
|
||||
class NotificationAcl extends Acl {
|
||||
|
||||
checkIsOwner: function (model) {
|
||||
if (this.getUser().id === model.get('userId')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
checkIsOwner(model) {
|
||||
if (this.getUser().id === model.get('userId')) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export default NotificationAcl;
|
||||
|
||||
@@ -26,16 +26,17 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl/preferences', ['acl'], function (Dep) {
|
||||
import Acl from 'acl';
|
||||
|
||||
return Dep.extend({
|
||||
class PreferencesAcl extends Acl {
|
||||
|
||||
checkIsOwner: function (model) {
|
||||
if (this.getUser().id === model.id) {
|
||||
return true;
|
||||
}
|
||||
checkIsOwner(model) {
|
||||
if (this.getUser().id === model.id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export default PreferencesAcl;
|
||||
|
||||
@@ -26,14 +26,15 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl/team', ['acl'], function (Dep) {
|
||||
import Acl from 'acl';
|
||||
|
||||
return Dep.extend({
|
||||
class TeamAcl extends Acl {
|
||||
|
||||
checkInTeam: function (model) {
|
||||
var userTeamIdList = this.getUser().getTeamIdList();
|
||||
checkInTeam(model) {
|
||||
const userTeamIdList = this.getUser().getTeamIdList();
|
||||
|
||||
return (userTeamIdList.indexOf(model.id) != -1);
|
||||
},
|
||||
});
|
||||
});
|
||||
return (userTeamIdList.indexOf(model.id) !== -1);
|
||||
}
|
||||
}
|
||||
|
||||
export default TeamAcl;
|
||||
|
||||
+16
-14
@@ -26,22 +26,24 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('acl/user', ['acl'], function (Dep) {
|
||||
import Acl from 'acl';
|
||||
|
||||
return Dep.extend({
|
||||
class UserAcl extends Acl {
|
||||
|
||||
checkModelRead: function (model, data, precise) {
|
||||
if (model.isPortal()) {
|
||||
if (this.get('portalPermission') === 'yes') {
|
||||
return true;
|
||||
}
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
checkModelRead(model, data, precise) {
|
||||
if (model.isPortal()) {
|
||||
if (this.get('portalPermission') === 'yes') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return this.checkModel(model, data, 'read', precise);
|
||||
},
|
||||
return this.checkModel(model, data, 'read', precise);
|
||||
}
|
||||
|
||||
checkIsOwner: function (model) {
|
||||
return this.getUser().id === model.id;
|
||||
},
|
||||
});
|
||||
});
|
||||
checkIsOwner(model) {
|
||||
return this.getUser().id === model.id;
|
||||
}
|
||||
}
|
||||
|
||||
export default UserAcl;
|
||||
|
||||
Reference in New Issue
Block a user