Skip to content

Commit

Permalink
Component rename
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix128 committed Aug 26, 2019
1 parent 0efa157 commit bd39c42
Show file tree
Hide file tree
Showing 29 changed files with 64 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Block/Adminhtml/Form/Field/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Block\Adminhtml\Form\Field;
namespace MSP\BackendGoogleSignOn\Block\Adminhtml\Form\Field;

use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
use Magento\Framework\DataObject;
Expand Down
2 changes: 1 addition & 1 deletion Block/Adminhtml/Form/Field/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Block\Adminhtml\Form\Field;
namespace MSP\BackendGoogleSignOn\Block\Adminhtml\Form\Field;

use Magento\Authorization\Model\ResourceModel\Role;
use Magento\Authorization\Model\ResourceModel\Role\CollectionFactory;
Expand Down
4 changes: 2 additions & 2 deletions Model/AuthenticateByEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model;
namespace MSP\BackendGoogleSignOn\Model;

use Magento\Backend\Model\Auth\Session;
use Magento\Framework\Event\ManagerInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Security\Model\AdminSessionsManager;
use Magento\User\Model\User;
use MSP\GoogleSignOn\Model\ResourceModel\GetUsernameByEmail;
use MSP\BackendGoogleSignOn\Model\ResourceModel\GetUsernameByEmail;

