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

Change the content privacy when the group privacy is changed. #13

Closed
wants to merge 7 commits into from

Conversation

HelenaEksler
Copy link

#12

@@ -287,31 +287,32 @@ function og_access_field_attach_form($entity_type, $entity, &$form, &$form_state
if (!og_is_group_type($entity_type, $bundle)) {
return;
}
$form['#submit'][] = 'og_access_determine_group_privacy_change';
Copy link
Member

Choose a reason for hiding this comment

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

remove the whole function.

@amitaibu
Copy link
Member

amitaibu commented Dec 1, 2014

Looks good, lets add a test. Non-working code:

  /**
   * Test 
   */
  function testAccessChangeBatchApi() {
    $settings = array(
      'type' => $this->group_content_type,
      'uid' => $this->user1->uid,
    );

    // Create two group content.
    $node1 = $this->drupalCreateNode($settings);
    $values = array(
      'entity_type' => 'node',
      'entity' => $node1,
    );
    og_group('node', $this->group_node, $values);

    $this->assertFalse(node_access('view', $node1, $this->user2));

    $this->drupalLogin($this->user1);

    // Change the access of the group via UI, in order for batch API to be
    // invoked
    $edit = array();
    $this->drupalPost('node/' . $this->group_node->nid . '/edit', $edit, 'Submit');

    $this->assertTrue(node_access('view', $node1, $this->user2));
  }

@amitaibu
Copy link
Member

amitaibu commented Dec 2, 2014

@HelenaEksler please push the tests, even if they still fail.

@amitaibu amitaibu changed the title Change the content privacy when the group privacy is changed. WIP: Change the content privacy when the group privacy is changed. Dec 2, 2014
@HelenaEksler HelenaEksler changed the title WIP: Change the content privacy when the group privacy is changed. Change the content privacy when the group privacy is changed. Dec 9, 2014
$this->assertFalse(node_access('view', $this->group_node, $this->user2), 'Other user should not see the group');

// Group is private. We are changing it to public.
debug('Group is private. We are changing it to public.');
Copy link
Member

Choose a reason for hiding this comment

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

remove debug() (here and below).

@amitaibu
Copy link
Member

Merged, thanks.

@amitaibu amitaibu closed this Dec 14, 2014
pfrenssen pushed a commit that referenced this pull request Apr 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants