WIP allow to document admin actions, if EPL policy app is installed

This commit is contained in:
Ralf Becker 2018-08-02 11:40:02 +02:00
parent 024c8ce7fb
commit 250b56589c
3 changed files with 60 additions and 1 deletions

View File

@ -148,6 +148,7 @@ class admin_account
'account_primary_group',
'account_expires',
'homedirectory', 'loginshell',
'requested', 'requested_email', 'comment', // admin_cmd documentation (EPL)
) as $c_name => $a_name)
{
if (is_int($c_name)) $c_name = $a_name;

View File

@ -13,7 +13,36 @@ use EGroupware\Api;
use EGroupware\Api\Acl;
/**
* admin comand base class
* Admin comand base class
*
* Admin commands should be used to implement and log (!) all actions admins carry
* out using the administrative rights (regular users cant do).
*
* They are stored in DB table egw_admin_queue which builds a persitent log
* of administrative actions cared out on an EGroupware installation.
* Commands can be marked deleted (canceled for scheduled commands),
* but they are never deleted for the table to implement a persistent log!
*
* All administrative actions are encapsulated in classes derived from this
* abstract base class implementing an exec method to carry out the command.
*
* @property-read int $created Creation timestamp
* @property-read int $creator Creator user-id
* @property-read string $creator_email rfc822 address ("Name <email@domain.com>") of creator
* @property-read int $modified Modification timestamp
* @property-read int|NULL $scheduled timestamp if command is not run immediatly,
* but scheduled to run automatic by the system at a later point in time
* @property-read int $modifier Modifier user-id
* @property-read string $modifier_email rfc822 address ("Name <email@domain.com>") of modifier
* @property int|NULL $requested User who requested the change (not current user!)
* @property string|NULL $requested_email rfc822 address ("Name <email@domain.com>") of requested
* @property string|NULL $comment comment, eg. reasoning why change was requested
* @property-read int|NULL $errno Numerical error-code or NULL on success
* @property-read string|NULL $error Error message or NULL on success
* @property-read int $id $id of command/row in egw_admin_queue table
* @property-read string $uid uuid of command (necessary if command is send to a remote system to execute)
* @property int|NULL $remote_id id of remote system, if command is not meant to run on local system
* foreign key into egw_admin_remote (table of remote systems administrated by this one)
*/
abstract class admin_cmd
{
@ -328,6 +357,12 @@ abstract class admin_cmd
$vars['data'] = in_array($this->status, self::$require_pw_stati) ?
json_encode($this->data) : self::mask_passwords($this->data);
// skip EGroupware\\ prefix in new class-names, as value gets too long for column otherwise
if (strpos($this->type, 'EGroupware\\') === 0)
{
$vars['type'] = substr($this->type, 11);
}
admin_cmd::$sql->init($vars);
if (admin_cmd::$sql->save() != 0)
{

View File

@ -191,6 +191,29 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
}
},
/**
* Set specified account-data of selected user in an other widget
*
* Used eg. in template as: onchange="egw.set_account_data(widget, 'target', 'account_email')"
*
* @param {et2_widget} _src_widget widget to select the user
* @param {string} _target_name name of widget to set the data
* @param {string} _field name of data to set eg. "account_email"
*/
set_account_data: function(_src_widget, _target_name, _field)
{
var user = _src_widget.get_value();
var target = _src_widget.getRoot().getWidgetById(_target_name);
if (user && target)
{
egw.accountData(user, _field, false, function(_data)
{
target.set_value(_data[user]);
});
};
},
/**
* Invalidate client-side account cache
*