diff --git a/backend/content-type/eCampMultiSelect/src/Module.php b/backend/content-type/eCampMultiSelect/src/Module.php index 6ecd40ff35..70d6b92c0b 100644 --- a/backend/content-type/eCampMultiSelect/src/Module.php +++ b/backend/content-type/eCampMultiSelect/src/Module.php @@ -34,12 +34,19 @@ public function onBootstrap(MvcEvent $e): void { Option::class, [Acl::REST_PRIVILEGE_FETCH_ALL] ); + + $acl->allow( + User::ROLE_USER, + Option::class, + [Acl::REST_PRIVILEGE_FETCH], + new UserIsCollaborator([CampCollaboration::ROLE_MEMBER, CampCollaboration::ROLE_MANAGER, CampCollaboration::ROLE_GUEST]) + ); + $acl->allow( User::ROLE_USER, Option::class, [ Acl::REST_PRIVILEGE_CREATE, - Acl::REST_PRIVILEGE_FETCH, Acl::REST_PRIVILEGE_PATCH, Acl::REST_PRIVILEGE_UPDATE, Acl::REST_PRIVILEGE_DELETE, diff --git a/backend/content-type/eCampSingleText/src/Module.php b/backend/content-type/eCampSingleText/src/Module.php index c5d9a72b19..c5858dee5e 100644 --- a/backend/content-type/eCampSingleText/src/Module.php +++ b/backend/content-type/eCampSingleText/src/Module.php @@ -48,12 +48,19 @@ public function onBootstrap(MvcEvent $e): void { SingleText::class, [Acl::REST_PRIVILEGE_FETCH_ALL] ); + + $acl->allow( + User::ROLE_USER, + SingleText::class, + [Acl::REST_PRIVILEGE_FETCH], + new UserIsCollaborator([CampCollaboration::ROLE_MEMBER, CampCollaboration::ROLE_MANAGER, CampCollaboration::ROLE_GUEST]) + ); + $acl->allow( User::ROLE_USER, SingleText::class, [ Acl::REST_PRIVILEGE_CREATE, - Acl::REST_PRIVILEGE_FETCH, Acl::REST_PRIVILEGE_PATCH, Acl::REST_PRIVILEGE_UPDATE, Acl::REST_PRIVILEGE_DELETE, diff --git a/backend/content-type/eCampStoryboard/src/Module.php b/backend/content-type/eCampStoryboard/src/Module.php index 33cddda472..1d8db83197 100644 --- a/backend/content-type/eCampStoryboard/src/Module.php +++ b/backend/content-type/eCampStoryboard/src/Module.php @@ -34,12 +34,19 @@ public function onBootstrap(MvcEvent $e): void { Section::class, [Acl::REST_PRIVILEGE_FETCH_ALL] ); + + $acl->allow( + User::ROLE_USER, + Section::class, + [Acl::REST_PRIVILEGE_FETCH], + new UserIsCollaborator([CampCollaboration::ROLE_MEMBER, CampCollaboration::ROLE_MANAGER, CampCollaboration::ROLE_GUEST]) + ); + $acl->allow( User::ROLE_USER, Section::class, [ Acl::REST_PRIVILEGE_CREATE, - Acl::REST_PRIVILEGE_FETCH, Acl::REST_PRIVILEGE_PATCH, Acl::REST_PRIVILEGE_UPDATE, Acl::REST_PRIVILEGE_DELETE, diff --git a/backend/module/eCampApi/config/Rest/campCollaboration.config.php b/backend/module/eCampApi/config/Rest/campCollaboration.config.php index f17cfc10bd..eb21260095 100644 --- a/backend/module/eCampApi/config/Rest/campCollaboration.config.php +++ b/backend/module/eCampApi/config/Rest/campCollaboration.config.php @@ -21,6 +21,7 @@ ->addValidatorInArray([ CampCollaboration::ROLE_MEMBER, CampCollaboration::ROLE_MANAGER, + CampCollaboration::ROLE_GUEST, ]) ) ->buildConfig() diff --git a/backend/module/eCampApi/test/Rest/CampCollaborationTest.php b/backend/module/eCampApi/test/Rest/CampCollaborationTest.php index 2ba0cf7e96..c30f2a8b93 100644 --- a/backend/module/eCampApi/test/Rest/CampCollaborationTest.php +++ b/backend/module/eCampApi/test/Rest/CampCollaborationTest.php @@ -226,10 +226,13 @@ public function testCreateSuccess(): void { $this->assertEquals(CampCollaboration::STATUS_INVITED, $this->getResponseContent()->status); } - public function testCreateOnlyWithEmail(): void { + /** + * @dataProvider getRoles + */ + public function testCreateOnlyWithEmail(string $role): void { $inviteEmail = 'my.mail@fantasy.com'; $this->setRequestContent([ - 'role' => CampCollaboration::ROLE_MEMBER, + 'role' => $role, 'campId' => $this->campCollaboration1->getCamp()->getId(), 'inviteEmail' => $inviteEmail, 'userId' => null, @@ -244,6 +247,10 @@ public function testCreateOnlyWithEmail(): void { $this->assertThat($this->getResponseContent()->_embedded, self::logicalNot(self::classHasAttribute('user'))); } + public static function getRoles(): array { + return [[CampCollaboration::ROLE_GUEST], [CampCollaboration::ROLE_MANAGER], [CampCollaboration::ROLE_MEMBER]]; + } + public function testCreateWithEmailOfExistingUser() { $inviteEmail = 'my.mail@fantasy.com'; $user2 = new User(); diff --git a/backend/module/eCampCore/src/Acl/AclFactory.php b/backend/module/eCampCore/src/Acl/AclFactory.php index 0f27ddb208..8c3de3cdab 100644 --- a/backend/module/eCampCore/src/Acl/AclFactory.php +++ b/backend/module/eCampCore/src/Acl/AclFactory.php @@ -134,7 +134,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o Acl::REST_PRIVILEGE_FETCH, AclAssertion::or( new CampIsPrototype(), - new UserIsCollaborator([CampCollaboration::ROLE_MEMBER, CampCollaboration::ROLE_MANAGER]) + new UserIsCollaborator([CampCollaboration::ROLE_MEMBER, CampCollaboration::ROLE_MANAGER, CampCollaboration::ROLE_GUEST]) ) ); $acl->allow( diff --git a/common/locales/en.json b/common/locales/en.json index 3f5bd9d57c..38f18668ff 100644 --- a/common/locales/en.json +++ b/common/locales/en.json @@ -40,7 +40,8 @@ "collaborators": { "invite": "Invite", "manager": "Manager", - "member": "Member" + "member": "Member", + "guest": "Guest" }, "fields": { "addressCity": "City", diff --git a/frontend/src/components/activity/CardContentNode.vue b/frontend/src/components/activity/CardContentNode.vue index 3d1c560fcc..c1ff40a3b3 100644 --- a/frontend/src/components/activity/CardContentNode.vue +++ b/frontend/src/components/activity/CardContentNode.vue @@ -2,7 +2,8 @@ -