Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move reset password to user management instead of auth #86

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions config/authorization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,3 @@ services:

Pimcore\Bundle\StudioBackendBundle\Authorization\Service\TokenServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Authorization\Service\TokenService

Pimcore\Bundle\StudioBackendBundle\Authorization\RateLimiter\RateLimiterInterface:
class: Pimcore\Bundle\StudioBackendBundle\Authorization\RateLimiter\RateLimiter

Pimcore\Bundle\StudioBackendBundle\Authorization\Service\UserServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Authorization\Service\UserService

Pimcore\Bundle\StudioBackendBundle\Authorization\Service\MailServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Authorization\Service\MailService
arguments: ['@Pimcore\Bundle\StudioBackendBundle\Setting\Provider\SystemSettingsProvider']
22 changes: 22 additions & 0 deletions config/users.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
Pimcore\Bundle\StudioBackendBundle\User\Controller\:
resource: '../src/User/Controller'
public: true
tags: [ 'controller.service_arguments' ]

Pimcore\Bundle\StudioBackendBundle\User\RateLimiter\RateLimiterInterface:
class: Pimcore\Bundle\StudioBackendBundle\User\RateLimiter\RateLimiter

Pimcore\Bundle\StudioBackendBundle\User\Service\UserServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\User\Service\UserService

Pimcore\Bundle\StudioBackendBundle\User\Service\MailServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\User\Service\MailService
arguments: [ '@Pimcore\Bundle\StudioBackendBundle\Setting\Provider\SystemSettingsProvider' ]
1 change: 1 addition & 0 deletions src/DependencyInjection/PimcoreStudioBackendExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function load(array $configs, ContainerBuilder $container): void
$loader->load('settings.yaml');
$loader->load('translation.yaml');
$loader->load('updater.yaml');
$loader->load('users.yaml');
$loader->load('versions.yaml');

$definition = $container->getDefinition(TokenServiceInterface::class);
Expand Down
6 changes: 6 additions & 0 deletions src/OpenApi/Config/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
name: Tags::Settings->name,
description: 'Get Settings'
)]
#[Tag(
name: Tags::User->value,
description: 'User Management operations'
)]
#[Tag(
name: Tags::Versions->name,
description: 'Versions operations to get/list/publish/delete and cleanup versions'
Expand All @@ -87,6 +91,8 @@ enum Tags: string
case Schedule = 'Schedule';
case Settings = 'Settings';
case Translation = 'Translation';

case User = 'User Management';
case Versions = 'Versions';
case Workflows = 'Workflows';
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\Attributes\Request;
namespace Pimcore\Bundle\StudioBackendBundle\User\Attributes\Request;

use Attribute;
use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\RequestBody;
use Pimcore\Bundle\StudioBackendBundle\Authorization\Schema\ResetPassword;
use Pimcore\Bundle\StudioBackendBundle\User\Schema\ResetPassword;

#[Attribute(Attribute::TARGET_METHOD)]
final class ResetPasswordRequestBody extends RequestBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\Controller;
namespace Pimcore\Bundle\StudioBackendBundle\User\Controller;

use OpenApi\Attributes\Post;
use Pimcore\Bundle\StudioBackendBundle\Authorization\Attributes\Request\ResetPasswordRequestBody;
use Pimcore\Bundle\StudioBackendBundle\Authorization\Schema\ResetPassword;
use Pimcore\Bundle\StudioBackendBundle\Authorization\Service\UserServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\Exception\DomainConfigurationException;
use Pimcore\Bundle\StudioBackendBundle\Exception\RateLimitException;
use Pimcore\Bundle\StudioBackendBundle\Exception\SendMailException;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\DefaultResponses;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\SuccessResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\User\Attributes\Request\ResetPasswordRequestBody;
use Pimcore\Bundle\StudioBackendBundle\User\Schema\ResetPassword;
use Pimcore\Bundle\StudioBackendBundle\User\Service\UserServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\HttpResponseCodes;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
Expand All @@ -48,12 +48,12 @@ public function __construct(
/**
* @throws RateLimitException|DomainConfigurationException|SendMailException
*/
#[Route('/reset-password', name: 'pimcore_studio_api_reset_password', methods: ['POST'])]
#[Route('/user/reset-password', name: 'pimcore_studio_api_user_reset_password', methods: ['POST'])]
#[Post(
path: self::API_PATH . '/reset-password',
operationId: 'rest-password',
path: self::API_PATH . '/user/reset-password',
operationId: 'reset-password',
summary: 'Sending username to reset password',
tags: [Tags::Authorization->name]
tags: [Tags::User->value]
)]
#[ResetPasswordRequestBody]
#[SuccessResponse]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\Event;
namespace Pimcore\Bundle\StudioBackendBundle\User\Event;

