function ad_access in Advertisement 6.3
Same name and namespace in other branches
- 5.2 ad.module \ad_access()
- 5 ad.module \ad_access()
- 6 ad.module \ad_access()
- 6.2 ad.module \ad_access()
- 7.2 ad.module \ad_access()
Implementation of hook_access().
4 calls to ad_access()
- ad_external_access in external/
ad_external.module - Implementation of hook_access().
- ad_html_access in html/
ad_html.module - Implementation of hook_access().
- ad_image_access in image/
ad_image.module - Implementation of hook_access().
- ad_text_access in text/
ad_text.module - Implementation of hook_access().
File
- ./
ad.module, line 474
Code
function ad_access($op, $node, $account) {
switch ($op) {
case 'create':
return user_access('create advertisements', $account) || user_access('administer advertisements');
case 'update':
return user_access('edit any advertisement', $account) || user_access('edit own advertisements', $account) && is_ad_owner($node->nid) || user_access('administer advertisements', $account);
case 'delete':
return user_access('delete any advertisement', $account) || user_access('delete own advertisements', $account) && is_ad_owner($node->nid) || user_access('administer advertisements', $account);
case 'view':
// Return false if user doesn't have basic permissions to view
// advertisements. Don't return true to let default Drupal
// domain/node access checks happen.
if (!user_access('show advertisements', $account) && !user_access('administer advertisements', $account)) {
return false;
}
}
}