You are here

function notifications_user_allowed in Notifications 6

Same name and namespace in other branches
  1. 5 notifications.module \notifications_user_allowed()
  2. 6.4 notifications.module \notifications_user_allowed()
  3. 6.2 notifications.module \notifications_user_allowed()
  4. 6.3 notifications.module \notifications_user_allowed()

Check access to objects

This will check permissions for subscriptions and events before subscribing and before getting updates.

Parameters

$type: Type of object to check for access. Possible values:

  • 'event', will check access to event objects
  • 'subscription', will check access to subscribed objects
4 calls to notifications_user_allowed()
NotificationsContentTests::testNotificationsContent in tests/notifications_content.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_page_subscribe in ./notifications.pages.inc
Menu callback add subscription
notifications_process_rows in ./notifications.cron.inc
Process rows given query conditions
notifications_ui_subscribe_options in notifications_ui/notifications_ui.module
Get list of possible and existing subscriptions for user/object

File

./notifications.module, line 1306
Notifications module

Code

function notifications_user_allowed($type, $account, $object = NULL) {

  // Invoke notifications hook and check for a FALSE return value
  $permissions = notifications_module_information('access', $type, $account, $object);
  if ($permissions) {
    return !in_array(FALSE, $permissions);
  }
  else {

    // If no module has anthing to say about access I guess it will be true
    return TRUE;
  }
}