Skip to content

Commit

Permalink
[SCOUT] Hide approve member applications behind flag for contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Gwildor committed May 21, 2024
1 parent a6b15fb commit 2f2ce6a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ USE_MIDDLE_NAME=true
CONTRIBUTION_ENABLED=true
SEND_FRESH_MEMBER_EMAIL_TO_BOARD=true
SEND_FRESH_MEMBER_EMAIL_TO_DIVISION_EMAIL=false
ENABLE_DIVISION_CONTACTS_CAN_APPROVE_NEW_MEMBERS=false

# Set to https in production environment
SECURE_SCHEME='http'
1 change: 1 addition & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parameters:
app.sendFreshMemberEmailToBoard: '%env(bool:SEND_FRESH_MEMBER_EMAIL_TO_BOARD)%'
app.sendFreshMemberEmailToDivisionEmail: '%env(bool:SEND_FRESH_MEMBER_EMAIL_TO_DIVISION_EMAIL)%'
app.contributionEnabled: '%env(bool:CONTRIBUTION_ENABLED)%'
app.enableDivisionContactsCanApproveNewMembers: '%env(bool:ENABLE_DIVISION_CONTACTS_CAN_APPROVE_NEW_MEMBERS)%'
router.request_context.scheme: '%env(SECURE_SCHEME)%'
asset.request_context.secure: true

Expand Down
16 changes: 13 additions & 3 deletions src/Controller/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function configureCrud(): Crud {

public function configureMenuItems(): iterable
{
return [
$items = [
MenuItem::linkToDashboard('Dashboard', 'fa fa-home'),

MenuItem::section('Website')->setPermission('ROLE_ADMIN'),
Expand All @@ -58,7 +58,15 @@ public function configureMenuItems(): iterable
MenuItem::section('Administratie'),
MenuItem::linkToCrud('Leden', 'fa fa-users', Member::class),
MenuItem::linkToCrud('Steunleden', 'fa fa-users', SupportMember::class)->setPermission('ROLE_ADMIN'),
MenuItem::linkToCrud('Aanmeldingen', 'fa fa-user-plus', MembershipApplication::class),
];

$membership_applications = MenuItem::linkToCrud('Aanmeldingen', 'fa fa-user-plus', MembershipApplication::class);
if (!$this->getParameter('app.enableDivisionContactsCanApproveNewMembers')) {
$membership_applications->setPermission('ROLE_ADMIN');
}

array_push($items,
$membership_applications,
MenuItem::linkToCrud('Groepen', 'fa fa-building', Division::class)->setPermission('ROLE_ADMIN'),
MenuItem::linkToCrud('Lidmaatschapstypes', 'fa fa-building', MembershipStatus::class)->setPermission('ROLE_ADMIN'),

Expand All @@ -69,6 +77,8 @@ public function configureMenuItems(): iterable
MenuItem::linkToRoute('Home', 'fa fa-arrow-left', 'member_home'),
MenuItem::linkToRoute('Statistieken', 'fa fa-bar-chart', 'admin_statistics')->setPermission('ROLE_ADMIN'),
MenuItem::linkToLogout('Uitloggen', 'fa fa-lock')
];
);

return $items;
}
}
10 changes: 9 additions & 1 deletion src/Controller/Admin/MembershipApplicationCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,19 @@ public static function getEntityFqcn(): string

public function configureCrud(Crud $crud): Crud
{
return $crud
$crud
->setEntityLabelInSingular('aanmelding')
->setEntityLabelInPlural('Lidmaatschapsaanmeldingen')
->setSearchFields(['id', 'firstName', 'lastName', 'email', 'phone', 'city', 'postCode'])
;

if ($this->getParameter('app.enableDivisionContactsCanApproveNewMembers')) {
$crud->setEntityPermission('ROLE_DIVISION_CONTACT');
} else {
$crud->setEntityPermission('ROLE_ADMIN');
}

return $crud;
}

public function configureActions(Actions $actions): Actions
Expand Down
2 changes: 1 addition & 1 deletion templates/email/html/contact_new_member.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'email/html/layout.html.twig' %}
{% block content %}
<p>
Beste {{ contact.getFullName }},
Beste {{ contact.getFirstName }},
</p>
<p>
Onlangs heeft een nieuw lid zich aangemeld bij {{ organisatienaam }}: {{ member.getFullName }}.
Expand Down
4 changes: 2 additions & 2 deletions templates/email/text/contact_new_member.txt.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
r% extends 'email/text/layout.txt.twig' %}
{% extends 'email/text/layout.txt.twig' %}
{% block content %}
Beste {{ contact.getFullName }},
Beste {{ contact.getFirstName }},

Onlangs heeft een nieuw lid zich aangemeld bij {{ organisatienaam }}: {{ member.getFullName }}.
Hun lidmaatschap is zojuist goedgekeurd door het bestuur van {{ organisatienaam }}. Bij het aanmelden heeft dit lid aangegeven zich graag aan te sluiten bij de groep {{ member.division.name }}.
Expand Down

0 comments on commit 2f2ce6a

Please sign in to comment.