You are here

function notifications_access_subscription in Notifications 7

Menu access callback. Access subscription forms for given subscription

1 string reference to 'notifications_access_subscription'
notifications_menu in ./notifications.module
Implementation of hook_menu().

File

./notifications.module, line 289
Notifications module

Code

function notifications_access_subscription($subscription, $op = 'view', $account = NULL) {
  $account = $account ? $account : $GLOBALS['user'];
  if (user_access('administer notifications') || user_access('manage all subscriptions')) {
    return TRUE;
  }
  switch ($op) {
    case 'view':
      return $subscription->uid && $subscription->uid == $account->uid;
    case 'edit':
    case 'delete':
    case 'unsubscribe':
      return $subscription->uid && $subscription->uid == $account->uid && user_access('maintain own subscriptions');
  }
  return FALSE;
}