Esempio n. 1
0
 /**
  * Helper function that lists options for the person filter
  */
 public function get_person_options()
 {
     $qb_persons = midcom_db_person::new_query_builder();
     midcom_core_account::add_username_constraint($qb_persons, '<>', '');
     $person_array = array();
     $persons = $qb_persons->execute();
     foreach ($persons as $person) {
         $person_array[$person->id] = $person->get_label();
     }
     return $person_array;
 }
Esempio n. 2
0
 public static function get_person_by_formdata($data)
 {
     if (empty($data['username']) || empty($data['password'])) {
         return false;
     }
     midcom::get('auth')->request_sudo('org.openpsa.user');
     $qb = midcom_db_person::new_query_builder();
     midcom_core_account::add_username_constraint($qb, '=', $_POST['username']);
     $results = $qb->execute();
     midcom::get('auth')->drop_sudo();
     if (sizeof($results) != 1) {
         return false;
     }
     return $results[0];
 }