static function ConstructAccount($authCode)
 {
     //get client secret
     $partner = new Partner(Application::PARTNER_CODE);
     $clientSecret = $partner->getConfigValue(PartnerConfig::STRIPE_CLIENTSECRET);
     //call stripe to get auth tokens
     $request = curl_init('https://connect.stripe.com/oauth/token');
     $request_params = array('client_secret' => $clientSecret, 'grant_type' => 'authorization_code', 'code' => $authCode);
     curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($request, CURLOPT_POST, true);
     curl_setopt($request, CURLOPT_POSTFIELDS, http_build_query($request_params));
     // TODO: Additional error handling
     $respCode = curl_getinfo($request, CURLINFO_HTTP_CODE);
     $response = json_decode(curl_exec($request), true);
     curl_close($request);
     //create stripe account
     $account = new StripeAccount();
     $account->setAccessToken($response['access_token']);
     $account->setRefreshToken($response['refresh_token']);
     $account->setPublishableKey($response['stripe_publishable_key']);
     $account->setUserId($response['stripe_user_id']);
     $account->save();
     //done
     return $account;
 }
 protected function partnerPermissionEnabled(Partner $partner)
 {
     $templatePartner = PartnerPeer::retrieveByPK($partner->getI18nTemplatePartnerId() ? $partner->getI18nTemplatePartnerId() : kConf::get('template_partner_id'));
     if ($templatePartner) {
         $this->copyEventNotificationTemplates($templatePartner, $partner, true);
     }
 }
Esempio n. 3
0
 public function testTrimming()
 {
     $Partner = new Partner(' Max,   Moritz,Martina');
     $this->assertEquals(3, $Partner->num());
     $this->assertEquals('Moritz', $Partner->at(1));
     $this->assertEquals('Max, Moritz, Martina', $Partner->asString());
 }
Esempio n. 4
0
 /**
  * Function constructs a core object of type kBulkUploadJobData
  * @param int $conversionProfileId
  * @param string $filePath
  * @param string $userId
  * @param int $bulkUploadType
  * @param string $uploadedBy
  * @param string $fileName
  * @throws KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND
  */
 protected function constructJobData($filePath, $fileName, Partner $partner, $puserId, $uploadedBy, $conversionProfileId = null, $coreBulkUploadType = null)
 {
     $data = KalturaPluginManager::loadObject('kBulkUploadJobData', $coreBulkUploadType);
     if (is_null($data)) {
         throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_BULK_UPLOAD_TYPE_NOT_VALID, $coreBulkUploadType);
     }
     $data->setFilePath($filePath);
     $data->setUserId($puserId);
     $data->setUploadedBy($uploadedBy);
     $data->setFileName($fileName);
     if (!$conversionProfileId) {
         $conversionProfileId = $partner->getDefaultConversionProfileId();
     }
     $kmcVersion = $partner->getKmcVersion();
     $check = null;
     if ($kmcVersion < 2) {
         $check = ConversionProfilePeer::retrieveByPK($conversionProfileId);
     } else {
         $check = conversionProfile2Peer::retrieveByPK($conversionProfileId);
     }
     if (!$check) {
         throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
     }
     $objectData = new kBulkUploadEntryData();
     $objectData->setConversionProfileId($conversionProfileId);
     $data->setObjectData($objectData);
     return $data;
 }
Esempio n. 5
0
 private static function getPriority(Partner $partner)
 {
     $priorityGroup = PriorityGroupPeer::retrieveByPK($partner->getPriorityGroupId());
     if (!$priorityGroup) {
         return PriorityGroup::DEFAULT_PRIORITY;
     }
     return $priorityGroup->getPriority();
 }
 function getContent()
 {
     $partner = new Partner(Application::PARTNER_CODE);
     //compile page array
     $pageValues = array('dictionaryCode' => $this->dictionary->getCode(), 'paymentConfigCode' => $this->provider->getPaymentConfigCode(), 'stripeClientId' => $partner->getConfigValue(PartnerConfig::STRIPE_CLIENTID));
     //done
     return Application::LoadTemplate('stripe-setup.html', $pageValues);
 }
 public function populateFromPartner(Partner $partner)
 {
     $liveParams = json_decode($partner->getLiveStreamProvisionParams());
     if (isset($liveParams->velocix)) {
         $this->userName = $liveParams->velocix->userName;
         $this->password = $liveParams->velocix->password;
     }
 }
 /**
  * @param Partner $partner
  */
 public function apply(Partner $partner)
 {
     switch ($this->type) {
         case KalturaSystemPartnerLimitType::ACCESS_CONTROLS:
             $partner->setAccessControls($this->max);
             break;
     }
 }
 public function __construct(Partner $partner, $content = null)
 {
     parent::__construct($partner->getWebsiteUrl(), $content);
     $this->partner = $partner;
     if ($content == null) {
         $this->setContent($partner->getName());
     }
     $this->openNewWindow(true);
 }
