Skip to content

Commit 212976a

Browse files
authored
[TASK] Remove public access feature for registration lists (#4277)
1 parent 7e2bce9 commit 212976a

File tree

7 files changed

+11
-299
lines changed

7 files changed

+11
-299
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
110110

111111
### Removed
112112

113+
- Remove public access feature for registration lists (#4277)
113114
- Drop `Venue.zip` (#4274)
114115
- Drop `Venue.country` (#4273, #4275)
115116
- Drop `Event.language` (#4271)

Classes/Configuration/ListViewConfigurationCheck.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private function checkAccessToFrontEndRegistrationLists(): void
146146
'This value specifies who is able to see the registered persons an event in the front end .
147147
If this value is incorrect, persons may access the registration lists although they should not be allowed to
148148
(or vice versa).',
149-
['attendees_and_managers', 'login', 'world']
149+
['attendees_and_managers', 'login']
150150
);
151151
}
152152

Classes/OldModel/LegacyEvent.php

+2-61
Original file line numberDiff line numberDiff line change
@@ -1812,7 +1812,7 @@ public function isUserVip(int $userUid): bool
18121812
* @param int<0, max> $registrationsVipListPID
18131813
* the value of the registrationsVipListPID parameter
18141814
* (only relevant for (seminar_list|my_events|my_vip_events))
1815-
* @param 'attendees_and_managers'|'login'|'world' $accessLevel
1815+
* @param 'attendees_and_managers'|'login' $accessLevel
18161816
*
18171817
* @return bool TRUE if a FE user is logged in and the user may view
18181818
* the registrations list or may see a link to that
@@ -1829,13 +1829,6 @@ public function canViewRegistrationsList(
18291829
}
18301830

18311831
switch ($accessLevel) {
1832-
case 'world':
1833-
$result = $this->canViewRegistrationsListForWorldAccess(
1834-
$whichPlugin,
1835-
$registrationsListPID,
1836-
$registrationsVipListPID
1837-
);
1838-
break;
18391832
case 'login':
18401833
$result = $this->canViewRegistrationsListForLoginAccess(
18411834
$whichPlugin,
@@ -1967,63 +1960,14 @@ protected function canViewRegistrationsListForLoginAccess(
19671960
return $result;
19681961
}
19691962

1970-
/**
1971-
* Checks whether a FE user is logged in and whether he/she may view this
1972-
* seminar's registrations list or see a link to it.
1973-
*
1974-
* This function assumes that the access level for FE registration lists is
1975-
* "world".
1976-
*
1977-
* @param 'seminar_list'|'my_events'|'my_vip_events'|'list_registrations'|'list_vip_registrations' $whichPlugin
1978-
* @param int<0, max> $registrationsListPID
1979-
* the value of the registrationsListPID parameter
1980-
* (only relevant for (seminar_list|my_events|my_vip_events))
1981-
* @param int<0, max> $registrationsVipListPID
1982-
* the value of the registrationsVipListPID parameter
1983-
* (only relevant for (seminar_list|my_events|my_vip_events))
1984-
*
1985-
* @return bool TRUE if a FE user is logged in and the user may view
1986-
* the registrations list or may see a link to that
1987-
* page, FALSE otherwise
1988-
*/
1989-
protected function canViewRegistrationsListForWorldAccess(
1990-
string $whichPlugin,
1991-
int $registrationsListPID = 0,
1992-
int $registrationsVipListPID = 0
1993-
): bool {
1994-
$currentUserUid = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.user', 'id');
1995-
\assert(\is_int($currentUserUid) && $currentUserUid >= 0);
1996-
$isLoggedIn = $currentUserUid > 0;
1997-
1998-
$hasListPid = $registrationsListPID > 0;
1999-
$hasVipListPid = $registrationsVipListPID > 0;
2000-
2001-
switch ($whichPlugin) {
2002-
case 'my_vip_events':
2003-
$result = $isLoggedIn && $this->isUserVip($currentUserUid)
2004-
&& $hasVipListPid;
2005-
break;
2006-
case 'list_vip_registrations':
2007-
$result = $isLoggedIn && $this->isUserVip($currentUserUid);
2008-
break;
2009-
case 'list_registrations':
2010-
$result = true;
2011-
break;
2012-
default:
2013-
$result = $hasListPid;
2014-
}
2015-
2016-
return $result;
2017-
}
2018-
20191963
/**
20201964
* Checks whether a FE user is logged in and whether he/she may view this
20211965
* seminar's registrations list.
20221966
* This function is intended to be used from the registrations list,
20231967
* NOT to check whether a link to that list should be shown.
20241968
*
20251969
* @param 'seminar_list'|'my_events'|'my_vip_events'|'list_registrations'|'list_vip_registrations' $whichPlugin
2026-
* @param 'attendees_and_managers'|'login'|'world' $accessLevel
1970+
* @param 'attendees_and_managers'|'login' $accessLevel
20271971
*
20281972
* @return string an empty string if everything is OK, a localized error
20291973
* message otherwise
@@ -2035,9 +1979,6 @@ public function canViewRegistrationsListMessage(
20351979
if (!$this->needsRegistration()) {
20361980
return $this->translate('message_noRegistrationNecessary');
20371981
}
2038-
if ($accessLevel === 'world') {
2039-
return '';
2040-
}
20411982
if (!GeneralUtility::makeInstance(Context::class)->getAspect('frontend.user')->isLoggedIn()) {
20421983
return $this->translate('message_notLoggedIn');
20431984
}

Configuration/TypoScript/FrontEnd.typoscript

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ plugin.tx_seminars_pi1 {
7474
generalPriceInSingle = 0
7575

7676
# who is allowed to view the list of registrations on the front end:
77-
# "attendees_and_managers", "login" or "world"
77+
# "attendees_and_managers" or "login"
7878
accessToFrontEndRegistrationLists = attendees_and_managers
7979

8080
# whether detailed information for the speakers is shown in the single view

Documentation/Reference/SetupForTheSeminarManagerFront-endPlug-inInPlugintxSeminarsPi1/Index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ override the corresponding value from TS Setup.**
397397

398398
Description
399399
who is allowed to view the list of registrations on the front end;
400-
allowed values are: attendees\_and\_managers, login, world
400+
allowed values are: attendees\_and\_managers, login
401401

402402
Default
403403
attendees\_and\_managers

Tests/LegacyFunctional/OldModel/LegacyEventTest.php

-230
Original file line numberDiff line numberDiff line change
@@ -6611,206 +6611,6 @@ public function canViewRegistrationsListWithNeedsRegistrationAndLoginAccess(
66116611
);
66126612
}
66136613

6614-
/**
6615-
* Data provider for testing the canViewRegistrationsList function
6616-
* with world access.
6617-
*
6618-
* @return mixed[][] test data for canViewRegistrationsList with each row
6619-
* having the following elements:
6620-
* [expected] boolean: expected value (TRUE or FALSE)
6621-
* [loggedIn] boolean: whether a user is logged in
6622-
* [isRegistered] boolean: whether the logged-in user is
6623-
* registered for that event
6624-
* [isVip] boolean: whether the logged-in user is a VIP
6625-
* that event
6626-
* [whichPlugin] string: value for that parameter
6627-
* [registrationsListPID] integer: value for that parameter
6628-
* [registrationsVipListPID] integer: value for that parameter
6629-
*/
6630-
public function canViewRegistrationsListDataProviderForWorld(): array
6631-
{
6632-
return [
6633-
'seminarListWithNothingElse' => [
6634-
'expected' => false,
6635-
'loggedIn' => false,
6636-
'isRegistered' => false,
6637-
'isVip' => false,
6638-
'whichPlugin' => 'seminar_list',
6639-
'registrationsListPID' => 0,
6640-
'registrationsVipListPID' => 0,
6641-
],
6642-
'seminarListWithListPid' => [
6643-
'expected' => true,
6644-
'loggedIn' => false,
6645-
'isRegistered' => false,
6646-
'isVip' => false,
6647-
'whichPlugin' => 'seminar_list',
6648-
'registrationsListPID' => 1,
6649-
'registrationsVipListPID' => 0,
6650-
],
6651-
'seminarListLoggedInWithListPid' => [
6652-
'expected' => true,
6653-
'loggedIn' => true,
6654-
'isRegistered' => false,
6655-
'isVip' => false,
6656-
'whichPlugin' => 'seminar_list',
6657-
'registrationsListPID' => 1,
6658-
'registrationsVipListPID' => 0,
6659-
],
6660-
'seminarListIsRegisteredWithListPid' => [
6661-
'expected' => true,
6662-
'loggedIn' => true,
6663-
'isRegistered' => true,
6664-
'isVip' => false,
6665-
'whichPlugin' => 'seminar_list',
6666-
'registrationsListPID' => 1,
6667-
'registrationsVipListPID' => 0,
6668-
],
6669-
'seminarListIsRegisteredWithoutListPid' => [
6670-
'expected' => false,
6671-
'loggedIn' => true,
6672-
'isRegistered' => true,
6673-
'isVip' => false,
6674-
'whichPlugin' => 'seminar_list',
6675-
'registrationsListPID' => 0,
6676-
'registrationsVipListPID' => 0,
6677-
],
6678-
'seminarListIsVipWithListPid' => [
6679-
'expected' => false,
6680-
'loggedIn' => true,
6681-
'isRegistered' => true,
6682-
'isVip' => true,
6683-
'whichPlugin' => 'seminar_list',
6684-
'registrationsListPID' => 0,
6685-
'registrationsVipListPID' => 1,
6686-
],
6687-
'seminarListIsVipWithoutListPid' => [
6688-
'expected' => false,
6689-
'loggedIn' => true,
6690-
'isRegistered' => false,
6691-
'isVip' => true,
6692-
'whichPlugin' => 'seminar_list',
6693-
'registrationsListPID' => 0,
6694-
'registrationsVipListPID' => 0,
6695-
],
6696-
'myEventsIsRegisteredWithListPid' => [
6697-
'expected' => true,
6698-
'loggedIn' => true,
6699-
'isRegistered' => true,
6700-
'isVip' => false,
6701-
'whichPlugin' => 'my_events',
6702-
'registrationsListPID' => 1,
6703-
'registrationsVipListPID' => 1,
6704-
],
6705-
'myEventsIsVipWithVipListPid' => [
6706-
'expected' => true,
6707-
'loggedIn' => true,
6708-
'isRegistered' => false,
6709-
'isVip' => true,
6710-
'whichPlugin' => 'my_events',
6711-
'registrationsListPID' => 1,
6712-
'registrationsVipListPID' => 1,
6713-
],
6714-
'myVipEventsIsRegisteredWithVipListPid' => [
6715-
'expected' => false,
6716-
'loggedIn' => true,
6717-
'isRegistered' => true,
6718-
'isVip' => false,
6719-
'whichPlugin' => 'my_vip_events',
6720-
'registrationsListPID' => 1,
6721-
'registrationsVipListPID' => 1,
6722-
],
6723-
'myVipEventsIsVipWithVipListPid' => [
6724-
'expected' => true,
6725-
'loggedIn' => true,
6726-
'isRegistered' => false,
6727-
'isVip' => true,
6728-
'whichPlugin' => 'my_vip_events',
6729-
'registrationsListPID' => 1,
6730-
'registrationsVipListPID' => 1,
6731-
],
6732-
'listRegistrationsIsRegistered' => [
6733-
'expected' => true,
6734-
'loggedIn' => true,
6735-
'isRegistered' => true,
6736-
'isVip' => false,
6737-
'whichPlugin' => 'list_registrations',
6738-
'registrationsListPID' => 0,
6739-
'registrationsVipListPID' => 0,
6740-
],
6741-
'listRegistrationsIsVip' => [
6742-
'expected' => true,
6743-
'loggedIn' => true,
6744-
'isRegistered' => false,
6745-
'isVip' => true,
6746-
'whichPlugin' => 'list_registrations',
6747-
'registrationsListPID' => 0,
6748-
'registrationsVipListPID' => 0,
6749-
],
6750-
'listVipRegistrationsIsRegistered' => [
6751-
'expected' => false,
6752-
'loggedIn' => true,
6753-
'isRegistered' => true,
6754-
'isVip' => false,
6755-
'whichPlugin' => 'list_vip_registrations',
6756-
'registrationsListPID' => 0,
6757-
'registrationsVipListPID' => 0,
6758-
],
6759-
'listVipRegistrationsIsVip' => [
6760-
'expected' => true,
6761-
'loggedIn' => true,
6762-
'isRegistered' => false,
6763-
'isVip' => true,
6764-
'whichPlugin' => 'list_vip_registrations',
6765-
'registrationsListPID' => 0,
6766-
'registrationsVipListPID' => 0,
6767-
],
6768-
];
6769-
}
6770-
6771-
/**
6772-
* @test
6773-
*
6774-
* @dataProvider canViewRegistrationsListDataProviderForWorld
6775-
*/
6776-
public function canViewRegistrationsListWithNeedsRegistrationAndWorldAccess(
6777-
bool $expected,
6778-
bool $loggedIn,
6779-
bool $isRegistered,
6780-
bool $isVip,
6781-
string $whichPlugin,
6782-
int $registrationsListPID,
6783-
int $registrationsVipListPID
6784-
): void {
6785-
$subject = $this->createPartialMock(
6786-
LegacyEvent::class,
6787-
['needsRegistration', 'isUserRegistered', 'isUserVip']
6788-
);
6789-
$subject->method('needsRegistration')
6790-
->willReturn(true);
6791-
$subject->method('isUserRegistered')
6792-
->willReturn($isRegistered);
6793-
$subject->method('isUserVip')
6794-
->willReturn($isVip);
6795-
6796-
if ($loggedIn) {
6797-
$rootPageUid = $this->testingFramework->createFrontEndPage();
6798-
$this->testingFramework->changeRecord('pages', $rootPageUid, ['slug' => '/home']);
6799-
$this->testingFramework->createFakeFrontEnd($rootPageUid);
6800-
$this->testingFramework->createAndLoginFrontEndUser();
6801-
}
6802-
6803-
self::assertSame(
6804-
$expected,
6805-
$subject->canViewRegistrationsList(
6806-
$whichPlugin,
6807-
$registrationsListPID,
6808-
$registrationsVipListPID,
6809-
'world'
6810-
)
6811-
);
6812-
}
6813-
68146614
// Tests concerning canViewRegistrationsListMessage
68156615

68166616
/**
@@ -6855,20 +6655,6 @@ public function canViewRegistrationsListMessageForListAndNoLoginAndLoginAccessRe
68556655
);
68566656
}
68576657

6858-
/**
6859-
* @test
6860-
*/
6861-
public function canViewRegistrationsListMessageForListAndNoLoginAndWorldAccessReturnsEmptyString(): void
6862-
{
6863-
$subject = $this->createPartialMock(LegacyEvent::class, ['needsRegistration']);
6864-
$subject->method('needsRegistration')->willReturn(true);
6865-
6866-
self::assertSame(
6867-
'',
6868-
$subject->canViewRegistrationsListMessage('list_registrations', 'world')
6869-
);
6870-
}
6871-
68726658
/**
68736659
* Data provider that returns all possible access level codes for the
68746660
* FE registration lists.
@@ -6900,20 +6686,6 @@ public function canViewRegistrationsListMessageForVipListAndNoLoginReturnsPlease
69006686
);
69016687
}
69026688

6903-
/**
6904-
* @test
6905-
*/
6906-
public function canViewRegistrationsListMessageForVipListAndWorldAccessAndNoLoginReturnsEmptyString(): void
6907-
{
6908-
$subject = $this->createPartialMock(LegacyEvent::class, ['needsRegistration']);
6909-
$subject->method('needsRegistration')->willReturn(true);
6910-
6911-
self::assertSame(
6912-
'',
6913-
$subject->canViewRegistrationsListMessage('list_vip_registrations', 'world')
6914-
);
6915-
}
6916-
69176689
/**
69186690
* Data provider that returns all possible parameter combinations for
69196691
* canViewRegistrationsList as called from canViewRegistrationsListMessage.
@@ -6925,10 +6697,8 @@ public function registrationListParametersDataProvider(): array
69256697
return [
69266698
'attendeesAndManagers' => ['list_registrations', 'attendees_and_managers'],
69276699
'login' => ['list_registrations', 'login'],
6928-
'world' => ['list_registrations', 'world'],
69296700
'attendeesAndManagersVip' => ['list_vip_registrations', 'attendees_and_managers'],
69306701
'loginVip' => ['list_vip_registrations', 'login'],
6931-
'worldVip' => ['list_vip_registrations', 'world'],
69326702
];
69336703
}
69346704

0 commit comments

Comments
 (0)