Skip to content

Commit

Permalink
Initial Commit #540
Browse files Browse the repository at this point in the history
  • Loading branch information
oyeaussie committed Jul 7, 2024
1 parent 3b12f9f commit 9edc118
Show file tree
Hide file tree
Showing 56 changed files with 435 additions and 538 deletions.
32 changes: 16 additions & 16 deletions apps/Core/Components/Apps/AppsComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public function getFiltersAction()
{
$this->requestIsPost();

$filters = $this->apps->ipFilter->getFilters($this->postData());
$filters = $this->access->ipFilter->getFilters($this->postData());

foreach ($filters as $key => &$filter) {
unset ($filter['app_id']);
Expand Down Expand Up @@ -444,59 +444,59 @@ public function addFilterAction()
{
$this->requestIsPost();

$this->apps->ipFilter->addFilter($this->postData());
$this->access->ipFilter->addFilter($this->postData());

$this->addResponse(
$this->apps->ipFilter->packagesData->responseMessage,
$this->apps->ipFilter->packagesData->responseCode
$this->access->ipFilter->packagesData->responseMessage,
$this->access->ipFilter->packagesData->responseCode
);
}

public function removeFilterAction()
{
$this->requestIsPost();

$this->apps->ipFilter->removeFilter($this->postData());
$this->access->ipFilter->removeFilter($this->postData());

$this->addResponse(
$this->apps->ipFilter->packagesData->responseMessage,
$this->apps->ipFilter->packagesData->responseCode
$this->access->ipFilter->packagesData->responseMessage,
$this->access->ipFilter->packagesData->responseCode
);
}

public function allowFilterAction()
{
$this->requestIsPost();

$this->apps->ipFilter->allowFilter($this->postData());
$this->access->ipFilter->allowFilter($this->postData());

$this->addResponse(
$this->apps->ipFilter->packagesData->responseMessage,
$this->apps->ipFilter->packagesData->responseCode
$this->access->ipFilter->packagesData->responseMessage,
$this->access->ipFilter->packagesData->responseCode
);
}

public function blockFilterAction()
{
$this->requestIsPost();

$this->apps->ipFilter->blockFilter($this->postData());
$this->access->ipFilter->blockFilter($this->postData());

$this->addResponse(
$this->apps->ipFilter->packagesData->responseMessage,
$this->apps->ipFilter->packagesData->responseCode
$this->access->ipFilter->packagesData->responseMessage,
$this->access->ipFilter->packagesData->responseCode
);
}

public function resetAppFiltersAction()
{
$this->requestIsPost();

$this->apps->ipFilter->resetAppFilters($this->postData());
$this->access->ipFilter->resetAppFilters($this->postData());

$this->addResponse(
$this->apps->ipFilter->packagesData->responseMessage,
$this->apps->ipFilter->packagesData->responseCode
$this->access->ipFilter->packagesData->responseMessage,
$this->access->ipFilter->packagesData->responseCode
);
}

Expand Down
76 changes: 38 additions & 38 deletions apps/Core/Components/Auth/AuthComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function viewAction()

$domain = $this->domains->getDomain();

if ($this->auth->check()) {
if ($this->access->auth->check()) {
if (isset($domain['exclusive_to_default_app']) &&
$domain['exclusive_to_default_app'] == 1
) {
Expand All @@ -47,7 +47,7 @@ public function viewAction()
if (isset($this->getData()['pwreset']) && $this->getData()['pwreset'] === 'true') {
$this->view->coreSettings = $this->core->core['settings'];

$this->view->canUse2fa = $this->auth->canUse2fa();
$this->view->canUse2fa = $this->access->auth->canUse2fa();

$this->view->pick('auth/pwreset');

Expand Down Expand Up @@ -88,23 +88,23 @@ public function loginAction()
{
$this->requestIsPost();

$auth = $this->auth->attempt($this->postData());
$auth = $this->access->auth->attempt($this->postData());

if (isset($this->auth->packagesData->responseData)) {
$this->addResponse($this->auth->packagesData->responseMessage, $this->auth->packagesData->responseCode, $this->auth->packagesData->responseData);
if (isset($this->access->auth->packagesData->responseData)) {
$this->addResponse($this->access->auth->packagesData->responseMessage, $this->access->auth->packagesData->responseCode, $this->access->auth->packagesData->responseData);
} else {
$this->addResponse($this->auth->packagesData->responseMessage, $this->auth->packagesData->responseCode);
$this->addResponse($this->access->auth->packagesData->responseMessage, $this->access->auth->packagesData->responseCode);
}

if ($auth) {
$this->view->redirectUrl = $this->auth->packagesData->redirectUrl;
$this->view->redirectUrl = $this->access->auth->packagesData->redirectUrl;
}
}

public function logoutAction()
{
if ($this->auth->logout()) {
$this->view->redirectUrl = $this->auth->packagesData->redirectUrl;
if ($this->access->auth->logout()) {
$this->view->redirectUrl = $this->access->auth->packagesData->redirectUrl;

$this->addResponse('Ok');
}
Expand All @@ -114,60 +114,60 @@ public function forgotAction()
{
$this->requestIsPost();

$this->auth->forgotPassword($this->postData());
$this->access->auth->forgotPassword($this->postData());

$this->addResponse($this->auth->packagesData->responseMessage, $this->auth->packagesData->responseCode);
$this->addResponse($this->access->auth->packagesData->responseMessage, $this->access->auth->packagesData->responseCode);
}

public function pwresetAction()
{
$this->requestIsPost();

$this->auth->resetPassword($this->postData());
$this->access->auth->resetPassword($this->postData());

$this->view->responseMessage = $this->auth->packagesData->responseMessage;
$this->view->responseCode = $this->auth->packagesData->responseCode;
$this->view->responseMessage = $this->access->auth->packagesData->responseMessage;
$this->view->responseCode = $this->access->auth->packagesData->responseCode;

if (isset($this->auth->packagesData->redirectUrl)) {
$this->view->redirectUrl = $this->auth->packagesData->redirectUrl;
if (isset($this->access->auth->packagesData->redirectUrl)) {
$this->view->redirectUrl = $this->access->auth->packagesData->redirectUrl;
}
if (isset($this->auth->packagesData->responseData)) {
$this->view->responseData = $this->auth->packagesData->responseData;
if (isset($this->access->auth->packagesData->responseData)) {
$this->view->responseData = $this->access->auth->packagesData->responseData;
}
}

public function sendVerificationAction()
{
$this->requestIsPost();

$this->auth->sendVerificationEmail();
$this->access->auth->sendVerificationEmail();

if (isset($this->auth->packagesData->responseData)) {
$this->addResponse($this->auth->packagesData->responseMessage, $this->auth->packagesData->responseCode, $this->auth->packagesData->responseData);
if (isset($this->access->auth->packagesData->responseData)) {
$this->addResponse($this->access->auth->packagesData->responseMessage, $this->access->auth->packagesData->responseCode, $this->access->auth->packagesData->responseData);
} else {
$this->addResponse($this->auth->packagesData->responseMessage, $this->auth->packagesData->responseCode);
$this->addResponse($this->access->auth->packagesData->responseMessage, $this->access->auth->packagesData->responseCode);
}
}

public function verifyAction()
{
$this->requestIsPost();

$this->auth->verifyVerficationCode($this->postData());
$this->access->auth->verifyVerficationCode($this->postData());

$this->addResponse($this->auth->packagesData->responseMessage, $this->auth->packagesData->responseCode);
$this->addResponse($this->access->auth->packagesData->responseMessage, $this->access->auth->packagesData->responseCode);
}

public function sendTwoFaEmailAction()
{
$this->requestIsPost();

$this->auth->sendTwoFaEmail($this->postData());
$this->access->auth->sendTwoFaEmail($this->postData());

if (isset($this->auth->packagesData->responseData)) {
$this->addResponse($this->auth->packagesData->responseMessage, $this->auth->packagesData->responseCode, $this->auth->packagesData->responseData);
if (isset($this->access->auth->packagesData->responseData)) {
$this->addResponse($this->access->auth->packagesData->responseMessage, $this->access->auth->packagesData->responseCode, $this->access->auth->packagesData->responseData);
} else {
$this->addResponse($this->auth->packagesData->responseMessage, $this->auth->packagesData->responseCode);
$this->addResponse($this->access->auth->packagesData->responseMessage, $this->access->auth->packagesData->responseCode);
}
}

Expand Down Expand Up @@ -216,32 +216,32 @@ public function enableTwoFaOtpAction()
{
$this->requestIsPost();

if ($this->auth->enableTwoFaOtp($this->postData())) {
$this->view->provisionUrl = $this->auth->packagesData->provisionUrl;
if ($this->access->auth->enableTwoFaOtp($this->postData())) {
$this->view->provisionUrl = $this->access->auth->packagesData->provisionUrl;

$this->view->qrcode = $this->auth->packagesData->qrcode;
$this->view->qrcode = $this->access->auth->packagesData->qrcode;

$this->view->secret = $this->auth->packagesData->secret;
$this->view->secret = $this->access->auth->packagesData->secret;

$this->view->responseMessage = $this->auth->packagesData->responseMessage;
$this->view->responseMessage = $this->access->auth->packagesData->responseMessage;
} else {
$this->view->responseMessage = $this->auth->packagesData->responseMessage;
$this->view->responseMessage = $this->access->auth->packagesData->responseMessage;
}

$this->view->responseCode = $this->auth->packagesData->responseCode;
$this->view->responseCode = $this->access->auth->packagesData->responseCode;
}

public function verifyTwoFaOtpAction()
{
$this->requestIsPost();

if ($this->auth->verifyTwoFaOtp($this->postData())) {
if ($this->access->auth->verifyTwoFaOtp($this->postData())) {
$this->view->redirectUrl = $this->links->url('/');
}

$this->addResponse(
$this->auth->packagesData->responseMessage,
$this->auth->packagesData->responseCode
$this->access->auth->packagesData->responseMessage,
$this->access->auth->packagesData->responseCode
);
}
}
2 changes: 1 addition & 1 deletion apps/Core/Components/Register/RegisterComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function viewAction()
return;
}

if ($this->auth->hasUserInSession() || $this->auth->hasRecaller()) {
if ($this->access->auth->hasUserInSession() || $this->access->auth->hasRecaller()) {
return $this->response->redirect('/' . strtolower($this->app['route']));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ function ($dataArr) {
]
];

if ($this->auth->account()['security']['role_id'] != '1') {
if ($this->access->auth->account()['security']['role_id'] != '1') {
$conditions =
[
'conditions' =>
'-|account_id|equals|' . $this->auth->account()['id'] . '&',
'-|account_id|equals|' . $this->access->auth->account()['id'] . '&',
'order' => 'id desc'
];
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function searchAccountAction()
$searchAccounts = $this->accounts->searchAccountInternal($searchQuery);

if ($searchAccounts) {
$currentAccount = $this->auth->account();
$currentAccount = $this->access->auth->account();

if ($currentAccount) {
$accounts = $this->accounts->packagesData->accounts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function viewAction()
$conditions =
[
'conditions' =>
'-|app_id|equals|' . $this->apps->getAppInfo()['id'] . '&and|account_id|equals|' . $this->auth->account()['id'] . '&and|read|equals|0&and|archive|equals|0&',
'-|app_id|equals|' . $this->apps->getAppInfo()['id'] . '&and|account_id|equals|' . $this->access->auth->account()['id'] . '&and|read|equals|0&and|archive|equals|0&',
'order' => 'id desc'
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public function getPackageFieldsAction($componentId = null)
$fields = null;
}

$account = $this->auth->account();
$account = $this->access->auth->account();

if ($account) {
$filters = $this->basepackages->filters->getFiltersForAccountAndComponent($account, $componentId);
Expand Down
42 changes: 21 additions & 21 deletions apps/Core/Components/System/Users/Profile/ProfileComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function viewAction()
if (isset($this->getData()['aid'])) {
$profile = $this->profiles->generateViewData($this->getData()['aid']);
} else {
if (!$this->auth->account()) {
if (!$this->access->auth->account()) {
return;
}

Expand Down Expand Up @@ -94,61 +94,61 @@ public function pwresetAction()
{
$this->requestIsPost();

$user['user'] = $this->auth->account()['email'];
$user['user'] = $this->access->auth->account()['email'];

$user = array_merge($user, $this->postData());

$this->auth->resetPassword($user, true);
$this->access->auth->resetPassword($user, true);

$this->view->responseMessage = $this->auth->packagesData->responseMessage;
$this->view->responseCode = $this->auth->packagesData->responseCode;
$this->view->responseMessage = $this->access->auth->packagesData->responseMessage;
$this->view->responseCode = $this->access->auth->packagesData->responseCode;

if (isset($this->auth->packagesData->redirectUrl)) {
$this->view->redirectUrl = $this->auth->packagesData->redirectUrl;
if (isset($this->access->auth->packagesData->redirectUrl)) {
$this->view->redirectUrl = $this->access->auth->packagesData->redirectUrl;
}
if (isset($this->auth->packagesData->responseData)) {
$this->view->responseData = $this->auth->packagesData->responseData;
if (isset($this->access->auth->packagesData->responseData)) {
$this->view->responseData = $this->access->auth->packagesData->responseData;
}
}

public function enableTwoFaOtpAction()
{
$this->requestIsPost();

if ($this->auth->enableTwoFaOtp()) {
$this->view->provisionUrl = $this->auth->packagesData->provisionUrl;
if ($this->access->auth->enableTwoFaOtp()) {
$this->view->provisionUrl = $this->access->auth->packagesData->provisionUrl;

$this->view->qrcode = $this->auth->packagesData->qrcode;
$this->view->qrcode = $this->access->auth->packagesData->qrcode;

$this->view->secret = $this->auth->packagesData->secret;
$this->view->secret = $this->access->auth->packagesData->secret;
} else {
$this->view->responseMessage = $this->auth->packagesData->responseMessage;
$this->view->responseMessage = $this->access->auth->packagesData->responseMessage;
}

$this->view->responseCode = $this->auth->packagesData->responseCode;
$this->view->responseCode = $this->access->auth->packagesData->responseCode;
}

public function verifyTwoFaOtpAction()
{
$this->requestIsPost();

$this->auth->verifyTwoFaOtp($this->postData());
$this->access->auth->verifyTwoFaOtp($this->postData());

$this->addResponse(
$this->auth->packagesData->responseMessage,
$this->auth->packagesData->responseCode
$this->access->auth->packagesData->responseMessage,
$this->access->auth->packagesData->responseCode
);
}

public function disableTwoFaOtpAction()
{
$this->requestIsPost();

$this->auth->disableTwoFaOtp($this->postData()['code']);
$this->access->auth->disableTwoFaOtp($this->postData()['code']);

$this->addResponse(
$this->auth->packagesData->responseMessage,
$this->auth->packagesData->responseCode
$this->access->auth->packagesData->responseMessage,
$this->access->auth->packagesData->responseCode
);
}

Expand Down
Loading

0 comments on commit 9edc118

Please sign in to comment.