Merge pull request #48 from zendesk/roman/granular_permissions

OFFAPPS-453 split out notes permission from organization editing
This commit is contained in:
Roman Sandler 2015-07-27 11:59:46 +10:00
Родитель e25a4e9f79 5dc08939d8
Коммит 056d106823
1 изменённых файлов: 14 добавлений и 9 удалений

23
app.js
Просмотреть файл

@ -250,9 +250,9 @@
return;
}
var role = this.currentUser().role();
this.orgEditable = false;
this.orgEditable = { general: false, notes: false };
if (role == "admin") {
this.orgEditable = true;
this.orgEditable = { general: true, notes: true };
} else if (role != "agent") {
this.countedAjax('getCustomRoles');
}
@ -280,9 +280,7 @@
if (!this.locale) {
this.locale = this.currentUser().locale();
}
if (this.storage.selectedOrgKeys.length > 0) {
this.setOrgEditable();
}
this.setOrgEditable();
if (this.ticket().requester()) {
this.requesterEmail = this.ticket().requester().email();
this.countedAjax('getUser', this.ticket().requester().id());
@ -399,9 +397,16 @@
var role = _.find(roles, function(role) {
return role.id == this.currentUser().role();
}, this);
this.orgEditable = role.configuration.organization_editing;
this.orgEditable.general = role.configuration.organization_editing;
this.orgEditable.notes = role.configuration.organization_notes_editing;
_.each(this.storage.organizationFields, function(field) {
field.editable = field.editable !== undefined ? this.orgEditable : undefined;
if (field.key === '##builtin_tags') {
return;
} else if (field.key === '##builtin_notes') {
field.editable = this.orgEditable.notes;
} else {
field.editable = this.orgEditable.general;
}
}, this);
},
@ -528,7 +533,7 @@
description: '',
position: Number.MAX_VALUE - 1,
active: true,
editable: this.orgEditable
editable: this.orgEditable.notes
},
{
key: '##builtin_details',
@ -536,7 +541,7 @@
description: '',
position: Number.MAXVALUE,
active: true,
editable: this.orgEditable
editable: this.orgEditable.general
}
].concat(data.organization_fields);
var activeFields = _.filter(fields, function(field) {