Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ public function buildEntityFieldQuery(

$node_type = $this->instance['bundle'];

// When trying to add related projects as a power user I should be able to
// have the permission.
$power_user_bypass = FALSE;
$item = menu_get_item();
if ($item['path'] == 'entityreference/autocomplete/single/%/%/%' && og_is_group($this->entity_type, $this->entity)) {
$power_user_bypass = _c4m_features_og_members_is_power_user($this->entity, $account);
$target_access = og_user_access($group_type, $group['gid'], "create $node_type content");

// Any member can edit a wiki page unless a power user has changed it
// specifically for a specific node.
if (!empty($this->entity->nid) && $node_type == 'wiki_page') {
$target_access = og_user_access($group_type, $group['gid'], "update any wiki_page content");
}

if (!$power_user_bypass && !og_user_access($group_type, $group['gid'], "create $node_type content")) {
if (!_c4m_features_og_members_is_power_user() && !$target_access) {
// User does not have permission, falsify the query.
$query->propertyCondition($entity_info['entity keys']['id'], static::FALSE_ID, '=');
return $query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,7 @@ function c4m_user_user_default_permissions() {
'name' => 'edit any wiki_page content',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'node',
);
Expand Down