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

254 Default argument membership #564

Conversation

MPParsley
Copy link
Collaborator

@MPParsley MPParsley commented Aug 21, 2019

Merging tombola:default-argument-membership into gizra/og

use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Default argument plugin to provide the group memberships from the current context.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
* Default argument plugin to provide the group memberships from the current context.
* Default argument plugin to provide the group memberships from the current
* context.

* The OG context provider.
* @param \Drupal\og\MembershipManagerInterface $og_membership
* The OG membership manager.
* @param \Drupal\Core\Session\AccountInterface $og_user
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
* @param \Drupal\Core\Session\AccountInterface $og_user
* @param \Drupal\Core\Session\AccountInterface $user

* @param \Drupal\Core\Session\AccountInterface $og_user
* The user to be evaluated.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ContextProviderInterface $og_context, MembershipManagerInterface $og_membership, AccountInterface $og_user) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
public function __construct(array $configuration, $plugin_id, $plugin_definition, ContextProviderInterface $og_context, MembershipManagerInterface $og_membership, AccountInterface $og_user) {
public function __construct(array $configuration, $plugin_id, $plugin_definition, ContextProviderInterface $og_context, MembershipManagerInterface $og_membership, AccountInterface $user) {


$this->ogContext = $og_context;
$this->ogMembership = $og_membership;
$this->ogUser = $og_user;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
$this->ogUser = $og_user;
$this->ogUser = $user;

*/
public function getCacheContexts() {
// This cache context is the best thing we have right now.
// og_role takes in consideration the user memberships and
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
// og_role takes in consideration the user memberships and
// og_role takes in consideration the user memberships and

public function getCacheContexts() {
// This cache context is the best thing we have right now.
// og_role takes in consideration the user memberships and
// the roles held in the corresponding groups, and while it
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
// the roles held in the corresponding groups, and while it
// the roles held in the corresponding groups, and while it

// This cache context is the best thing we have right now.
// og_role takes in consideration the user memberships and
// the roles held in the corresponding groups, and while it
// is one level too granular, i.e. the context will be more
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
// is one level too granular, i.e. the context will be more
// is one level too granular, i.e. the context will be more

* An array of groups, or an empty array if no group is found.
*/
protected function getCurrentUserGroupIds($entity_type = 'node') {
$groups = $this->ogMembership->getUserGroupIds($this->ogUser);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
$groups = $this->ogMembership->getUserGroupIds($this->ogUser);
$groups = $this->ogMembership->getUserGroupIds($this->ogUser->id());

@MPParsley MPParsley merged commit 2591f05 into Gizra:feature/default-argument-membership Aug 21, 2019
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.

3 participants