mirror of
https://github.com/dducret/kopano-webapp-passwd
synced 2026-07-27 10:32:26 +02:00
commit initial skeleton of the plugin
nothing is working
This commit is contained in:
parent
b6c8396ab6
commit
843f674854
7 changed files with 397 additions and 0 deletions
42
php/class.passwdmodule.php
Normal file
42
php/class.passwdmodule.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Passwd module.
|
||||
*
|
||||
*/
|
||||
|
||||
class PasswdModule extends Module
|
||||
{
|
||||
public function __construct($id, $data) {
|
||||
parent::Module($id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the incoming events that were fire by the client.
|
||||
*
|
||||
* @return boolean True if everything was processed correctly.
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$result = false;
|
||||
|
||||
foreach($this->data as $actionType => $actionData)
|
||||
{
|
||||
if(isset($actionType)) {
|
||||
try {
|
||||
switch($actionType)
|
||||
{
|
||||
case "save":
|
||||
$this->save($actionData);
|
||||
break;
|
||||
default:
|
||||
$this->handleUnknownActionType($actionType);
|
||||
}
|
||||
} catch (MAPIException $e) {
|
||||
$this->sendFeedback(false, $this->errorDetailsFromException($e));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
55
php/plugin.passwd.php
Normal file
55
php/plugin.passwd.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* Passwd plugin.
|
||||
*
|
||||
* Allows to change user password from webapp.
|
||||
*
|
||||
* Author: Saket patel <s.patel@zarafa.com>
|
||||
*/
|
||||
|
||||
class Pluginpasswd extends Plugin {
|
||||
|
||||
public function __construct() {}
|
||||
|
||||
/**
|
||||
* Function initializes the Plugin and registers all hooks
|
||||
*/
|
||||
function init() {
|
||||
$this->registerHook('server.core.settings.init.before');
|
||||
}
|
||||
|
||||
/**
|
||||
* Function is executed when a hook is triggered by the PluginManager
|
||||
*
|
||||
* @param string $eventID the id of the triggered hook
|
||||
* @param mixed $data object(s) related to the hook
|
||||
*/
|
||||
function execute($eventID, &$data) {
|
||||
switch($eventID) {
|
||||
case 'server.core.settings.init.before' :
|
||||
$this->injectPluginSettings($data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the core Settings class is initialized and ready to accept sysadmin default
|
||||
* settings. Registers the sysadmin defaults for the SugarCRM plugin.
|
||||
* @param Array $data Reference to the data of the triggered hook
|
||||
*/
|
||||
function injectPluginSettings(&$data) {
|
||||
$data['settingsObj']->addSysAdminDefaults(Array(
|
||||
'zarafa' => Array(
|
||||
'v1' => Array(
|
||||
'plugins' => Array(
|
||||
'sugarcrm' => Array(
|
||||
'enable' => PLUGIN_PASSWD_USER_DEFAULT_ENABLE,
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue