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

Commit

Permalink
Merge branch 'pu/cf/disableRemoteDeviceReset' into '2022.11'
Browse files Browse the repository at this point in the history
feature(ActiveSync): disable remoteDeviceReset on AdminPanel

See merge request tine20/tine20!1805
  • Loading branch information
pschuele committed Mar 15, 2022
2 parents aa9fa50 + 98ebdcb commit 76b5280
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
13 changes: 13 additions & 0 deletions tine20/ActiveSync/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class ActiveSync_Config extends Tinebase_Config_Abstract
*/
const DISABLE_ACCESS_LOG = 'disableaccesslog';

const DISABLE_REMOTE_RESET = 'disableremotereset';

/**
* MAX_FILTER_TYPE_EMAIL
*
Expand Down Expand Up @@ -93,6 +95,17 @@ class ActiveSync_Config extends Tinebase_Config_Abstract
// '/^Android-Mail.*/', // example if you like to deny all Android-Mail* clients
],
),
self::DISABLE_REMOTE_RESET => [
//_('Disable Remote Reset Action')
'label' => 'Disable Remote Reset Action',
//_('Disable Remote Reset Action AdminPanel')
'description' => 'Disable Remote Reset Action on AdminPanel',
'type' => Tinebase_Config_Abstract::TYPE_BOOL,
'clientRegistryInclude' => true,
'setByAdminModule' => FALSE,
'setBySetupModule' => TRUE,
'default' => FALSE,
],
self::DISABLE_ACCESS_LOG => array(
//_('Disable Access Log')
'label' => 'Disable Access Log creation',
Expand Down
23 changes: 23 additions & 0 deletions tine20/ActiveSync/Frontend/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,27 @@ public function resetSync(Zend_Console_Getopt $opts)

return ($result) ? 0 : 1;
}


/**
*
* remoteDeviceReset
* set remoteWipe flag for device (id)
* php tine20.php --method=ActiveSync.remoteDeviceReset id=12345
* @param Zend_Console_Getopt $opts
* @return int
* @throws Tinebase_Exception_AccessDenied
* @throws Tinebase_Exception_InvalidArgument
* @throws Tinebase_Exception_NotFound
*/
public function remoteDeviceReset(Zend_Console_Getopt $opts)
{
$args = $this->_parseArgs($opts, ['id']);
if (! $args['id'] || ! $this->_checkAdminRight(false)) {
return 1;
}

ActiveSync_Controller_SyncDevices::getInstance()->remoteResetDevices([ActiveSync_Controller_Device::getInstance()->get($args['id'])]);
return 0;
}
}
19 changes: 11 additions & 8 deletions tine20/ActiveSync/js/SyncDevicesGridPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,18 @@ Tine.ActiveSync.SyncDevicesGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
* @returns {Array}
*/
getAdditionalCtxItems: function() {
this.actionRemoteResetDevices = new Ext.Action({
text: this.app.i18n._('Remote Device Reset'),
disabled: ! Tine.Tinebase.common.hasRight('RESET DEVICES', 'ActiveSync'),
scope: this,
handler: this.onRemoteResetDevices,
iconCls: 'action_wipeDevice'
});
if (!this.app.getRegistry().get('config')['disableremotereset'].value) {
this.actionRemoteResetDevices = new Ext.Action({
text: this.app.i18n._('Remote Device Reset'),
disabled: !Tine.Tinebase.common.hasRight('RESET DEVICES', 'ActiveSync'),
scope: this,
handler: this.onRemoteResetDevices,
iconCls: 'action_wipeDevice',
});

return [this.actionRemoteResetDevices];
return [this.actionRemoteResetDevices];
}
return null;
},

/**
Expand Down

0 comments on commit 76b5280

Please sign in to comment.