-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6a3528
commit 7a9fdc7
Showing
97 changed files
with
11,563 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* KiwiCommerce | ||
* | ||
* Do not edit or add to this file if you wish to upgrade to newer versions in the future. | ||
* If you wish to customize this module for your needs. | ||
* Please contact us https://kiwicommerce.co.uk/contacts. | ||
* | ||
* @category KiwiCommerce | ||
* @package KiwiCommerce_AdminActivity | ||
* @copyright Copyright (C) 2018 Kiwi Commerce Ltd (https://kiwicommerce.co.uk/) | ||
* @license https://kiwicommerce.co.uk/magento2-extension-license/ | ||
*/ | ||
namespace KiwiCommerce\AdminActivity\Api\Activity; | ||
|
||
/** | ||
* Interface ModelInterface | ||
* @package KiwiCommerce\AdminActivity\Api\Activity | ||
*/ | ||
interface ModelInterface | ||
{ | ||
/** | ||
* Get old data | ||
* @param $model | ||
* @return mixed | ||
*/ | ||
public function getOldData($model); | ||
|
||
/** | ||
* Get edit data | ||
* @param $model | ||
* @return mixed | ||
*/ | ||
public function getEditData($model, $fieldArray); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
/** | ||
* KiwiCommerce | ||
* | ||
* Do not edit or add to this file if you wish to upgrade to newer versions in the future. | ||
* If you wish to customize this module for your needs. | ||
* Please contact us https://kiwicommerce.co.uk/contacts. | ||
* | ||
* @category KiwiCommerce | ||
* @package KiwiCommerce_AdminActivity | ||
* @copyright Copyright (C) 2018 Kiwi Commerce Ltd (https://kiwicommerce.co.uk/) | ||
* @license https://kiwicommerce.co.uk/magento2-extension-license/ | ||
*/ | ||
namespace KiwiCommerce\AdminActivity\Api; | ||
|
||
/** | ||
* Interface ActivityRepositoryInterface | ||
* @package KiwiCommerce\AdminActivity\Api | ||
*/ | ||
interface ActivityRepositoryInterface | ||
{ | ||
/** | ||
* Array of protected fields | ||
* @return mixed | ||
*/ | ||
public function protectedFields(); | ||
|
||
/** | ||
* Get collection of admin activity | ||
* @return mixed | ||
*/ | ||
public function getList(); | ||
|
||
/** | ||
* Get all admin activity data before date | ||
* @param $endDate | ||
* @return mixed | ||
*/ | ||
public function getListBeforeDate($endDate); | ||
|
||
/** | ||
* Remove activity log entry | ||
* @param $activityId | ||
* @return mixed | ||
*/ | ||
public function deleteActivityById($activityId); | ||
|
||
/** | ||
* Get all admin activity detail by activity id | ||
* @param $activityId | ||
* @return mixed | ||
*/ | ||
public function getActivityDetail($activityId); | ||
|
||
/** | ||
* Get all admin activity log by activity id | ||
* @param $activityId | ||
* @return mixed | ||
*/ | ||
public function getActivityLog($activityId); | ||
|
||
/** | ||
* Revert last changes made in module | ||
* @param $activity | ||
* @return mixed | ||
*/ | ||
public function revertActivity($activity); | ||
|
||
/** | ||
* Get old data for system config module | ||
* @param $model | ||
* @return mixed | ||
*/ | ||
public function getOldData($model); | ||
|
||
/** | ||
* Get admin activity by id | ||
* @param $activityId | ||
* @return mixed | ||
*/ | ||
public function getActivityById($activityId); | ||
|
||
/** | ||
* Check field is protected or not | ||
* @param $fieldName | ||
* @return mixed | ||
*/ | ||
public function isFieldProtected($fieldName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* KiwiCommerce | ||
* | ||
* Do not edit or add to this file if you wish to upgrade to newer versions in the future. | ||
* If you wish to customize this module for your needs. | ||
* Please contact us https://kiwicommerce.co.uk/contacts. | ||
* | ||
* @category KiwiCommerce | ||
* @package KiwiCommerce_AdminActivity | ||
* @copyright Copyright (C) 2018 Kiwi Commerce Ltd (https://kiwicommerce.co.uk/) | ||
* @license https://kiwicommerce.co.uk/magento2-extension-license/ | ||
*/ | ||
namespace KiwiCommerce\AdminActivity\Api\Data; | ||
|
||
/** | ||
* Interface ActivityInterface | ||
* @package KiwiCommerce\AdminActivity\Api\Data | ||
*/ | ||
interface ActivityInterface | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* KiwiCommerce | ||
* | ||
* Do not edit or add to this file if you wish to upgrade to newer versions in the future. | ||
* If you wish to customize this module for your needs. | ||
* Please contact us https://kiwicommerce.co.uk/contacts. | ||
* | ||
* @category KiwiCommerce | ||
* @package KiwiCommerce_AdminActivity | ||
* @copyright Copyright (C) 2018 Kiwi Commerce Ltd (https://kiwicommerce.co.uk/) | ||
* @license https://kiwicommerce.co.uk/magento2-extension-license/ | ||
*/ | ||
namespace KiwiCommerce\AdminActivity\Api\Data; | ||
|
||
/** | ||
* Interface LogSearchResultsInterface | ||
* @package KiwiCommerce\EnhancedSMTP\Api\Data | ||
*/ | ||
interface ActivitySearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface | ||
{ | ||
/** | ||
* Get admin activity list. | ||
* @api | ||
* @return \KiwiCommerce\AdminActivity\Model\Activity[] | ||
*/ | ||
public function getItems(); | ||
|
||
/** | ||
* Set admin activity list. | ||
* @api | ||
* @param \KiwiCommerce\AdminActivity\Model\Activity[] $items | ||
* @return $this | ||
*/ | ||
public function setItems(array $items); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* KiwiCommerce | ||
* | ||
* Do not edit or add to this file if you wish to upgrade to newer versions in the future. | ||
* If you wish to customize this module for your needs. | ||
* Please contact us https://kiwicommerce.co.uk/contacts. | ||
* | ||
* @category KiwiCommerce | ||
* @package KiwiCommerce_AdminActivity | ||
* @copyright Copyright (C) 2018 Kiwi Commerce Ltd (https://kiwicommerce.co.uk/) | ||
* @license https://kiwicommerce.co.uk/magento2-extension-license/ | ||
*/ | ||
namespace KiwiCommerce\AdminActivity\Api; | ||
|
||
/** | ||
* Interface LoginRepositoryInterface | ||
* @package KiwiCommerce\AdminActivity\Api | ||
*/ | ||
interface LoginRepositoryInterface | ||
{ | ||
/** | ||
* Set login data | ||
* @param $status | ||
* @param $type | ||
* @return mixed | ||
*/ | ||
public function addLog($status, $type); | ||
|
||
/** | ||
* Get all admin activity data before date | ||
* @param $endDate | ||
* @return mixed | ||
*/ | ||
public function getListBeforeDate($endDate); | ||
|
||
/** | ||
* Set login user | ||
* @param $user | ||
* @return mixed | ||
*/ | ||
public function setUser($user); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
/** | ||
* KiwiCommerce | ||
* | ||
* Do not edit or add to this file if you wish to upgrade to newer versions in the future. | ||
* If you wish to customize this module for your needs. | ||
* Please contact us https://kiwicommerce.co.uk/contacts. | ||
* | ||
* @category KiwiCommerce | ||
* @package KiwiCommerce_AdminActivity | ||
* @copyright Copyright (C) 2018 Kiwi Commerce Ltd (https://kiwicommerce.co.uk/) | ||
* @license https://kiwicommerce.co.uk/magento2-extension-license/ | ||
*/ | ||
namespace KiwiCommerce\AdminActivity\Block\Adminhtml; | ||
|
||
use Magento\Backend\Block\Template; | ||
use KiwiCommerce\AdminActivity\Api\ActivityRepositoryInterface; | ||
use KiwiCommerce\AdminActivity\Helper\Browser; | ||
|
||
/** | ||
* Class ActivityLogListing | ||
* @package KiwiCommerce\AdminActivity\Block\Adminhtml | ||
*/ | ||
class ActivityLogListing extends Template | ||
{ | ||
/** | ||
* @var ActivityRepositoryInterface | ||
*/ | ||
public $activityRepository; | ||
|
||
/** | ||
* @var Browser | ||
*/ | ||
public $browser; | ||
|
||
/** | ||
* Path to template file in theme. | ||
* @var string | ||
*/ | ||
public $_template = 'KiwiCommerce_AdminActivity::log_listing.phtml'; | ||
|
||
/** | ||
* ActivityLogListing constructor. | ||
* @param Template\Context $context | ||
* @param ActivityRepositoryInterface $activityRepository | ||
* @param Browser $browser | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Template\Context $context, | ||
ActivityRepositoryInterface $activityRepository, | ||
Browser $browser | ||
) { | ||
$this->activityRepository = $activityRepository; | ||
$this->browser = $browser; | ||
parent::__construct($context); | ||
} | ||
|
||
/** | ||
* Get admin activity log listing | ||
* @return array | ||
*/ | ||
public function getLogListing() | ||
{ | ||
$id = $this->getRequest()->getParam('id'); | ||
$data = $this->activityRepository->getActivityLog($id); | ||
return $data->getData(); | ||
} | ||
|
||
/** | ||
* Get admin activity details | ||
* @return array | ||
*/ | ||
public function getAdminDetails() | ||
{ | ||
$id = $this->getRequest()->getParam('id'); | ||
$activity = $this->activityRepository->getActivityById($id); | ||
|
||
$this->browser->reset(); | ||
$this->browser->setUserAgent($activity->getUserAgent()); | ||
$browser = $this->browser->__toString(); | ||
|
||
$logData = []; | ||
$logData['username'] = $activity->getUsername(); | ||
$logData['module'] = $activity->getModule(); | ||
$logData['name'] = $activity->getName(); | ||
$logData['fullaction'] = $activity->getFullaction(); | ||
$logData['browser'] = $browser; | ||
$logData['date'] = $activity->getUpdatedAt(); | ||
return $logData; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* KiwiCommerce | ||
* | ||
* Do not edit or add to this file if you wish to upgrade to newer versions in the future. | ||
* If you wish to customize this module for your needs. | ||
* Please contact us https://kiwicommerce.co.uk/contacts. | ||
* | ||
* @category KiwiCommerce | ||
* @package KiwiCommerce_AdminActivity | ||
* @copyright Copyright (C) 2018 Kiwi Commerce Ltd (https://kiwicommerce.co.uk/) | ||
* @license https://kiwicommerce.co.uk/magento2-extension-license/ | ||
*/ | ||
namespace KiwiCommerce\AdminActivity\Block\Adminhtml; | ||
|
||
/** | ||
* Class Selector | ||
* @package KiwiCommerce\AdminActivity\Block\Adminhtml | ||
*/ | ||
class Selector extends \Magento\Backend\Block\Template | ||
{ | ||
/** | ||
* Revert Activity Log action URL | ||
* @return string | ||
*/ | ||
public function getRevertUrl() | ||
{ | ||
return $this->getUrl('adminactivity/activity/revert'); | ||
} | ||
} |
Oops, something went wrong.