This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
plugins:demo [2012/02/18 21:28] nuxwin [Version Info] |
plugins:demo [2014/02/22 15:54] nuxwin |
||
---|---|---|---|
Line 1: | Line 1: | ||
=====i-MSCP Demo Plugin ===== | =====i-MSCP Demo Plugin ===== | ||
- | |||
- | ====== Version Info ====== | ||
- | ^Plugin Version|0.0.7| | ||
- | ^Author|Laurent Declercq <[email protected]>| | ||
- | ^License|GPLv2| | ||
- | ^i-MSCP compatibility version|>= 1.0.2.1 (No released version)| | ||
- | ^Last Update|2012-02-16| | ||
======Introduction====== | ======Introduction====== | ||
Line 17: | Line 10: | ||
- Provide an actions list that must be disabled | - Provide an actions list that must be disabled | ||
- | =====I. Plugin configuration===== | + | =====Plugin configuration===== |
- | ====A. Modal dialog box on login page==== | + | ====Modal dialog box on login page==== |
The dialog box is only displayed if you provide a set of configuration parameters that describe user accounts. The plugin configuration file contains a simple PHP associative array (//See the sample below//). | The dialog box is only displayed if you provide a set of configuration parameters that describe user accounts. The plugin configuration file contains a simple PHP associative array (//See the sample below//). | ||
Line 37: | Line 30: | ||
</code> | </code> | ||
- | **Note:** User accounts are show in dialog box only if they exists in the i-MSCP database. | + | **Note:** User accounts are shown in dialog box only if they exists in the i-MSCP database. |
- | ====B. Protection against deletion and password modification (Demo users)==== | + | ====Protection against deletion and password modification (Demo users)==== |
If an user account has the protected option set to TRUE (as above), it will be protected against deletion, and password modification. | If an user account has the protected option set to TRUE (as above), it will be protected against deletion, and password modification. | ||
- | ====C. Disabled actions==== | + | ====Disabled actions==== |
The plugin allows to disable some actions such as '**addFtp**', '**EditFtp**', '**DeleteFtp**'. The action names are same as event names dispatched in i-MSCP code. Only the **onBefore*** actions are supported since the others are not really relevant in the demo plugin context. You can see all integrated events by reading the [[https://github.com/i-MSCP/imscp/blob/master/gui/library/iMSCP/Events.php|iMSCP_Events]] class. | The plugin allows to disable some actions such as '**addFtp**', '**EditFtp**', '**DeleteFtp**'. The action names are same as event names dispatched in i-MSCP code. Only the **onBefore*** actions are supported since the others are not really relevant in the demo plugin context. You can see all integrated events by reading the [[https://github.com/i-MSCP/imscp/blob/master/gui/library/iMSCP/Events.php|iMSCP_Events]] class. | ||
Line 64: | Line 57: | ||
</code> | </code> | ||
- | ====D. Configuration file sample==== | + | ====Configuration file sample==== |
A configuration file for the demo plugin can be: | A configuration file for the demo plugin can be: | ||
Line 70: | Line 63: | ||
<code php> | <code php> | ||
<?php | <?php | ||
+ | // Configuration file sample for the demo plugin | ||
+ | |||
return array( | return array( | ||
- | /* | + | // List of user accounts that will be available via select box on login page. If an user account is protected, it |
- | List of user accounts that will be available via select box on login page. If an user account is protected, it | + | // will be imposible to remove it. Also, its password will be protected against modification. |
- | will be imposible to remove it. Also, its password will be protected against modification. | + | |
- | */ | + | |
'user_accounts' => array( | 'user_accounts' => array( | ||
array( | array( | ||
Line 80: | Line 73: | ||
'username' => 'admin1', | 'username' => 'admin1', | ||
'password' => 'admin1', | 'password' => 'admin1', | ||
+ | 'protected' => true | ||
+ | ), | ||
+ | array( | ||
+ | 'label' => 'Administrator 2', | ||
+ | 'username' => 'admin2', | ||
+ | 'password' => 'admin2', | ||
+ | 'protected' => true | ||
+ | ), | ||
+ | array( | ||
+ | 'label' => 'Administrator 3', | ||
+ | 'username' => 'admin3', | ||
+ | 'password' => 'admin3', | ||
'protected' => true | 'protected' => true | ||
), | ), | ||
Line 86: | Line 91: | ||
'username' => 'reseller1', | 'username' => 'reseller1', | ||
'password' => 'reseller1', | 'password' => 'reseller1', | ||
+ | 'protected' => true | ||
+ | ), | ||
+ | array( | ||
+ | 'label' => 'Reseller 2', | ||
+ | 'username' => 'reseller2', | ||
+ | 'password' => 'reseller2', | ||
+ | 'protected' => true | ||
+ | ), | ||
+ | array( | ||
+ | 'label' => 'Reseller 3', | ||
+ | 'username' => 'reseller3', | ||
+ | 'password' => 'reseller3', | ||
+ | 'protected' => true | ||
+ | ), | ||
+ | array( | ||
+ | 'label' => 'Customer 1', | ||
+ | 'username' => 'domain1.tld', | ||
+ | 'password' => 'domain1', | ||
+ | 'protected' => true | ||
+ | ), | ||
+ | array( | ||
+ | 'label' => 'Customer 2', | ||
+ | 'username' => 'domain2.tld', | ||
+ | 'password' => 'domain2', | ||
+ | 'protected' => true | ||
+ | ), | ||
+ | array( | ||
+ | 'label' => 'Customer 3', | ||
+ | 'username' => 'domain3.tld', | ||
+ | 'password' => 'domain3', | ||
'protected' => true | 'protected' => true | ||
) | ) | ||
), | ), | ||
- | /* | + | // List of actions that must be totally disabled. Each action must be prefixed by 'onBefore' |
- | List of actions that must be totally disabled. Each action must be prefixed by 'onBefore' | + | // |
- | */ | + | // Important consideration: |
+ | // Even if you add the 'onBeforeDeactivatePlugin' in the list below, you'll still able to deactivate this plugin. | ||
+ | // The only way to protect this plugin against deactivation is to protect it using the plugin protection feature. | ||
'disabled_actions' => array( | 'disabled_actions' => array( | ||
+ | 'onBeforeEditAdminGeneralSettings', | ||
+ | 'onBeforeAddUser', | ||
+ | 'onBeforeEditUser', | ||
+ | 'onBeforeDeleteUser', | ||
+ | 'onBeforeDeleteCustomer', | ||
'onBeforeAddFtp', | 'onBeforeAddFtp', | ||
'onBeforeEditFtp', | 'onBeforeEditFtp', | ||
Line 101: | Line 143: | ||
'onBeforeDeleteSqlUser', | 'onBeforeDeleteSqlUser', | ||
'onBeforeAddSqlDb', | 'onBeforeAddSqlDb', | ||
- | 'onBeforeDeleteSqlDb' | + | 'onBeforeDeleteSqlDb', |
+ | 'onBeforeUpdatePluginList', | ||
+ | 'onBeforeInstallPlugin', | ||
+ | 'onBeforeUninstallPlugin', | ||
+ | 'onBeforeEnablePlugin', | ||
+ | 'onBeforeDisablePlugin', | ||
+ | 'onBeforeUpdatePlugin', | ||
+ | 'onBeforeDeletePlugin', | ||
+ | 'onBeforeProtectPlugin', | ||
+ | 'onBeforeAddDomain', | ||
+ | 'onBeforeEditDomain', | ||
+ | 'onBeforeAddSubdomain', | ||
+ | 'onBeforeEditSubdomain', | ||
+ | 'onBeforeDeleteSubdomain', | ||
+ | 'onBeforeAddDomainAlias', | ||
+ | 'onBeforeEditDomainAlias', | ||
+ | 'onBeforeDeleteDomainAlias', | ||
+ | 'onBeforeAddMail', | ||
+ | 'onBeforeEditMail', | ||
+ | 'onBeforeDeleteMail', | ||
+ | 'onBeforeAddExternalMailServer', | ||
+ | 'onBeforeChangeDomainStatus' | ||
) | ) | ||
); | ); | ||
Line 108: | Line 171: | ||
This file live in the [[https://github.com/i-MSCP/imscp/tree/master/gui/plugins/Demo|gui/plugins/Demo]] directory and is named [[https://github.com/i-MSCP/imscp/blob/master/gui/plugins/Demo/config.php|config.php]]. | This file live in the [[https://github.com/i-MSCP/imscp/tree/master/gui/plugins/Demo|gui/plugins/Demo]] directory and is named [[https://github.com/i-MSCP/imscp/blob/master/gui/plugins/Demo/config.php|config.php]]. | ||
- | =====II. Plugin activation===== | + | =====Plugin activation===== |
- | To activate the plugin, you must configure it and update the plugin list via the i-MSCP plugin management interface. After you must activate it by clicking on the activate link into the plugin management interface. | + | To activate the plugin, you must configure it and update the plugin list via the i-MSCP plugin management interface. Once it's done, you must activate it by clicking on the activate link into the plugin management interface. |
**Important** | **Important** | ||
- | In production, this plugin must be protected against deactivation. For this, you must protect it by clicking on the **protect** link in the plugin management interface. | + | In production environment, this plugin must be protected against deactivation. For this, you must protect it by clicking on the **protect** link in the plugin management interface. |
- | =====III. Plugin deactivation===== | + | =====Plugin deactivation===== |
- | First, if the plugin is protected, you must edit the **gui/data/cache/protected_plugins.php** file to remove it from the list of protected plugins. After, you will be able to deactivate it by clicking on the **deactivate** link into the plugin management interface. | + | First, if the plugin is protected, you must edit the **gui/data/persistent/protected_plugins.php** file to remove it from the list of protected plugins. After, you will be able to deactivate it by clicking on the **deactivate** link into the plugin management interface. |
Feel free to test it and report any bugs or suggestions for improvement. | Feel free to test it and report any bugs or suggestions for improvement. |