class AuthenticateByEmail
{
Expand Down
4 changes: 2 additions & 2 deletions Model/CreateUserFromGoogleUserInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model;
namespace MSP\BackendGoogleSignOn\Model;

use Google_Service_Oauth2_Userinfoplus;
use Magento\Framework\Exception\AlreadyExistsException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\User\Model\ResourceModel\User as UserResource;
use Magento\User\Model\UserFactory;
use MSP\GoogleSignOn\Model\ResourceModel\GetUsernameByEmail;
use MSP\BackendGoogleSignOn\Model\ResourceModel\GetUsernameByEmail;

class CreateUserFromGoogleUserInfo
{
Expand Down
2 changes: 1 addition & 1 deletion Model/GetApplicationName.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model;
namespace MSP\BackendGoogleSignOn\Model;

use Magento\Store\Model\StoreManagerInterface;

Expand Down
4 changes: 2 additions & 2 deletions Model/GetDomainRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model;
namespace MSP\BackendGoogleSignOn\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Serialize\SerializerInterface;
Expand All @@ -19,7 +19,7 @@ class GetDomainRule
/**
* XML PATH to domain rules configuration
*/
private const XML_PATH_DOMAIN_RULES = 'msp_google_sign_on/advanced/domain_rules';
private const XML_PATH_DOMAIN_RULES = 'msp_backend_google_sign_on/advanced/domain_rules';

/**
* @var ScopeConfigInterface
Expand Down
6 changes: 3 additions & 3 deletions Model/GetGoogleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model;
namespace MSP\BackendGoogleSignOn\Model;

use Google_Client;
use Magento\Backend\Model\UrlInterface;
Expand All @@ -17,12 +17,12 @@ class GetGoogleClient
/**
* Client ID XML path
*/
private const XML_PATH_CLIENT_ID = 'msp_google_sign_on/general/client_id';
private const XML_PATH_CLIENT_ID = 'msp_backend_google_sign_on/general/client_id';

/**
* Client secret XML path
*/
private const XML_PATH_CLIENT_SECRET = 'msp_google_sign_on/general/client_secret';
private const XML_PATH_CLIENT_SECRET = 'msp_backend_google_sign_on/general/client_secret';

/**
* @var GoogleClientFactory
Expand Down
2 changes: 1 addition & 1 deletion Model/GetGoogleUserInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model;
namespace MSP\BackendGoogleSignOn\Model;

use Google_Service_Oauth2_Userinfoplus;
use Magento\Framework\Exception\LocalizedException;
Expand Down
2 changes: 1 addition & 1 deletion Model/GoogleClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model;
namespace MSP\BackendGoogleSignOn\Model;

use Google_Client;

Expand Down
2 changes: 1 addition & 1 deletion Model/GoogleServiceOauthFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model;
namespace MSP\BackendGoogleSignOn\Model;

use Google_Client;
use Google_Service_Oauth2;
Expand Down
4 changes: 2 additions & 2 deletions Model/IsEnabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model;
namespace MSP\BackendGoogleSignOn\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;

Expand All @@ -15,7 +15,7 @@ class IsEnabled
/**
* XML path to enabled flag
*/
private const XML_PATH_ENABLED = 'msp_google_sign_on/general/enabled';
private const XML_PATH_ENABLED = 'msp_backend_google_sign_on/general/enabled';

/**
* @var ScopeConfigInterface
Expand Down
2 changes: 1 addition & 1 deletion Model/ResourceModel/GetUserIdByUsername.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model\ResourceModel;
namespace MSP\BackendGoogleSignOn\Model\ResourceModel;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Exception\NoSuchEntityException;
Expand Down
2 changes: 1 addition & 1 deletion Model/ResourceModel/GetUsernameByEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model\ResourceModel;
namespace MSP\BackendGoogleSignOn\Model\ResourceModel;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Exception\NoSuchEntityException;
Expand Down
2 changes: 1 addition & 1 deletion Model/System/Config/Backend/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Model\System\Config\Backend;
namespace MSP\BackendGoogleSignOn\Model\System\Config\Backend;

use Magento\Framework\App\Cache\TypeListInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
Expand Down
10 changes: 5 additions & 5 deletions Plugin/AuthenticateWithGoogle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Plugin;
namespace MSP\BackendGoogleSignOn\Plugin;

use Exception;
use Magento\Backend\Controller\Adminhtml\Auth\Login;
use Magento\Backend\Model\Auth\Session;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Event\ManagerInterface;
use MSP\GoogleSignOn\Model\AuthenticateByEmail;
use MSP\GoogleSignOn\Model\CreateUserFromGoogleUserInfo;
use MSP\GoogleSignOn\Model\GetGoogleUserInfo;
use MSP\GoogleSignOn\Model\IsEnabled;
use MSP\BackendGoogleSignOn\Model\AuthenticateByEmail;
use MSP\BackendGoogleSignOn\Model\CreateUserFromGoogleUserInfo;
use MSP\BackendGoogleSignOn\Model\GetGoogleUserInfo;
use MSP\BackendGoogleSignOn\Model\IsEnabled;

class AuthenticateWithGoogle
{
Expand Down
6 changes: 3 additions & 3 deletions Plugin/DenyLoginByDomainRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Plugin;
namespace MSP\BackendGoogleSignOn\Plugin;

use Magento\Framework\Exception\LocalizedException;
use Magento\User\Model\User;
use MSP\GoogleSignOn\Model\GetDomainRule;
use MSP\GoogleSignOn\Model\IsEnabled;
use MSP\BackendGoogleSignOn\Model\GetDomainRule;
use MSP\BackendGoogleSignOn\Model\IsEnabled;

class DenyLoginByDomainRule
{
Expand Down
12 changes: 6 additions & 6 deletions Test/Integration/CreateUserFromGoogleUserInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Test\Integration;
namespace MSP\BackendGoogleSignOn\Test\Integration;

use Google_Service_Oauth2_Userinfoplus;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\User\Model\User;
use MSP\GoogleSignOn\Model\CreateUserFromGoogleUserInfo;
use MSP\GoogleSignOn\Model\ResourceModel\GetUsernameByEmail;
use MSP\BackendGoogleSignOn\Model\CreateUserFromGoogleUserInfo;
use MSP\BackendGoogleSignOn\Model\ResourceModel\GetUsernameByEmail;
use PHPUnit\Framework\TestCase;
use Magento\TestFramework\Helper\Bootstrap;

Expand Down Expand Up @@ -62,7 +62,7 @@ private function getUserByEmail(string $email): ?User
}

/**
* @magentoAdminConfigFixture msp_google_sign_on/advanced/domain_rules {"1":{"domain":"mydomain.com","rule":"force"}, "2":{"domain":"mydomain2.com","rule":"force"}, "3":{"domain":"mydomain3.com","rule":"1"}}
* @magentoAdminConfigFixture msp_backend_google_sign_on/advanced/domain_rules {"1":{"domain":"mydomain.com","rule":"force"}, "2":{"domain":"mydomain2.com","rule":"force"}, "3":{"domain":"mydomain3.com","rule":"1"}}
*/
public function testShouldCreateNewUser(): void
{
Expand All @@ -83,7 +83,7 @@ public function testShouldCreateNewUser(): void
}

/**
* @magentoAdminConfigFixture msp_google_sign_on/advanced/domain_rules {"1":{"domain":"mydomain.com","rule":"force"}, "2":{"domain":"mydomain2.com","rule":"force"}, "3":{"domain":"mydomain3.com","rule":"1"}}
* @magentoAdminConfigFixture msp_backend_google_sign_on/advanced/domain_rules {"1":{"domain":"mydomain.com","rule":"force"}, "2":{"domain":"mydomain2.com","rule":"force"}, "3":{"domain":"mydomain3.com","rule":"1"}}
*/
public function testShouldNotCreateNewUserWithADomainRule(): void
{
Expand All @@ -100,7 +100,7 @@ public function testShouldNotCreateNewUserWithADomainRule(): void
}

/**
* @magentoAdminConfigFixture msp_google_sign_on/advanced/domain_rules {"1":{"domain":"mydomain.com","rule":"force"}, "2":{"domain":"mydomain2.com","rule":"force"}, "3":{"domain":"mydomain3.com","rule":"1"}}
* @magentoAdminConfigFixture msp_backend_google_sign_on/advanced/domain_rules {"1":{"domain":"mydomain.com","rule":"force"}, "2":{"domain":"mydomain2.com","rule":"force"}, "3":{"domain":"mydomain3.com","rule":"1"}}
*/
public function testShouldNotCreateNewUserWithoutADomainRule(): void
{
Expand Down
6 changes: 3 additions & 3 deletions Test/Integration/GetDomainRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Test\Integration;
namespace MSP\BackendGoogleSignOn\Test\Integration;

use MSP\GoogleSignOn\Model\GetDomainRule;
use MSP\BackendGoogleSignOn\Model\GetDomainRule;
use PHPUnit\Framework\TestCase;
use Magento\TestFramework\Helper\Bootstrap;

Expand Down Expand Up @@ -47,7 +47,7 @@ public function getDomainRuleDataProvider(): array
* @param string $emailOrDomain
* @param string|null $rule
* @dataProvider getDomainRuleDataProvider
* @magentoAdminConfigFixture msp_google_sign_on/advanced/domain_rules {"1":{"domain":"mydomain.com","rule":"force"}, "2":{"domain":"mydomain2.com","rule":"force"}, "3":{"domain":"mydomain3.com","rule":"1"}}
* @magentoAdminConfigFixture msp_backend_google_sign_on/advanced/domain_rules {"1":{"domain":"mydomain.com","rule":"force"}, "2":{"domain":"mydomain2.com","rule":"force"}, "3":{"domain":"mydomain3.com","rule":"1"}}
*/
public function testShouldGetDomainRule(string $emailOrDomain, ?string $rule): void
{
Expand Down
4 changes: 2 additions & 2 deletions Test/Integration/GetUsernameByEmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\Test\Integration;
namespace MSP\BackendGoogleSignOn\Test\Integration;

use Magento\Framework\Exception\NoSuchEntityException;
use MSP\GoogleSignOn\Model\ResourceModel\GetUsernameByEmail;
use MSP\BackendGoogleSignOn\Model\ResourceModel\GetUsernameByEmail;
use PHPUnit\Framework\TestCase;
use Magento\TestFramework\Helper\Bootstrap;

Expand Down
4 changes: 2 additions & 2 deletions ViewModel/GoogleSignOn.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

declare(strict_types=1);

namespace MSP\GoogleSignOn\ViewModel;
namespace MSP\BackendGoogleSignOn\ViewModel;

use Magento\Framework\View\Element\Block\ArgumentInterface;
use MSP\GoogleSignOn\Model\GetGoogleClient;
use MSP\BackendGoogleSignOn\Model\GetGoogleClient;

class GoogleSignOn implements ArgumentInterface
{
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "msp/module-backend-sign-on",
"description": "Google Sign On libraries for Magento 2",
"name": "msp/module-backend-google-sign-on",
"description": "Backend Google Sign On for Magento 2",
"require": {
"php": "~7.2.0 || ~7.3.0",
"magento/magento2-base": "^2.3",
"magento/module-backend": "*",
"magento/module-user": "*",
"google/client": "^2.2.0"
"google/apiclient": "^2.2.0"
},
"support": {
"issues": "https://github.com/magespecialist/m2-GoogleSignOn/issues"
Expand Down Expand Up @@ -35,7 +35,7 @@
"registration.php"
],
"psr-4": {
"MSP\\GoogleSignOn\\": ""
"MSP\\BackendGoogleSignOn\\": ""
}
}
}
2 changes: 1 addition & 1 deletion etc/acl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource
id="MSP_GoogleSignOn::config"
id="MSP_BackendGoogleSignOn::config"
title="MSP Google Backend Sign On"
translate="title"
sortOrder="40" />
Expand Down
8 changes: 4 additions & 4 deletions etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="Magento\Backend\Controller\Adminhtml\Auth\Login">
<plugin sortOrder="1" name="msp_google_sign_on_authenticate_with_google"
type="MSP\GoogleSignOn\Plugin\AuthenticateWithGoogle"/>
<plugin sortOrder="1" name="msp_backend_google_sign_on_authenticate_with_google"
type="MSP\BackendGoogleSignOn\Plugin\AuthenticateWithGoogle"/>
</type>
<type name="Magento\User\Model\User">
<plugin sortOrder="1" name="msp_google_sign_on_deny_login_by_domain_rule"
type="MSP\GoogleSignOn\Plugin\DenyLoginByDomainRule"/>
<plugin sortOrder="1" name="msp_backend_google_sign_on_deny_login_by_domain_rule"
type="MSP\BackendGoogleSignOn\Plugin\DenyLoginByDomainRule"/>
</type>
</config>
8 changes: 4 additions & 4 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">

<system>
<section id="msp_google_sign_on" translate="label" type="text" sortOrder="10" showInDefault="1"
<section id="msp_backend_google_sign_on" translate="label" type="text" sortOrder="10" showInDefault="1"
showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>Google Backend Sign On</label>
<tab>security</tab>
<resource>MSP_GoogleSignOn::config</resource>
<resource>MSP_BackendGoogleSignOn::config</resource>

<group id="general" translate="label" type="text" sortOrder="600" showInDefault="1" showInWebsite="0"
showInStore="0">
Expand Down Expand Up @@ -45,8 +45,8 @@
<field id="domain_rules" translate="label" sortOrder="20" showInDefault="1" showInWebsite="0"
showInStore="0" canRestore="1">
<label>Domain based rules</label>
<frontend_model>MSP\GoogleSignOn\Block\Adminhtml\Form\Field\Domain</frontend_model>
<backend_model>MSP\GoogleSignOn\Model\System\Config\Backend\Domain</backend_model>
<frontend_model>MSP\BackendGoogleSignOn\Block\Adminhtml\Form\Field\Domain</frontend_model>
<backend_model>MSP\BackendGoogleSignOn\Model\System\Config\Backend\Domain</backend_model>
</field>
</group>
</section>
Expand Down
4 changes: 2 additions & 2 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<msp_google_sign_on>
<msp_backend_google_sign_on>
<general>
<enabled>1</enabled>
<client_id></client_id>
Expand All @@ -17,6 +17,6 @@
<advanced>

</advanced>
</msp_google_sign_on>
</msp_backend_google_sign_on>
</default>
</config>
Loading

0 comments on commit bd39c42

Please sign in to comment.