Commit e1091a09 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

[FEATURE] Send out mails

parent 2f3c7554
Pipeline #8146 failed with stages
in 22 seconds
......@@ -104,10 +104,10 @@ class GdprController extends ActionController
$this->forward('step1');
}
$user = $this->request->getArgument('user');
$data['username'] = $user;
$data['email'] = $user;
$data['deleted_by'] = $GLOBALS['BE_USER']->id;
$data['delete_date'] = mktime();
$data['username'] = $user['uid'][0];
$data['email'] = $user['mail'][0];
$data['deleted_by'] = $GLOBALS['BE_USER']->user['username'];
$data['delete_date'] = time();
$data['otrs_ticket'] = $this->request->getArgument('otrs');
$data['gitlab_ticket'] = $this->request->getArgument('gitlab');
$data['comment'] = $this->request->getArgument('comment');
......@@ -116,11 +116,15 @@ class GdprController extends ActionController
$this->createORTSTicket($data);
$this->deleteUser($data);
$this->deleteLdapUser($data);
$this->deleteLocalUser($data);
$this->createOldUser($data);
$this->addFlashMessage('The user was deleted successfully', 'LDAP deletion', AbstractMessage::OK);
$this->forward('step1');
}
/**
......@@ -169,32 +173,76 @@ class GdprController extends ActionController
protected function sendORTSMail(array $data)
{
$message = 'Dear data privacy officer,
we like to inform you, that this
LDAP User:' . $data['username'] . '
was delted.
The Server Team is informed, and will remove all further account data (wiki, forge, talk, ...).
OTRS Link of initial Ticket from data privacy officer:' . $data['otrs_ticket'] . '
Gitlab Link of typo3.org website team:' . $data['gitlab_ticket'] . '
further comment:' . $data['comment'] . '
LDAP User deletion was performed by:' . $GLOBALS['BE_USER']->name. '
Your TYPO3 website adminstration team
';
$mail = GeneralUtility::makeInstance(MailMessage::class);
$mail->from(new \Symfony\Component\Mime\Address('jconfirm-t3o-account@typo3.org', 'typo3.org administration'));
$mail->setSubject('User delection process');
$mail->setSubject('[Ticket#' . $data['otrs'] . '] User deletion notificaion : ' . $data['username']);
$mail->setFrom(array('confirm-t3o-account@typo3.org' => 'typo3.org administration'));
$mail->setTo(array('admin@typo3.org', 'admin@typo3.org' => 'TYPO3 Serverteam'));
$mail->setBody('Here is the message itself');
$mail->setTo(array('otrs@typo3.org', 'otrs@typo3.org' => 'TYPO3 OTRS Notification Master'));
$mail->setBody($message);
$mail->send();
}
protected function createORTSTicket(array $data)
{
$message ='Dear Server Team,
please please delete all account from this LDAP User:
Username ' . $data['username'] . '
Mail:' . $data['email'] . '
OTRS Link of initial Ticket from data privacy officer:' . $data['otrs_ticket'] . '
Gitlab Link of typo3.org website team:' . $data['gitlab_ticket'] . '
further comment:' . $data['comment'] . '
LDAP User deletion was performed by:' . $GLOBALS['BE_USER']->name . '
Your TYPO3 website adminstration team';
$mail = GeneralUtility::makeInstance(MailMessage::class);
$mail->from(new \Symfony\Component\Mime\Address('jconfirm-t3o-account@typo3.org', 'typo3.org administration'));
$mail->setSubject('User delection process');
$mail->setSubject('User delection process: ' . $data['username']);
$mail->setFrom(array('confirm-t3o-account@typo3.org' => 'typo3.org administration'));
$mail->setTo(array('admin@typo3.org', 'admin@typo3.org' => 'TYPO3 Serverteam'));
$mail->setBody('Here is the message itself');
$mail->setBody($message);
$mail->send();
}
protected function deleteUser(array $data)
protected function deleteLdapUser(array $data)
{
// delete my.typo3.org user
/** @var Ldap $ldap */
try {
$ldap = new Ldap();
} catch (\Exception $e) {
throw $e;
}
#$ldap->deleteUser($data['userName']);
return true;
}
// delete ldap user
protected function deleteLocalUser(array $data)
{
$dbConnection = GeneralUtility::makeInstance(ConnectionPool::class);
$dbConnection->getConnectionForTable('fe_users')->delete(
'fe_users',
array('username' => $data['username'])
);
}
}
......@@ -28,7 +28,7 @@
<li>A mail about the deletion will be send out the Server Team (admin@typo3.org), with the deletion request.</li>
<li>The information about the deletion will be logged in the "old user" tabel, with the comment, otrs ticket link, gitlab ticket and ID of the Backend User, who deleted the LDAP user</li>
</ul>
<f:form action="delete">
<f:form action="delete" arguments="{_all}">
<f:link.action class="btn btn-default" action="step2" arguments="{_all}">Back</f:link.action>
<f:form.submit class="btn btn-danger" title="confirm deletion" value="delete now">delete now</f:form.submit>
</f:form>
......
......@@ -18,29 +18,25 @@
<div class="form-group col-md-12">
<label for="gitlab">Gitlab issue:</label>
<div class="formengine-field-item t3js-formengine-field-item">
<f:form.textfield name="gitlab"></f:form.textfield>
<f:form.textfield name="gitlab"></f:form.textfield> (Please enter the plain ticket number after #)
</div>
</div>
</div>
<div class="row">
<div class="row">
<div class="form-group col-md-12">
<label for="otrs">OTRS Ticket data privacy officer:</label>
<div class="formengine-field-item t3js-formengine-field-item">
<f:form.textfield name="otrs"></f:form.textfield>
<f:form.textfield name="otrs"></f:form.textfield> (Please enter the plain ticket number after #)
</div>
</div>
</div>
</div>
<div class="row">
<div class="row">
<div class="form-group col-md-12">
<label for="comment">Comment:</label>
<div class="formengine-field-item t3js-formengine-field-item">
<f:form.textfield name="comment"></f:form.textfield>
<f:form.textarea cols="100" rows="8" name="comment"></f:form.textarea>
</div>
</div>
</div>
</div>
<f:link.action class="btn btn-default" action="step1">Abort</f:link.action>
<f:form.submit class="btn btn-warning" title="Continue to step 3" value="confirm deletion">Confirm</f:form.submit>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment