0013352: add pin protection to folders
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 21 Jul 2017 07:43:52 +0000 (09:43 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 24 Jul 2017 16:09:14 +0000 (18:09 +0200)
* adds pin_protected to tree node model (js)
* adds checkbox to folder grants panel

https://forge.tine20.org/view.php?id=13352

Change-Id: I9e7a15781f58ee19f571067659ff20955b95342d
Reviewed-on: http://gerrit.tine20.com/customers/5279
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Filemanager/js/GrantsPanel.js
tine20/Filemanager/js/NodeEditDialog.js
tine20/Tinebase/js/Models.js

index 7798e9f..cc32b02 100644 (file)
@@ -43,6 +43,15 @@ Tine.Filemanager.GrantsPanel = Ext.extend(Ext.Panel, {
         this.hasOwnRightsDescription = new Ext.form.Label({
             text: this.app.i18n._("Grants of a folder also apply recursively for all of its sub folders as long they don't have own grants itself.")
         });
+        this.pinProtectionCheckbox = new Ext.form.Checkbox({
+            disabled: true,
+            boxLabel: this.app.i18n._('This folder is pin protected')
+            // TODO needed?
+            //listeners: {scope: this, check: this.onPinProtectionCheck}
+        });
+        this.pinProtectionDescription = new Ext.form.Label({
+            text: this.app.i18n._("If pin protection is enabled, users have to authenticate with their pin before they can access the folder contents.")
+        });
         this.grantsGrid = new Tine.widgets.container.GrantsGrid({
             downloadGrantTitle: 'Download', // i18n._('Download')
             downloadGrantDescription: 'The grant to download files', // i18n._('The grant to download files')
@@ -70,7 +79,9 @@ Tine.Filemanager.GrantsPanel = Ext.extend(Ext.Panel, {
                 width: '100%',
                 items: [
                     this.hasOwnGrantsCheckbox,
-                    this.hasOwnRightsDescription
+                    this.hasOwnRightsDescription,
+                    this.pinProtectionCheckbox,
+                    this.pinProtectionDescription
                 ]},
                 this.grantsGrid
             ]
@@ -81,6 +92,7 @@ Tine.Filemanager.GrantsPanel = Ext.extend(Ext.Panel, {
 
     onOwnGrantsCheck: function(cb, checked) {
         this.grantsGrid.setReadOnly(!checked);
+        this.pinProtectionCheckbox.setDisabled(!checked);
     },
 
     onRecordLoad: function(editDialog, record, ticketFn) {
@@ -91,6 +103,7 @@ Tine.Filemanager.GrantsPanel = Ext.extend(Ext.Panel, {
         this.hasOwnGrantsCheckbox.setDisabled(! lodash.get(record, 'data.account_grants.adminGrant', false)
             || record.get('type') != 'folder');
         this.hasOwnGrantsCheckbox.setValue(record.get('acl_node') == record.id);
+        this.pinProtectionCheckbox.setValue(record.get('pin_protected'));
 
         this.grantsGrid.useGrant('admin', !!String(record.get('path')).match(/^\/shared/));
         this.grantsGrid.getStore().loadData(record.data);
@@ -106,12 +119,14 @@ Tine.Filemanager.GrantsPanel = Ext.extend(Ext.Panel, {
 
     onRecordUpdate: function(editDialog, record) {
         var acl_node = this.hasOwnGrantsCheckbox.getValue() ? record.id : '',
-            grants = [];
+            grants = [],
+            pin_protected = this.pinProtectionCheckbox.getValue() ? true : false;
 
         this.grantsGrid.getStore().each(function(r) {grants.push(r.data)});
 
         record.set('acl_node', acl_node);
         record.set('grants', '');
         record.set('grants', grants);
+        record.set('pin_protected', pin_protected);
     }
 });
\ No newline at end of file
index f8799e7..91e0d09 100644 (file)
@@ -3,7 +3,7 @@
  * 
  * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
  * @author      Alexander Stintzing <a.stintzing@metaways.de>
- * @copyright   Copyright (c) 2012-2014 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2012-2017 Metaways Infosystems GmbH (http://www.metaways.de)
  */
 Ext.ns('Tine.Filemanager');
 
index d2b2a0b..437a33c 100644 (file)
@@ -505,6 +505,7 @@ Tine.Tinebase.Model.Tree_NodeArray = Tine.Tinebase.Model.modlogFields.concat([
     { name: 'revision_size', label: 'Revision Size' }, // _('Revision Size')
     { name: 'preview_count', label: 'Preview Count' }, // _('Preview Count')
     { name: 'isIndexed', label: 'Indexed' }, // _('Indexed')
+    { name: 'pin_protected', label: 'Pin Protected' }, // _('Pin Protected')
 
     { name: 'relations' },
     { name: 'customfields' },