Skip to content
Open
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
eb1be96
fix plugin not found exception during kernel tests
DiDebru Nov 16, 2018
0d785fb
Adds basic UI for adding, editing and removing group memberships
jludwig Jan 11, 2017
027bbdd
Adds a bit of polish to the membership UI: including adding operation…
jludwig Jan 30, 2017
623594a
Adds PR #222 since they work well together and this avoids merge conf…
jludwig Jan 30, 2017
a4457b5
Adds membership type page to facilitate when multiple membership type…
jludwig Feb 1, 2017
b19b36a
Ensures that only valid members/roles can be selected. Also some misc…
jludwig Feb 4, 2017
bb44b84
Adds a general membership add page for when multiple membership types…
jludwig Feb 11, 2017
8504dbc
OG membership UI code cleanup etc based on PR review feedback
jludwig May 12, 2017
8f1198c
Additional OG membership UI tweaks and fixes.
jludwig May 13, 2017
1e2d63d
OG Membership UI: Fixes PluginNotFoundException in tests.
jludwig Jun 1, 2017
2486ebe
API update: getUser() to getOwner().
jludwig Oct 16, 2017
97bf31f
Credit: zerolab | OgAdminRoutesEvent array merge fix. Important param…
jludwig Nov 3, 2017
557a92b
Fixed entity reference selection plugin loading all membership entiti…
joachim-n May 29, 2018
8d14525
Added method to MembershipManager to get the count of members in a gr…
joachim-n May 29, 2018
abb614f
Fixed access check to query for the count of group members, rather th…
joachim-n May 29, 2018
2714970
Added docs to UniqueOgMembershipConstraintValidator to explain why it…
joachim-n May 29, 2018
2978f39
Fixed UniqueOgMembershipConstraintValidator loading all membership en…
joachim-n May 29, 2018
cce4160
Removed getGroupMemberships(): no longer used, and does not scale for…
joachim-n May 29, 2018
c532603
Fix OgUserSelection query
zerolab Jun 8, 2018
1a4afc5
Fix query
zerolab Jun 8, 2018
20ea6d2
fixup! Fix query
zerolab Jun 8, 2018
fbc3a5c
Fix UniqueOgMembershipConstraintValidator not filtering on the group
zerolab Aug 31, 2018
f0b86c3
Merge branch 'feature/fix-tests' into ui-test-fix
DiDebru Nov 16, 2018
6e70be6
use new fieldtype
DiDebru Nov 16, 2018
6973bf0
fix php doc
DiDebru Nov 16, 2018
1387d61
fix fatal on group create
DiDebru Nov 16, 2018
dde81c9
add options module to all kernel tests
DiDebru Nov 19, 2018
3e93d7a
Remove t() from setLabel()
DiDebru Nov 19, 2018
a4b17f3
test
DiDebru Nov 19, 2018
50daa54
Remove deprecated drupal_set_message replace it with OO MessengerInte…
DiDebru Nov 19, 2018
dfa0563
add cache_test
DiDebru Nov 19, 2018
2562cab
add messenger to test
DiDebru Nov 19, 2018
dc646df
fix typo
DiDebru Nov 19, 2018
9f504d9
fix code style
DiDebru Nov 19, 2018
555d6ce
Fix Travis CI Integration
webflo Nov 19, 2018
aaeb18d
Dump the composer log
webflo Nov 19, 2018
bce8f34
Add drupal/core 8.7.x
webflo Nov 19, 2018
2ce50cc
Disable all deprecations
webflo Nov 19, 2018
7e0cba4
Add field module to BundleFormAlter
DiDebru Nov 19, 2018
c4a80b9
Test Drupal 8.7.x with PHP 7.2 only
webflo Nov 19, 2018
d634374
Sort excludes similar to env.matrix
webflo Nov 19, 2018
654a7e3
Remove SYMFONY_DEPRECATIONS_HELPER again
webflo Nov 19, 2018
a1a8a4f
Remove verbose flags from composer
webflo Nov 19, 2018
fe8b401
fix code style
DiDebru Nov 19, 2018
8032e78
Revert "Remove t() from setLabel()"
DiDebru Nov 19, 2018
a430a74
use entitymanager for backport compability
DiDebru Nov 19, 2018
ccd23ef
Revert "use entitymanager for backport compability"
DiDebru Nov 19, 2018
095b559
Merge branch 'travis-ci' into ui-test-fix
DiDebru Nov 19, 2018
ac778a5
Fix typos
DiDebru Nov 21, 2018
7392220
test
DiDebru Nov 19, 2018
40d90e1
test
DiDebru Nov 19, 2018
c3c2a36
test
DiDebru Nov 19, 2018
41d595c
test
DiDebru Nov 19, 2018
9ffa907
test
DiDebru Nov 19, 2018
325f17e
test
DiDebru Nov 19, 2018
3ccfde5
test
DiDebru Nov 19, 2018
9b8a362
Provide member addPage on Member list
DiDebru Nov 20, 2018
275739f
Remove OgActionLink return message markup
DiDebru Nov 20, 2018
00f499d
Remove AdminRoutes event because imho additional admin routes should …
DiDebru Nov 21, 2018
29d777a
Fix OgLocalTaskTest
DiDebru Nov 21, 2018
a3513a1
Fix GroupTabTest
DiDebru Nov 21, 2018
0f51cb4
Fix GroupTabTest
DiDebru Nov 22, 2018
e8ab94b
Remove test
DiDebru Nov 22, 2018
15ae705
fix code style
DiDebru Nov 22, 2018
5567a1c
Remove tests for PHP 5.6
DiDebru Nov 23, 2018
5878ecf
Better GroupCheck
DiDebru Nov 26, 2018
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
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: php
sudo: true

