How do I create extra permissions for an eck created entity? I have created an entity using Entity Construction Kit (ECK) and wish to add extra permissions for that entity such as view own, edit own and delete own. I see there has been some movement in this thread Better Permissions and a few others to create better permissions in general for entities but I want to know how can I do it in my own custom module.

I do not want every person on the site to be able to view,edit,delete so I have disabled those perms for my created entity.

I'm stuck and cannot find any good documentation on it.
You need to alter the entity info using:


hook_entity_info_alter


and add the access callback

e.g:


function EXAMPLE_entity_info_alter(&amp;$entity_info) {
  $entity_info['my_entity']['access callback'] = 'my_entity_access';
}


and then in my_entity_access


function my_entity_access($op, $entity = NULL, $account = NULL) {
  switch($op){
    case 'view':
    // view check
    // e.g return user_access('view my_entity', $account);
    break;
    case 'create':
    // create check
    break;
    case 'update':
    // update check
    break;
    case 'delete':
    // delete check
    break;
  }
  return FALSE;
}


See node_access for more info

You may want to use hook_permission to define your own permissions also.