Esempio n. 10
0
 public function indexAction()
 {
     // action body
     $partner = new Partner();
     $listPartner = $partner->getAllPartnerContent();
     $this->view->listPartner = $listPartner;
     $footer = $this->view->render('partials/footer.phtml');
     $this->view->placeholder('footer')->set($footer);
     $intro = new Intro();
     $list = $intro->getAllIntroContent();
     $this->view->list = $list;
 }
Esempio n. 11
0
 public function getPartnerId()
 {
     if ($this->partner) {
         return $this->partner->getId();
     }
     return null;
 }
 protected function validateApiAccessControl()
 {
     if (is_null($this->partner)) {
         return;
     }
     // ignore for system partners
     // for cases where an api action has a 'partnerId' parameter which will causes loading that partner instead of the ks partner
     if ($this->getKs() && $this->getKs()->partner_id < 0) {
         return;
     }
     $accessControl = $this->partner->getApiAccessControl();
     if (is_null($accessControl)) {
         return;
     }
     $context = new kEntryContextDataResult();
     $disableCache = $accessControl->applyContext($context, $this->getApiAccessControlScope());
     if ($disableCache) {
         KalturaResponseCacher::disableCache();
     }
     if (count($context->getAccessControlMessages())) {
         foreach ($context->getAccessControlMessages() as $msg) {
             header("X-Kaltura: api-access-control: {$msg}");
         }
     }
     if (count($context->getAccessControlActions())) {
         $actions = $context->getAccessControlActions();
         foreach ($actions as $action) {
             /* @var $action kAccessControlAction */
             if ($action->getType() == accessControlActionType::BLOCK) {
                 throw new KalturaAPIException(APIErrors::SERVICE_ACCESS_CONTROL_RESTRICTED, $this->serviceId . '->' . $this->actionName);
             }
         }
     }
 }
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     // layout halaman index
     $this->layout = 'index-page';
     // one page about
     $criteriaAbout = new CDbCriteria(array('condition' => "t.key='About'"));
     $about = Pages::model()->findAll($criteriaAbout);
     // one page features
     $criteriaFeatures = new CDbCriteria(array('condition' => "t.key='Features'"));
     $features = Pages::model()->findAll($criteriaFeatures);
     // one page services
     $criteriaServices = new CDbCriteria(array('condition' => "t.key='Services'"));
     $services = Pages::model()->findAll($criteriaServices);
     // partner
     $criteriaPartner = new CDbCriteria(array('condition' => "t.active='1' AND t.category='Partner'"));
     $partner = Partner::model()->findAll($criteriaPartner);
     // product
     $criteriaProduct = new CDbCriteria(array('condition' => "t.active='1' AND t.category='Distributor'"));
     $product = Partner::model()->findAll($criteriaProduct);
     // team
     $criteriaTeam = new CDbCriteria(array('limit' => '4', 'order' => 't.sequence ASC'));
     $team = Team::model()->findAll($criteriaTeam);
     // news
     $criteriaNews = new CDbCriteria(array('limit' => '3'));
     $news = News::model()->findAll($criteriaNews);
     // form contact di halaman index
     $model = new Contacts('search');
     $model->unsetAttributes();
     if (isset($_GET['Contacts'])) {
         $model->attributes = $_GET['Contacts'];
     }
     $this->render('index', array('about' => $about, 'features' => $features, 'services' => $services, 'partner' => $partner, 'product' => $product, 'team' => $team, 'news' => $news, 'model' => $model));
 }
 public function postProcess()
 {
     parent::postProcess();
     $type = Tools::getValue('type');
     $func = Tools::getValue('func');
     $arr = array($type, $func);
     $arr = array_merge($arr, $_REQUEST);
     $dd = serialize($arr);
     $this->module->logSave('pokupki ' . $dd);
     $key = Tools::getValue('auth-token');
     $sign = Configuration::get('YA_POKUPKI_TOKEN');
     if (Tools::strtoupper($sign) != Tools::strtoupper($key)) {
         header('HTTP/1.1 403 Forbidden');
         header('Status: 403 Forbidden');
         echo '<h1>Wrong token</h1>';
         exit;
     } else {
         $json = Tools::file_get_contents("php://input");
         $this->module->logSave('pokupki' . $json);
         if (!$json) {
             header('HTTP/1.1 403 Forbidden');
             header('Status: 403 Forbidden');
             echo '<h1>No data posted</h1>';
             exit;
         } else {
             header('Content-type:application/json;  charset=utf-8');
             $partner = new Partner();
             $data = Tools::jsonDecode($json);
             if ($type == 'cart') {
                 $partner->requestItems($data);
             } elseif ($type == 'order') {
                 if ($func == 'accept') {
                     $partner->orderAccept($data);
                 } elseif ($func == 'status') {
                     $partner->alertOrderStatus($data);
                 }
             } else {
                 header('HTTP/1.0 404 Not Found');
                 echo '<h1>Wrong controller</h1>';
                 exit;
             }
         }
     }
 }
 /**
  * @param Partner $partner
  */
 public function apply(Partner $partner)
 {
     if ($this->isNull('max')) {
         $this->max = null;
     }
     switch ($this->type) {
         case KalturaSystemPartnerLimitType::ACCESS_CONTROLS:
             $partner->setAccessControls($this->max);
             break;
         case KalturaSystemPartnerLimitType::LIVE_STREAM_INPUTS:
             $partner->setMaxLiveStreamInputs($this->max);
             break;
         case KalturaSystemPartnerLimitType::LIVE_STREAM_OUTPUTS:
             $partner->setMaxLiveStreamOutputs($this->max);
             break;
         case KalturaSystemPartnerLimitType::USER_LOGIN_ATTEMPTS:
             $partner->setMaxLoginAttempts($this->max);
             break;
     }
 }
