Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Prevent OgMemberships to be created with the 'non-member' and 'member' role #174

Merged
merged 5 commits into from
Sep 14, 2016

Conversation

dakala
Copy link
Contributor

@dakala dakala commented Sep 10, 2016

Re-rolled #165

@@ -204,15 +225,6 @@ public function entityOperationAccessProvider() {
],
],
[
// Non-members should have the right to edit any group content.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dakala you have removed this part for now, just because the tests failed, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amitaibu Not just now. I removed it because the old test assigned a non-member role to a membership. The member role is assigned to a membership automatically so that's not a problem here.

I mentioned some time ago I didn't know how to make the Wiki functionality work for a core authenticated user. Once I understand how the wiki works (i.e. what enables wiki on a piece of content) I can write a test for the "non-member" role - a core authenticated use r who isn't a member of the group.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's isn't really wiki feature - the name of the file can change. It's just about checking different scenarios of permissions. So wiki refers here to the fact that a non-member can edit existing group content.

@dakala
Copy link
Contributor Author

dakala commented Sep 10, 2016

Ok, let's rename it. That name and functionality made sense when an OgMembership could have a "non-member" role. Shall we say OgMembershipRoleTest? Or OgMembershipDefaultRoles? Anything more fitting?

@amitaibu
Copy link
Member

AccessByOgMembershipTest?

@@ -204,15 +225,6 @@ public function entityOperationAccessProvider() {
],
],
[
// Non-members should have the right to edit any group content.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll give this a look now

$role->grantPermission('edit any group_content content');
$role->save();
/** @var OgRole $role */
$role = OgRole::getRole('block_content', 'group', $role_name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dakala I've re-added saving the roles for non-members as-well (and even used the new OgRole::getRole). The error was that a few lines below we didn't re-load the $role for the auth user, thus saved the membership with the wrong role.

@amitaibu amitaibu merged commit b396002 into Gizra:8.x-1.x Sep 14, 2016
@amitaibu amitaibu deleted the 293-disallow-member-nonmember-role branch September 14, 2016 17:44
@amitaibu
Copy link
Member

Merged, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants