How to define custom permissions for organic groups? I would like to define some organic group permissions for a custom entity. The permissions should look like:

  $perms += array(
        "create $type content" =&gt; array(
          'title' =&gt; t('Create %type_name content', array('%type_name' =&gt; $name)),
        ),
        "update own $type content" =&gt; array(
          'title' =&gt; t('Edit own %type_name content', array('%type_name' =&gt; $name)),
        ),
        "update any $type content" =&gt; array(
          'title' =&gt; t('Edit any %type_name content', array('%type_name' =&gt; $name)),
        ),
        "delete own $type content" =&gt; array(
          'title' =&gt; t('Delete own %type_name content', array('%type_name' =&gt; $name)),
        ),
        "delete any $type content" =&gt; array(
          'title' =&gt; t('Delete any %type_name content', array('%type_name' =&gt; $name)),
        ),
      );


How do I do this? I found the function  og_get_permissions() to get all set permission, but how to modify this array?

Or may be it should be another way round? You set a normal drupal permission first with:

function custom_example_permission() {
  return array(
    'administer my module' =&gt; array(
      'title' =&gt; t('Administer my module'),
      'description' =&gt; t('Perform administration tasks for my module.'),
    ),
  );
}


And then make it eligible on the permission preferences page of OG? But how?
I found the solution here: 

/**
 * Implements hook_og_permission().
 */
function custom_permissions_og_permission() {
  $name = "taks";
  return array(
    'update own task content' =&gt; array(
      'title' =&gt; t('Update own %type_name content', array('%type_name' =&gt; $name)),
      'description' =&gt; t("Edit own %type_name content.", array('%type_name' =&gt; $name)),
      // Determine to which role to limit the permission. For example the
      // "subscribe" can't be assigned only to a non-member, as a member doesn't
      // need it.
      'roles' =&gt; array(OG_AUTHENTICATED_ROLE, OG_ADMINISTRATOR_ROLE),
      // Determine to which roles the permissions will be enabled by default.
      'default role' =&gt; array(OG_AUTHENTICATED_ROLE, OG_ADMINISTRATOR_ROLE),
    ),
    'update any task content' =&gt; array(
      'title' =&gt; t('Update any %type_name content', array('%type_name' =&gt; $name)),
      'description' =&gt; t("Edit any %type_name content.", array('%type_name' =&gt; $name)),
      'roles' =&gt; array(OG_AUTHENTICATED_ROLE, OG_ADMINISTRATOR_ROLE),
      'default role' =&gt; array(OG_ADMINISTRATOR_ROLE),
    ),
    'create new task content' =&gt; array(
      'title' =&gt; t('Create new %type_name content', array('%type_name' =&gt; $name)),
      'description' =&gt; t("Create new %type_name content.", array('%type_name' =&gt; $name)),
      'roles' =&gt; array(OG_AUTHENTICATED_ROLE, OG_ADMINISTRATOR_ROLE),
      'default role' =&gt; array(OG_ADMINISTRATOR_ROLE),
    ),
  );
}