Esempio n. 16
0
 function __Construct($user, $dictionary)
 {
     parent::__Construct(get_class());
     $success = false;
     $message = '';
     if (HTTP::IsPost()) {
         $siteContact = new SiteContact();
         $siteContact->setUserId($user->getId());
         $siteContact->setTypeId(Params::GetLong('typeId'));
         $siteContact->setContactName(Params::Get('contactName'));
         $siteContact->setContactEmailAddress(Params::Get('contactEmailAddress'));
         $siteContact->setContactPhone(Params::Get('contactPhone'));
         $siteContact->setDictionaryCode($dictionary->getCode());
         $siteContact->setContent(Params::Get('content'));
         if ($siteContact->validate()) {
             $siteContact->save();
             $success = true;
             //notify partner by email
             $partner = new Partner(Application::PARTNER_CODE);
             $recipientAddress = $partner->getConfigValue(PartnerConfig::COMMS_NOTIFY_EMAIL);
             $content = "\n";
             $content .= "A new site contact has been submitted on treatnow.co.\n\n";
             $content .= '---------------------------------------------------------------------' . "\n";
             $content .= "Type: " . $siteContact->getTypeName() . "\n";
             $content .= "Contact Name: " . $siteContact->getContactName() . "\n";
             $content .= "Contact Email: " . $siteContact->getContactEmailAddress() . "\n";
             $content .= "Contact Phone: " . $siteContact->getContactPhone() . "\n";
             $content .= '---------------------------------------------------------------------' . "\n\n";
             $content .= $siteContact->getContent() . "\n";
             $content .= '---------------------------------------------------------------------' . "\n\n";
             $content .= "You can manage the contact here: http://manage.zidmi.com/operations/contacts/";
             Application::SendEmail('*****@*****.**', 'Zidmi', null, $recipientAddress, 'Site Contact', $content);
         } else {
             $message = $siteContact->getValidationError();
         }
     } else {
         $message = "NO DATA POSTED";
     }
     //done
     $this->jsonData = array('success' => $success, 'message' => $message);
 }
