You are here

function oauth_common_can_create_consumers in OAuth 1.0 7.3

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

Deterines if a user has the necessary permissions to create consumers.

Parameters

object $account: The user account to check permissions for. Defaults to the currently logged in user.

Return value

bool

1 string reference to 'oauth_common_can_create_consumers'
oauth_common_providerui_menu in ./oauth_common_providerui.module
Implements hook_menu().

File

./oauth_common.module, line 351

Code

function oauth_common_can_create_consumers($account = NULL) {
  global $user;
  if (!$account) {
    $account = $user;
  }
  $can_register_consumers = user_access('oauth register any consumers', $account);
  if (!$can_register_consumers) {
    foreach (oauth_common_context_list() as $context => $title) {
      $can_register_consumers = $can_register_consumers || user_access(sprintf('oauth register consumers in %s', $context), $account);
    }
  }
  return $can_register_consumers;
}