php:
- 5.6
- 7.0
- 7.1
- 7.2
Expand All @@ -13,19 +12,26 @@ env:
matrix:
- TEST_SUITE=8.5.x
- TEST_SUITE=8.6.x
- TEST_SUITE=8.7.x
- TEST_SUITE=PHP_CodeSniffer

# Only run the coding standards check once.
matrix:
exclude:
- php: 5.6
env: TEST_SUITE=8.7.x
- php: 7.0
env: TEST_SUITE=8.7.x
- php: 7.1
env: TEST_SUITE=8.7.x
- php: 5.6
env: TEST_SUITE=PHP_CodeSniffer
- php: 7.0
env: TEST_SUITE=PHP_CodeSniffer
- php: 7.1
env: TEST_SUITE=PHP_CodeSniffer
allow_failures:
- env: TEST_SUITE=8.6.x
- env: TEST_SUITE=8.7.x

mysql:
database: og
Expand All @@ -44,9 +50,6 @@ before_script:
# Remember the current directory for later use in the Drupal installation.
- MODULE_DIR=$(pwd)

# Install Composer dependencies for OG.
- composer install

# Navigate out of module directory to prevent blown stack by recursive module
# lookup.
- cd ..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@ content:
rows: 2
placeholder: ''
third_party_settings: { }
roles:
type: options_buttons
weight: 0
settings: { }
third_party_settings: { }
uid:
type: og_autocomplete
weight: -1
settings:
match_operator: CONTAINS
size: 60
placeholder: ''
third_party_settings: { }
hidden: { }
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,21 @@ content:
og_membership_request:
label: above
type: basic_string
weight: 0
weight: 2
settings: { }
third_party_settings: { }
roles:
type: entity_reference_label
weight: 1
label: above
settings:
link: false
third_party_settings: { }
uid:
type: entity_reference_label
weight: 0
label: above
settings:
link: true
third_party_settings: { }
hidden: { }
51 changes: 51 additions & 0 deletions config/optional/views.view.og_members_overview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,57 @@ display:
entity_type: og_membership
entity_field: roles
plugin_id: field
operations:
id: operations
table: og_membership
field: operations
relationship: none
group_type: group
admin_label: ''
label: 'Operations links'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
destination: true
entity_type: og_membership
plugin_id: entity_operations
filters: { }
sorts: { }
header: { }
Expand Down
15 changes: 15 additions & 0 deletions config/schema/og.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,18 @@ condition.plugin.og_group_type:
type: sequence
sequence:
type: string