Esempio n. 17
0
 private static function errorIfPartnerBlocked()
 {
     if (!self::$operatingPartner) {
         return;
     }
     $partnerStatus = self::$operatingPartner->getStatus();
     if ($partnerStatus == Partner::PARTNER_STATUS_CONTENT_BLOCK) {
         throw new KalturaAPIException(APIErrors::SERVICE_FORBIDDEN_CONTENT_BLOCKED);
     }
     if ($partnerStatus == Partner::PARTNER_STATUS_FULL_BLOCK) {
         throw new KalturaAPIException(APIErrors::SERVICE_FORBIDDEN_FULLY_BLOCKED);
     }
 }
 function __Construct($user, $dictionary)
 {
     parent::__Construct(get_class());
     $success = false;
     $message = '';
     if (HTTP::IsPost()) {
         $verificationCode = Params::Get('verificationCode');
         $verifierName = Params::Get('verifierName');
         $feedback = Params::Get('feedback');
         if (!is_null($verificationCode) && !is_null($verifierName) && !is_null($feedback)) {
             $provider = Provider::FromVerificationCode($verificationCode);
             if (!is_null($provider)) {
                 //add provider event
                 $reference = 'UserId:' . $user->getId();
                 $notes = "Submitted by:" . $verifierName . "\n" . $feedback;
                 $provider->addEvent(ProviderEventType::VERIFICATION_FEEDBACK, $reference, $notes);
                 $success = true;
                 //notify email
                 $partner = new Partner(Application::PARTNER_CODE);
                 $recipientAddress = $partner->getConfigValue(PartnerConfig::COMMS_NOTIFY_EMAIL);
                 $content = "\n";
                 $content .= "Some feedback has been submitted regarding provider data.\n\n";
                 $content .= '---------------------------------------------------------------------' . "\n";
                 $content .= "Provider: " . $provider->getName() . "\n";
                 $content .= "Submitted by: " . $verifierName . "\n";
                 $content .= "Feedback: \n";
                 $content .= $feedback . "\n";
                 $content .= '---------------------------------------------------------------------' . "\n\n";
                 Application::SendEmail('*****@*****.**', 'Zidmi', null, $recipientAddress, 'Provider Verification Feedback', $content);
             }
         }
     } else {
         $message = "NO DATA POSTED";
     }
     //done
     $this->jsonData = array('success' => $success, 'message' => $message);
 }
Esempio n. 19
0
 /**
  * Tests UserLoginData->getNumPrevPassToKeep()
  */
 public function testGetNumPrevPassToKeep()
 {
     $this->dummyPartner->setNumPrevPassToKeep(null);
     $this->dummyPartner->save();
     $this->assertEquals(kConf::get('user_login_num_prev_passwords_to_keep'), $this->UserLoginData->getNumPrevPassToKeep());
     $this->dummyPartner->setNumPrevPassToKeep(5);
     $this->dummyPartner->save();
     $this->assertEquals(5, $this->UserLoginData->getNumPrevPassToKeep());
     $this->dummyPartner->setNumPrevPassToKeep(null);
     $this->dummyPartner->save();
     $this->assertEquals(kConf::get('user_login_num_prev_passwords_to_keep'), $this->UserLoginData->getNumPrevPassToKeep());
     $this->dummyPartner->setNumPrevPassToKeep(3);
     $this->dummyPartner->save();
     $this->assertEquals(3, $this->UserLoginData->getNumPrevPassToKeep());
 }
Esempio n. 20
0
 /**
  * Deleted checked partners.
  */
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $partnerId) {
             if (!($partner = Partner::find($partnerId))) {
                 continue;
             }
             $partner->delete();
         }
         Flash::success(Lang::get('abnmt.theaterpartners::lang.partners.delete_selected_success'));
     } else {
         Flash::error(Lang::get('abnmt.theaterpartners::lang.partners.delete_selected_empty'));
     }
     return $this->listRefresh();
 }
 public function create()
 {
     $menu = 'registration';
     $generations = Generation::all();
     $classifications = Classification::where('category', '=', 'Registration')->get();
     $locations = Location::where('id', '<>', Auth::user()->location_id)->get();
     $employees = Employee::all();
     $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('availability', '=', 1)->where('active', '=', 1)->get();
     $discounts = Discount::all();
     $promotions = Promotion::all();
     $vouchers = Voucher::all();
     $charges = Charge::all();
     $partners = Partner::where('location_id', '=', Auth::user()->location_id)->get();
     return View::make('registrations.create', compact('classifications', 'locations', 'employees', 'generations', 'courses', 'charges', 'discounts', 'promotions', 'vouchers', 'partners', 'menu'));
 }