use Pimcore\Model\User;
use Symfony\Contracts\EventDispatcher\Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\RateLimiter;
namespace Pimcore\Bundle\StudioBackendBundle\User\RateLimiter;

use Pimcore\Bundle\StudioBackendBundle\Exception\RateLimitException;
use Pimcore\Bundle\StudioBackendBundle\Util\Traits\RequestTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\RateLimiter;
namespace Pimcore\Bundle\StudioBackendBundle\User\RateLimiter;

use Pimcore\Bundle\StudioBackendBundle\Exception\RateLimitException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\Schema;
namespace Pimcore\Bundle\StudioBackendBundle\User\Schema;

use OpenApi\Attributes\Property;
use OpenApi\Attributes\Schema;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\Service;
namespace Pimcore\Bundle\StudioBackendBundle\User\Service;

use Exception;
use Pimcore\Bundle\StaticResolverBundle\Lib\ToolResolverInterface;
use Pimcore\Bundle\StudioBackendBundle\Authorization\Event\LostPasswordEvent;
use Pimcore\Bundle\StudioBackendBundle\Exception\DomainConfigurationException;
use Pimcore\Bundle\StudioBackendBundle\Exception\SendMailException;
use Pimcore\Bundle\StudioBackendBundle\Setting\Provider\SettingsProviderInterface;
use Pimcore\Bundle\StudioBackendBundle\User\Event\LostPasswordEvent;
use Pimcore\Model\User;
use Pimcore\Model\UserInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\Service;
namespace Pimcore\Bundle\StudioBackendBundle\User\Service;

use Pimcore\Model\UserInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\Service;
namespace Pimcore\Bundle\StudioBackendBundle\User\Service;

use Pimcore\Bundle\StaticResolverBundle\Lib\Tools\Authentication\AuthenticationResolverInterface;
use Pimcore\Bundle\StaticResolverBundle\Models\User\UserResolverInterface;
use Pimcore\Bundle\StudioBackendBundle\Authorization\RateLimiter\RateLimiterInterface;
use Pimcore\Bundle\StudioBackendBundle\Authorization\Schema\ResetPassword;
use Pimcore\Bundle\StudioBackendBundle\Exception\DomainConfigurationException;
use Pimcore\Bundle\StudioBackendBundle\Exception\RateLimitException;
use Pimcore\Bundle\StudioBackendBundle\Exception\SendMailException;
use Pimcore\Bundle\StudioBackendBundle\User\RateLimiter\RateLimiterInterface;
use Pimcore\Bundle\StudioBackendBundle\User\Schema\ResetPassword;
use Pimcore\Model\UserInterface;
use Psr\Log\LoggerInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Authorization\Service;
namespace Pimcore\Bundle\StudioBackendBundle\User\Service;

use Pimcore\Bundle\StudioBackendBundle\Authorization\Schema\ResetPassword;
use Pimcore\Bundle\StudioBackendBundle\Exception\DomainConfigurationException;
use Pimcore\Bundle\StudioBackendBundle\Exception\RateLimitException;
use Pimcore\Bundle\StudioBackendBundle\Exception\SendMailException;
use Pimcore\Bundle\StudioBackendBundle\User\Schema\ResetPassword;

/**
* @internal
Expand Down
Loading