Skip to content

Commit

Permalink
Task #151 feat: Show hash(md5 string) of username & email data i… (#152)
Browse files Browse the repository at this point in the history
* Task #151210 feat: Show hash(md5 string) of username & email data in reports

* Task #151210 chore: Updated hashed column length

* Task #151210 chore: Resolved PHPCS issue

* Task #151210 chore: Resolved PHPCS issue
  • Loading branch information
vaibhavsTekdi authored and manojLondhe committed Sep 27, 2019
1 parent 555a103 commit 0fc793f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 37 deletions.
4 changes: 2 additions & 2 deletions tjreports/plugins/actionlog/tjreports/tjreports.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="3.9" type="plugin" group="actionlog" method="upgrade">
<name>plg_actionlog_tjreports</name>
<author>Techjoomla</author>
<creationDate>12th Jul 2019</creationDate>
<creationDate>26th Sep 2019</creationDate>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<version>1.1.1</version>
<version>1.1.2</version>
<description>PLG_ACTIONLOG_TJREPORTS_XML_DESCRIPTION</description>
<files>
<filename plugin="tjreports">tjreports.php</filename>
Expand Down
4 changes: 2 additions & 2 deletions tjreports/plugins/content/tjreportsfields/tjreportsfields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<creationDate>12th Jul 2019</creationDate>
<creationDate>26th Sep 2019</creationDate>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>1.1.1</version>
<version>1.1.2</version>

<files>
<filename plugin="tjreportsfields">tjreportsfields.php</filename>
Expand Down
4 changes: 2 additions & 2 deletions tjreports/plugins/privacy/tjreports/tjreports.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.4" type="plugin" group="privacy" method="upgrade">
<name>plg_privacy_tjreports</name>
<version>1.1.1</version>
<creationDate>12th Jul 2019</creationDate>
<version>1.1.2</version>
<creationDate>26th Sep 2019</creationDate>
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CREATE TABLE IF NOT EXISTS `#__tjreports_com_users_user` (
`record_id` int(11) NOT NULL
`record_id` int(11) NOT NULL,
`username_hash` VARCHAR(100) NOT NULL,
`email_hash` VARCHAR(100) NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `#__tjreports_com_users_user` ADD username_hash VARCHAR(100) NOT NULL AFTER record_id;
ALTER TABLE `#__tjreports_com_users_user` ADD email_hash VARCHAR(100) NOT NULL AFTER username_hash;
15 changes: 4 additions & 11 deletions tjreports/plugins/user/tjreportsindexer/tjreportsindexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ class PlgUserTjreportsindexer extends JPlugin
*/
public function onUserAfterSave($user, $isNew, $success, $msg)
{
/*
[com_fields] => Array
(
[job-position] => Developer
)*/

if (empty($user['com_fields']))
{
return;
}

// Delete existing user-data entry
// Here record_id = user_id
$this->deleteIndexerEntry($user['id']);
Expand Down Expand Up @@ -153,6 +142,10 @@ protected function addIndexerEntry($user)
$values[] = $db->quote($value);
}

// Add username & email hash values
array_push($columns, 'username_hash', 'email_hash');
array_push($values, "'" . md5($user['username']) . "'", "'" . md5($user['email']) . "'");

// Prepare the insert query
$query = $db->getQuery(true);
$query
Expand Down
4 changes: 2 additions & 2 deletions tjreports/plugins/user/tjreportsindexer/tjreportsindexer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<creationDate>12th Jul 2019</creationDate>
<creationDate>26th Sep 2019</creationDate>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>1.1.1</version>
<version>1.1.2</version>
<install>
<sql>
<file driver="mysql" charset="utf8">sql/tjreportsindexer.install.sql</file>
Expand Down
27 changes: 12 additions & 15 deletions tjreports/site/models/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ public function __construct($config = array())
}

// Get email column
$this->emailColumn = array_search(1, array_map(function ($ar) {return $ar['emailColumn'];}, $this->columns));
$this->emailColumn = array_search(
1, array_map(
function ($ar) {return $ar['emailColumn'];
}, $this->columns
)
);

$this->initData();

Expand Down Expand Up @@ -148,15 +153,8 @@ protected function setCustomFieldsColumns()
// Set columns from custom fields table into tjreports plugin's column list
foreach ($columnNames as $columnName)
{
// Skip primary key, record_id of indexed table
// As those are not part of custom fields
if (!isset($columnLabels[$columnName]))
{
continue;
}

$customField = array (
'title' => $columnLabels[$columnName],
'title' => ($columnLabels[$columnName]) ? $columnLabels[$columnName] : $columnName,
'table_column' => $this->customFieldsTableAlias . '.' . $columnName

// , 'disable_sorting' => true
Expand Down Expand Up @@ -372,7 +370,6 @@ private function initData()
$this->sortableColumns = array_values($this->sortableColumns);
$this->sortableWoQuery = array_values($this->sortableWoQuery);
$this->defaultColToShow = array_values($this->defaultColToShow);

}

/**
Expand Down Expand Up @@ -1085,7 +1082,7 @@ private function filterReportColumns($queryId, &$selColToshow)
// Process if user has saved query is for a plugin
if (!empty($parentId))
{
$this->processSavedReportColumns($parentId, $showhideCols, $paramColToshow, $selColToshow);
$this->processSavedReportColumns($parentId, $showhideCols, $paramColToshow, $selColToshow);
}

// If plugin has save any column assign that otherwise default plugin param will be applied
Expand Down Expand Up @@ -1117,10 +1114,10 @@ private function filterReportColumns($queryId, &$selColToshow)
/**
* Method to Process parent Report columns
*
* @param INT $queryId Query Id
* @param ARRAY &$showhideCols Show Hide columns
* @param ARRAY &$colToshow Columns to show
* @param ARRAY &$selColToshow Selected Cols
* @param INT $queryId Query Id
* @param ARRAY &$showhideCols Show Hide columns
* @param ARRAY &$colToshow Columns to show
* @param ARRAY &$selColToshow Selected Cols
*
* @return Void
*
Expand Down
4 changes: 2 additions & 2 deletions tjreports/tjreports.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<authorUrl>https://techjoomla.com</authorUrl>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<creationDate>12th Jul 2019</creationDate>
<version>1.1.1</version>
<creationDate>26th Sep 2019</creationDate>
<version>1.1.2</version>
<description>This component is used to access all the report at single place.</description>
<install>
<!-- Runs on install -->
Expand Down

0 comments on commit 0fc793f

Please sign in to comment.