You are here

function fb_autopost_entity_permission in Facebook Autopost 7

Implements hook_permission().

File

fb_autopost_entity/fb_autopost_entity.module, line 150
Module implementation file

Code

function fb_autopost_entity_permission() {
  $permissions = array(
    'administer facebook publication types' => array(
      'title' => t('Administer Facebook publication types'),
      'description' => t('Create and delete fields on Facebook publications, and set their permissions.'),
    ),
    'administer facebook publications' => array(
      'title' => t('Administer Facebook publications'),
      'description' => t('Edit and view all Facebook publications.'),
    ),
  );

  // Generate per Facebook publication type permissions.
  foreach (facebook_publication_get_types() as $type) {
    $type_name = check_plain($type->type);
    $permissions += array(
      "edit own {$type_name} facebook publication" => array(
        'title' => t('%type_name: Edit own Facebook publication', array(
          '%type_name' => $type->label,
        )),
      ),
      "edit any {$type_name} facebook publication" => array(
        'title' => t('%type_name: Edit any Facebook publication', array(
          '%type_name' => $type->label,
        )),
      ),
      "view own {$type_name} facebook publication" => array(
        'title' => t('%type_name: View own Facebook publication', array(
          '%type_name' => $type->label,
        )),
      ),
      "view any {$type_name} facebook publication" => array(
        'title' => t('%type_name: View any Facebook publication', array(
          '%type_name' => $type->label,
        )),
      ),
    );
  }
  return $permissions;
}