# Copied and adapted from core.entity.schema.yml
field.widget.settings.og_autocomplete:
type: mapping
label: 'OG context based entity reference autocomplete with display format settings'
mapping:
match_operator:
type: string
label: 'Autocomplete matching'
size:
type: integer
label: 'Size of textfield'
placeholder:
type: label
label: 'Placeholder'
11 changes: 11 additions & 0 deletions og.links.action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
og_membership.type_add:
route_name: og_membership.type_add
title: 'Add membership type'
appears_on:
- entity.og_membership_type.collection

og_admin.members.add:
route_name: og_admin.members.add
title: 'Add member'
appears_on:
- og_admin.members
5 changes: 5 additions & 0 deletions og.links.menu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
entity.og_membership_type.collection:
title: 'Membership types'
parent: system.admin_structure
description: 'Create and manage fields, forms, and display settings for OG memberships.'
route_name: entity.og_membership_type.collection
15 changes: 14 additions & 1 deletion og.links.task.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
og.og_admin_routes:
entity.og_membership.canonical:
route_name: entity.og_membership.canonical
base_route: entity.og_membership.canonical
title: View
entity.og_membership.edit_form:
route_name: entity.og_membership.edit_form
base_route: entity.og_membership.canonical
title: Edit
entity.og_membership.delete_form:
route_name: entity.og_membership.delete_form
base_route: entity.og_membership.canonical
title: Delete
weight: 10
og_admin.local_tasks:
deriver: \Drupal\og\Plugin\Derivative\OgLocalTask
44 changes: 43 additions & 1 deletion og.module
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use Drupal\og\Entity\OgRole;
use Drupal\og\Og;
use Drupal\og\OgGroupAudienceHelperInterface;
use Drupal\og\OgMembershipInterface;
use Drupal\og\OgMembershipTypeInterface;
use Drupal\og\OgRoleInterface;
use Drupal\system\Entity\Action;
use Drupal\user\EntityOwnerInterface;
Expand Down Expand Up @@ -177,6 +178,47 @@ function og_entity_access(EntityInterface $entity, $operation, AccountInterface
return AccessResult::forbidden();
}

/**
* Implements hook_ENTITY_TYPE_access().
*/
function og_og_membership_type_access(OgMembershipTypeInterface $entity, $operation, AccountInterface $account) {
// Do not allow deleting the default membership type.
if ($operation === 'delete' && $entity->id() === OgMembershipInterface::TYPE_DEFAULT) {
return AccessResult::forbidden();
}

// If the user has permission to administer all groups, allow access.
if ($account->hasPermission('administer group')) {
return AccessResult::allowed();
}

return AccessResult::forbidden();
}

/**
* Implements hook_ENTITY_TYPE_access().
*/
function og_og_membership_access(OgMembershipInterface $entity, $operation, AccountInterface $account) {
$group = $entity->getGroup();

// If there's a group owner, don't let them leave.
if (
isset($group_fields['uid'])
&& $operation === 'delete'
&& $group_fields['uid']->entity->id() === $entity->getOwner()->id()
) {
return AccessResult::forbidden();
}

// Ensure that there's at least one member in the group.
if ($operation === 'delete' && \Drupal::service('og.membership_manager')->getGroupMembershipCount($group) === 1) {
return AccessResult::forbidden();
}

return \Drupal::service('og.access')
->userAccess($entity->getGroup(), 'manage members');
}

/**
* Implements hook_entity_create_access().
*/
Expand Down Expand Up @@ -242,7 +284,7 @@ function og_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundle,

$fields = [];
$fields['og_group'] = BaseFieldDefinition::create('og_group')
->setLabel(t('OG Group'))
->setLabel('OG Group')
Copy link
Member

Choose a reason for hiding this comment

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

This change is unrelated, please revert.

->setComputed(TRUE)
->setTranslatable(FALSE)
->setDefaultValue(TRUE)
Expand Down
Loading