You are here

function notifications_manage_subscriptions_access in Notifications 6.3

Same name and namespace in other branches
  1. 6.4 notifications.manage.inc \notifications_manage_subscriptions_access()
  2. 6 notifications.manage.inc \notifications_manage_subscriptions_access()
  3. 6.2 notifications.manage.inc \notifications_manage_subscriptions_access()
  4. 7 notifications.manage.inc \notifications_manage_subscriptions_access()

Check access for current user to manage subscriptions

Parameters

$sids: Array of subscription ids

3 calls to notifications_manage_subscriptions_access()
notifications_manage_subscriptions_form_validate in ./notifications.manage.inc
Validate notifications_admin_subscriptions form submissions.
notifications_multiple_delete_confirm in ./notifications.manage.inc
Form for multiple delete. When account passed check that all subscriptions belong to the user account
notifications_multiple_delete_confirm_validate in ./notifications.manage.inc
Validate permissions to delete all the subscriptions

File

./notifications.manage.inc, line 49
Common functions for bulk management of subscriptions

Code

function notifications_manage_subscriptions_access($sids) {
  global $user;
  if (user_access('administer notifications') || user_access('manage all subscriptions')) {
    return TRUE;
  }
  else {
    $params = array_merge(array(
      $user->uid,
    ), array_values($sids));
    $count = db_result(db_query("SELECT COUNT(*) FROM {notifications} WHERE uid = %d AND sid IN (" . db_placeholders($sids) . ')', $params));
    return $count == count($sids);
  }
}