protected function _get_user_info()
 {
     static $info = NULL;
     if (NULL !== $info) {
         return $info;
     }
     $info = array();
     if ($user = reason_check_authentication()) {
         $dir = new directory_service();
         $dir->search_by_attribute('ds_username', array($user), array('ds_username', 'ds_fullname', 'carlcohortyear'));
         $info = $dir->get_first_record();
     }
     return $info;
 }
 function get_user_can_delete($id)
 {
     if ($id && $this->allow_contact_to_delete) {
         if ($item = new entity($id)) {
             if ($user_netid = reason_check_authentication()) {
                 $dir = new directory_service();
                 $dir->search_by_attribute('ds_username', $user_netid, array('ds_email'));
                 $record = $dir->get_first_record();
                 if (in_array($item->get_value('classified_contact_email'), $record['ds_email'])) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
Example #3
0
	/**
	 * Live person search
	 *
	 * @todo broaden to do more than just first record
	 */
	function &find_one_person($search_field, $search_value, $attributes = NULL)
	{
		$dir = new directory_service();
		if ($attributes) $dir->search_by_attribute($search_field, $search_value, $attributes);
		else $dir->search_by_attribute($search_field, $search_value);
		$result = $dir->get_first_record();
		return $result;
	}
Example #4
0
 function look_up_dir_reason_diffs()
 {
     // these are the people in Reason but not in the directory
     $to_lookup = array_diff(array_keys($this->reason_netids), array_keys($this->directory_netids));
     // get LDAP info for those people
     foreach ($to_lookup as $username) {
         $dir = new directory_service();
         $filter = $this->build_person_filter($username);
         if ($dir->search_by_filter($filter, $this->required_attributes)) {
             $this->reason_people_dir_info[$username] = $dir->get_first_record();
         }
     }
 }