You are here

function oauth_common_can_edit_consumer in OAuth 1.0 7.3

Same name and namespace in other branches
  1. 6.3 oauth_common.module \oauth_common_can_edit_consumer()
  2. 7.4 oauth_common.module \oauth_common_can_edit_consumer()

Checks if the user has permission to edit the consumer. Edit access is granted if the user has the 'administer consumers' permission or may edit the account connected to the consumer.

Parameters

DrupalOAuthConsumer $consumer:

Return value

bool

1 call to oauth_common_can_edit_consumer()
oauth_common_page_user_consumers in ./oauth_common.consumers.inc
Menu system callback for listing a user's consumers.
1 string reference to 'oauth_common_can_edit_consumer'
oauth_common_providerui_menu in ./oauth_common_providerui.module
Implements hook_menu().

File

./oauth_common.module, line 330

Code

function oauth_common_can_edit_consumer($consumer) {
  $may_edit = user_access('administer consumers');

  // If the user doesn't have consumer admin privileges, check for account
  // edit access.
  if (!$may_edit && $consumer->uid) {
    $user = user_load($consumer->uid);
    $may_edit = user_edit_access($user);
  }
  return $may_edit;
}