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

feat: member and user administrative overview #1899

Merged
merged 3 commits into from
Sep 11, 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
2 changes: 1 addition & 1 deletion module/Activity/src/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

if (0 !== $updateProposal->count()) {
// If there already is an update proposal for this activity, show that instead of the original activity.
$activity = $updateProposal->first()->getNew();

Check failure on line 151 in module/Activity/src/Controller/AdminController.php

View workflow job for this annotation

GitHub Actions / Psalm

PossiblyFalseReference

module/Activity/src/Controller/AdminController.php:151:51: PossiblyFalseReference: Cannot call method getNew on possibly false value (see https://psalm.dev/105)
}

$activityData = $activity->toArray();
Expand Down Expand Up @@ -441,7 +441,7 @@
*/
public function viewAction(): ViewModel
{
if (!$this->aclService->isAllowed('viewAdmin', 'activity')) {
if (!$this->aclService->isAllowed('view', 'activity_admin')) {
throw new NotAllowedException($this->translator->translate('You are not allowed to administer activities'));
}

Expand Down
20 changes: 12 additions & 8 deletions module/Activity/src/Service/AclService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Activity\Service;

use Laminas\Permissions\Acl\Resource\GenericResource as Resource;
use User\Permissions\Assertion\IsCreatorOrOrganMember;

class AclService extends \User\Service\AclService
Expand All @@ -12,13 +13,15 @@ protected function createAcl(): void
{
parent::createAcl();

$this->acl->addResource('activity');
$this->acl->addResource('activityApi');
$this->acl->addResource('myActivities');
$this->acl->addResource('model');
$this->acl->addResource('activity_calendar_period');
$this->acl->addResource('activity_calendar_proposal');
$this->acl->addResource('signupList');
$this->acl->addResource(new Resource('activity'));
$this->acl->addResource(new Resource('activityApi'));
$this->acl->addResource(new Resource('myActivities'));
$this->acl->addResource(new Resource('model'));
$this->acl->addResource(new Resource('activity_calendar_period'));
$this->acl->addResource(new Resource('activity_calendar_proposal'));
$this->acl->addResource(new Resource('signupList'));
// Define administration part of this module, however, sub-permissions must be manually configured.
$this->acl->addResource(new Resource('activity_admin'));

$this->acl->allow('guest', 'activity', ['view', 'viewCategory']);
$this->acl->allow('guest', 'signupList', ['view', 'externalSignup']);
Expand All @@ -35,7 +38,7 @@ protected function createAcl(): void
['view', 'viewDetails', 'signup', 'signoff', 'checkUserSignedUp'],
);

$this->acl->allow('active_member', 'activity', ['create', 'viewAdmin', 'listCategories']);
$this->acl->allow('active_member', 'activity', ['create', 'listCategories']);
$this->acl->allow(
'active_member',
'activity',
Expand All @@ -48,6 +51,7 @@ protected function createAcl(): void
['adminSignup', 'viewParticipants', 'exportParticipants'],
new IsCreatorOrOrganMember(),
);
$this->acl->allow('active_member', 'activity_admin', 'view');

$this->acl->allow('admin', 'activity', 'viewParticipantDetails');
$this->acl->allow('admin', 'activity', 'approve');
Expand Down
27 changes: 24 additions & 3 deletions module/Application/language/en.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 23 additions & 2 deletions module/Application/language/gewisweb.pot

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 24 additions & 3 deletions module/Application/language/nl.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading