-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: TheVillageGuy <[email protected]>
- Loading branch information
1 parent
9b44612
commit c1aba40
Showing
49 changed files
with
932 additions
and
25 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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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,10 @@ | ||
# Manually Approving New Users | ||
|
||
If you want to manually approve users before they can log into your server, | ||
you can either tick the checkbox in the admin settings put this in the `.env` file: | ||
```dotenv | ||
MBIN_NEW_USERS_NEED_APPROVAL=true | ||
``` | ||
|
||
You will then see a new admin panel called `Applications` where new users will appear until you approve or deny them. | ||
When you have decided on one or the other, the user will get an email notification about it. |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20241104162655 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add application_text and application_status to the user table'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql('CREATE TYPE enumApplicationStatus AS ENUM (\'Approved\', \'Rejected\', \'Pending\')'); | ||
$this->addSql('ALTER TABLE "user" ADD application_text TEXT DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE "user" ADD application_status enumApplicationStatus DEFAULT \'Approved\' NOT NULL'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE "user" DROP application_text'); | ||
$this->addSql('ALTER TABLE "user" DROP application_status'); | ||
$this->addSql('DROP TYPE enumApplicationStatus'); | ||
} | ||
} |
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
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
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,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Controller\Admin; | ||
|
||
use App\Controller\AbstractController; | ||
use App\Entity\User; | ||
use App\Repository\UserRepository; | ||
use App\Service\UserManager; | ||
use Symfony\Bridge\Doctrine\Attribute\MapEntity; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpKernel\Attribute\MapQueryParameter; | ||
use Symfony\Component\Security\Http\Attribute\IsGranted; | ||
|
||
class AdminSignupRequestsController extends AbstractController | ||
{ | ||
public function __construct( | ||
private readonly UserRepository $repository, | ||
private readonly UserManager $userManager, | ||
) { | ||
} | ||
|
||
#[IsGranted('ROLE_ADMIN')] | ||
public function requests(#[MapQueryParameter] int $page): Response | ||
{ | ||
$requests = $this->repository->findAllSignupRequestsPaginated($page); | ||
|
||
return $this->render('admin/signup_requests.html.twig', [ | ||
'requests' => $requests, | ||
'page' => $page, | ||
]); | ||
} | ||
|
||
#[IsGranted('ROLE_ADMIN')] | ||
public function approve(#[MapQueryParameter] int $page, #[MapEntity(id: 'id')] User $user): Response | ||
{ | ||
$this->userManager->approveUserApplication($user); | ||
|
||
return $this->redirectToRoute('admin_signup_requests', ['page' => $page]); | ||
} | ||
|
||
#[IsGranted('ROLE_ADMIN')] | ||
public function reject(#[MapQueryParameter] int $page, #[MapEntity(id: 'id')] User $user): Response | ||
{ | ||
$this->userManager->rejectUserApplication($user); | ||
|
||
return $this->redirectToRoute('admin_signup_requests', ['page' => $page]); | ||
} | ||
} |
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
Oops, something went wrong.