Skip to content
Permalink
Browse files

Add Mass Process Audits

- Users
- Email Templates
  • Loading branch information...
aydreeihn committed Jul 5, 2019
1 parent a4bd53b commit e0ca7e2ac7ec734187bc45b9857c7bf8df2bf8ed
Showing with 48 additions and 6 deletions.
  1. +19 −2 scp/templates.php
  2. +29 −4 scp/users.php
@@ -103,6 +103,13 @@
$sql='UPDATE '.EMAIL_TEMPLATE_GRP_TABLE.' SET isactive=1 '
.' WHERE tpl_id IN ('.implode(',', db_input($_POST['ids'])).')';
if(db_query($sql) && ($num=db_affected_rows())){
foreach ($_POST['ids'] as $k=>$v) {
if (PluginManager::auditPlugin()) {
$tmpl = EmailTemplateGroup::lookup($v);
$type = array('type' => 'edited', 'status' => 'Enabled');
Signal::send('object.edited', $tmpl, $type);
}
}
if($num==$count)
$msg = sprintf(__('Successfully enabled %s'),
_N('selected template set', 'selected template sets', $count));
@@ -116,13 +123,23 @@
break;
case 'disable':
$i=0;
$templates = array();
foreach($_POST['ids'] as $k=>$v) {
if(($t=EmailTemplateGroup::lookup($v)) && !$t->isInUse() && $t->disable())
if(($t=EmailTemplateGroup::lookup($v)) && !$t->isInUse() && $t->disable()) {
$templates[] = $t;
$i++;
}
}
if($i && $i==$count)
if($i && $i==$count) {
$msg = sprintf(__('Successfully disabled %s'),
_N('selected template set', 'selected template sets', $count));
foreach ($templates as $tmpl) {
if (PluginManager::auditPlugin()) {
$type = array('type' => 'edited', 'status' => 'Disabled');
Signal::send('object.edited', $tmpl, $type);
}
}
}
elseif($i)
$warn = sprintf(__('%1$d of %2$d %3$s disabled'), $i, $count,
_N('selected template set', 'selected template sets', $count))
@@ -84,14 +84,25 @@
switch (strtolower($_POST['a'])) {
case 'lock':
foreach ($users as $U)
if (($acct = $U->getAccount()) && $acct->lock())
if (($acct = $U->getAccount()) && $acct->lock()) {
if (PluginManager::auditPlugin()) {
$type = array('type' => 'edited', 'key' => 'locked-flag');
Signal::send('object.edited', $acct, $type);
}
$count++;
}
break;
case 'unlock':
foreach ($users as $U)
if (($acct = $U->getAccount()) && $acct->unlock())
if (($acct = $U->getAccount()) && $acct->unlock()) {
if (PluginManager::auditPlugin()) {
$type = array('type' => 'edited', 'key' => 'unlocked-flag');
Signal::send('object.edited', $acct, $type);
}
$count++;
}
break;
case 'delete':
@@ -108,12 +119,21 @@
case 'reset':
foreach ($users as $U)
if (($acct = $U->getAccount()) && $acct->sendResetEmail())
if (($acct = $U->getAccount()) && $acct->sendResetEmail()) {
if (PluginManager::auditPlugin()) {
$type = array('type' => 'edited', 'key' => 'pwreset-sent');
Signal::send('object.edited', $acct, $type);
}
$count++;
}
break;
case 'register':
foreach ($users as $U) {
if (PluginManager::auditPlugin()) {
$type = array('type' => 'edited', 'key' => 'user-registered');
Signal::send('object.edited', $U, $type);
}
if (($acct = $U->getAccount()) && $acct->sendConfirmEmail())
$count++;
elseif ($acct = UserAccount::register($U,
@@ -128,8 +148,13 @@
if (!($org = Organization::lookup($_POST['org_id'])))
$errors['err'] = sprintf('%s - %s', __('Unknown action'), __('Get technical help!'));
foreach ($users as $U) {
if ($U->setOrganization($org))
if ($U->setOrganization($org)) {
if (PluginManager::auditPlugin()) {
$type = array('type' => 'edited', 'key' => 'user-org');
Signal::send('object.edited', $U, $type);
}
$count++;
}
}
break;

0 comments on commit e0ca7e2

Please sign in to comment.
You can’t perform that action at this time.