You are here

public static function UserRestrictions::exists in User restrictions 7

File

./user_restrictions.classes.inc, line 109
Contains the classes used by the User restrictions module.

Class

UserRestrictions
The main class used by the User Restrictions module.

Code

public static function exists($array) {
  $query = db_select('user_restrictions', 'ur')
    ->fields('ur', array(
    'urid',
  ))
    ->where('type = :type AND LOWER(:mask) = LOWER(mask)', array(
    ':type' => $array['type'],
    ':mask' => $array['mask'],
  ));
  if (isset($array['subtype'])) {
    $query
      ->condition('subtype', $array['subtype']);
  }
  return (bool) $query
    ->execute()
    ->fetchField();
}