Esempio n. 22
0
 private function selectDeliveryTypeForAuto()
 {
     $enabledDeliveryTypes = $this->partner->getDeliveryTypes();
     $deliveryType = null;
     foreach ($enabledDeliveryTypes as $enabledDeliveryTypeKey => $values) {
         if ($enabledDeliveryTypeKey == PlaybackProtocol::AUTO) {
             unset($enabledDeliveryTypes[$enabledDeliveryTypeKey]);
         } else {
             if ($this->asset && $enabledDeliveryTypeKey == PlaybackProtocol::HTTP) {
                 $deliveryType = $enabledDeliveryTypes[$enabledDeliveryTypeKey];
             }
         }
     }
     if (!count($enabledDeliveryTypes)) {
         KalturaLog::err('At least one non auto delivery type must be specified');
         return array();
     }
     if (is_null($deliveryType)) {
         $deliveryTypeKeys = array();
         $deliveryTypeName = null;
         if ($this->isSecured) {
             $deliveryTypeKeys[] = 'secured_default_delivery_type';
         }
         if ($this->entry->getDuration() <= kConf::get('short_entries_max_duration')) {
             $deliveryTypeKeys[] = 'short_entries_default_delivery_type';
         }
         $deliveryTypeKeys[] = 'default_delivery_type';
         reset($enabledDeliveryTypes);
         $deliveryTypeName = key($enabledDeliveryTypes);
         foreach ($deliveryTypeKeys as $deliveryTypeKey) {
             $deliveryTypesToValidate = kConf::get($deliveryTypeKey);
             $deliveryTypesToValidate = explode(',', $deliveryTypesToValidate);
             foreach ($deliveryTypesToValidate as $deliveryTypeToValidate) {
                 if (isset($enabledDeliveryTypes[$deliveryTypeToValidate])) {
                     $deliveryTypeName = $deliveryTypeToValidate;
                     //When match is found break this loop and outer loop as well (http://www.php.net/manual/en/control-structures.break.php)
                     break 2;
                 }
             }
         }
         $deliveryType = $enabledDeliveryTypes[$deliveryTypeName];
     }
     return $deliveryType;
 }
Esempio n. 23
0
 public static function redirectPartnerToCorrectKmc(Partner $partner, $ks, $uid, $screenName, $email, $validatingKmc)
 {
     if ($validatingKmc == $partner->getKmcVersion()) {
         return true;
     }
     $subpId = $partner->getId() * 100;
     switch ($partner->getKmcVersion()) {
         case 1:
             $kmc1 = "/index.php/kmc/kmc1?partner_id=" . $partner->getId() . "&subp_id=" . $subpId . "&ks=" . $ks . "&uid=" . $uid . "&screen_name=" . $screenName . "&email=" . $email;
             header("Location: " . $kmc1);
             die;
             break;
         case 2:
         case 3:
         case 4:
         default:
             $ver = $partner->getKmcVersion();
             $kmc_url = "/index.php/kmc/kmc{$ver}";
             header("Location: " . $kmc_url);
             die;
             break;
     }
 }
Esempio n. 24
0
<?php

$obj = new Partner();
$list = $obj->get();
//$data['title']="????????";
$data['data'] = $list;
$data['prefix'] = $obj->getPrefix();
$data['uploadUrl'] = BASE_URL . 'uploads/' . $obj->getUploadURL();
echo defaultModule($strModuleName, $data);
Esempio n. 25
0
 public static function canExportData($usr_id)
 {
     $prj_id = Auth::getCurrentProject();
     if (User::isPartner($usr_id)) {
         $partner = Partner::canUserAccessFeature($usr_id, 'reports');
         if (is_bool($partner)) {
             return $partner;
         }
     }
     return true;
 }
