I would like to have a permission option to be able to give permission to change flickr key to some roles.
I need this because I am building a multisites "farm"; where I will create subsites for users and each subsite admin should be able to change their flickr key, despite they will not be uid=1 user.
This is easily achieved modifying very little code:

/**
 * Implement hook_menu
 */
function emfield_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/content/emfield',
      'title' => t('Embedded Media Field configuration'),
      'description' => t('Configure Embedded Media Field: Allow content types to use various 3rd party providers, enter API keys, etc.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'emfield_settings',
//      'access' => user_access('administer site configuration'), // ?¿?¿ modified 
      'access' => user_access('administer embeded media field'), // ?¿?¿
    );
    $items[] = array(
      'path' => 'admin/content/emfield/media',
      'title' => t('Media settings'),
      'description' => t('Configure Embedded Media Field: Allow content types to use various 3rd party providers, enter API keys, etc.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'emfield_settings',
      'access' => user_access('administer site configuration'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
  }
  return $items;
}

//?¿?¿ added
function emfield_perm() {
  return array('administer embeded media field');
}

Comments

enboig’s picture

I forgot to change the second "'access' => user_access('administer site configuration'),"; but the idea is here.

Having it in the "oficial" module would avoid me to have to remember about this every update I do, and it may also be usefull to other users.