/** * Checks if a user is in a group or groups * @param string|array $groups group name or an array of possible group names * @return boolean */ public function inGroup($group) { if (!is_array($group)) { $group = array($group); } $gg = Set::extract($this->groups()->get(), '*.attributes.name'); return count(array_intersect($gg, $group)) > 0; }