Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(Filemanager): don't allow to rename non editable (acl) nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusweiss committed Jul 27, 2021
1 parent c17233e commit 1f9d1d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
13 changes: 1 addition & 12 deletions tine20/Filemanager/js/NodeGridPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,7 @@ Tine.Filemanager.NodeGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
* @returns {boolean}
*/
onBeforeEdit: function(row) {
const record = row.record;

// TODO do we have a function to find out top level nodes?
if (record.id && record.get('path') && (
['myUser', 'otherUsers', 'shared'].indexOf(record.get('id')) !== -1
|| record.get('path').match(/^\/personal\/\w+$/)
)) {
// do not allow to edit user/shared top level nodes
return false;
}

return true;
return Tine.Filemanager.nodeActionsMgr.checkConstraints('edit', row.record);
},

/**
Expand Down
14 changes: 12 additions & 2 deletions tine20/Filemanager/js/nodeActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ Tine.Filemanager.nodeActionsMgr = new (Ext.extend(Tine.widgets.ActionManager, {

if (action === 'delete') {
// delete grant required
isAllowed = isAllowed && _.get(targetNode, 'data.account_grants.deleteGrant')
isAllowed = isAllowed && _.get(targetNode, 'data.account_grants.deleteGrant', false);
}

if (action === 'edit') {
// edit grant required
isAllowed = isAllowed && _.get(targetNode, 'data.account_grants.editGrant', false);
}

// don't allow any actions
Expand Down Expand Up @@ -164,7 +169,12 @@ Tine.Filemanager.nodeActions.CreateFolder = {
const gridWdgt = grid.ownerCt.ownerCt;
const newRecord = new Tine.Filemanager.Model.Node(Tine.Filemanager.Model.Node.getDefaultData({
name: app.i18n._('New Folder'),
type: 'folder'
type: 'folder',
account_grants: {
addGrant: true,
editGrant: true,
deleteGrant: true
}
}));

gridWdgt.newInlineRecord(newRecord, 'name', async (localRecord) => {
Expand Down

0 comments on commit 1f9d1d9

Please sign in to comment.