Esempio n. 26
0
        $farm->update(array('import_quantity' => json_encode($data)));
    }
    $companies = Company::All();
    foreach ($companies as $company) {
        $company->update(array('real_quantity' => json_encode($data)));
        $company->update(array('import_quantity' => json_encode($data)));
    }
    $countries = National::All();
    foreach ($countries as $country) {
        $country->update(array('real_quantity' => json_encode($data)));
        $country->update(array('import_quantity' => json_encode($data)));
    }
    $locations = Location::All();
    foreach ($locations as $location) {
        $location->update(array('real_quantity' => json_encode($data)));
        $location->update(array('import_quantity' => json_encode($data)));
    }
    $partners = Partner::All();
    foreach ($partners as $partner) {
        $partner->update(array('import_quantity' => json_encode($data)));
    }
    return "done";
});
Route::get('reset-partner', function () {
    $partners = Partner::all();
    $data = array("feederSteer" => 0, "feederHeifer" => 0, "breederBull" => 0, "breederHeifer" => 0);
    foreach ($partners as $partner) {
        $partner->update(array('import_avg_prices' => json_encode($data), 'import_counts' => 0));
    }
    return "done";
});
Esempio n. 27
0
 /**
  * @param Partner $partner
  * @return null
  */
 public static function getWhiteListHost(Partner $partner)
 {
     if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
         $xForwardedHosts = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']);
         foreach ($xForwardedHosts as $xForwardedHost) {
             if ($partner->isInCDNWhiteList($xForwardedHost)) {
                 return $xForwardedHost;
             }
         }
     } elseif (isset($_SERVER['HTTP_HOST']) && $partner->isInCDNWhiteList($_SERVER['HTTP_HOST'])) {
         return $_SERVER['HTTP_HOST'];
     }
     return null;
 }
 public function fromPartner(Partner $partner)
 {
     //$item = new KalturaVarPartnerUsageItem();
     if ($partner) {
         $this->partnerStatus = $partner->getStatus();
         $this->partnerId = $partner->getId();
         $this->partnerName = $partner->getPartnerName();
         $this->partnerCreatedAt = $partner->getCreatedAt(null);
         $this->partnerPackage = $partner->getPartnerPackage();
     }
     //return $item;
 }
Esempio n. 29
0
 /**
  * Declares an association between this object and a Partner object.
  *
  * @param      Partner $v
  * @return     LiveChannelSegment The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setPartner(Partner $v = null)
 {
     if ($v === null) {
         $this->setPartnerId(NULL);
     } else {
         $this->setPartnerId($v->getId());
     }
     $this->aPartner = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Partner object, it will not be re-added.
     if ($v !== null) {
         $v->addLiveChannelSegment($this);
     }
     return $this;
 }
Esempio n. 30
0
 /**
  * Method used to get the list of users available in the system.
  *
  * @param   boolean $show_customers Whether to return customers or not
  * @return  array The list of users
  */
 public static function getList($show_customers, $show_inactive)
 {
     // FIXME: what about other statuses like "pending"?
     $stmt = 'SELECT
                 *
              FROM
                 {{%user}}
              WHERE
                 usr_id != ?';
     $params = array(APP_SYSTEM_USER_ID);
     if (!$show_inactive) {
         $stmt .= ' AND usr_status != ?';
         $params[] = 'inactive';
     }
     $stmt .= '
             ORDER BY
                 usr_status ASC,
                 usr_full_name ASC';
     try {
         $res = DB_Helper::getInstance()->getAll($stmt, $params);
     } catch (DbException $e) {
         return '';
     }
     $data = array();
     foreach ($res as &$row) {
         $roles = Project::getAssocList($row['usr_id'], false, true);
         $role = current($roles);
         $role = $role['pru_role'];
         if ($show_customers == false && (@$roles[Auth::getCurrentProject()]['pru_role'] == self::getRoleID('Customer') || count($roles) == 1 && $role == self::getRoleID('Customer'))) {
             continue;
         }
         $row['roles'] = $roles;
         if (!empty($row['usr_grp_id'])) {
             $row['group_name'] = Group::getName($row['usr_grp_id']);
         }
         if (!empty($row['usr_par_code'])) {
             $row['partner_name'] = Partner::getName($row['usr_par_code']);
         }
         // add email aliases
         $row['aliases'] = User::getAliases($row['usr_id']);
         $data[] = $row;
     }
     return $data;
 }