private function forwardToDefault() { global $ilCtrl, $lng; $is_vendor = ilPaymentVendors::_isVendor($this->user_obj->getId()); $has_stat_perm = ilPaymentTrustees::_hasStatisticPermission($this->user_obj->getId()); $has_obj_perm = ilPaymentTrustees::_hasObjectPermission($this->user_obj->getId()); $has_coup_perm = ilPaymentTrustees::_hasCouponsPermission($this->user_obj->getId()); if ($is_vendor || $has_stat_perm) { $ilCtrl->redirectByClass('ilpaymentstatisticgui'); } else { if ($has_obj_perm) { $ilCtrl->redirectByClass('ilpaymentobjectgui'); } else { if ($has_coup_perm) { $ilCtrl->redirectByClass('ilpaymentcoupongui'); } } } ilUtil::sendInfo($lng->txt("no_permission")); return false; }
public function performDeleteVendorsObject() { include_once './Services/Payment/classes/class.ilPaymentTrustees.php'; global $rbacsystem; // MINIMUM ACCESS LEVEL = 'read' if (!$rbacsystem->checkAccess('write', $this->object->getRefId())) { $this->ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $this->ilErr->MESSAGE); } foreach ($_SESSION['pays_vendor'] as $vendor) { $this->vendors_obj->delete($vendor); ilPaymentTrustees::_deleteTrusteesOfVendor($vendor); } ilUtil::sendInfo($this->lng->txt('pays_deleted_number_vendors') . ' ' . count($_SESSION['pays_vendor'])); unset($_SESSION['pays_vendor']); if ($_SESSION['disable_shop'] == true) { $this->genSetData->set('shop_enabled', 0, 'common'); $_SESSION['disable_shop'] = false; } $this->vendorsObject(); return true; }
private function buildTabs() { global $ilTabs, $ilUser; // $shop_obj = new ilPaymentShoppingCart($ilUser); $obj = ilPaymentSettings::_getInstance(); $allSet = $obj->getAll(); $ilTabs->addTarget('content', $this->ctrl->getLinkTargetByClass('ilshopgui', 'firstpage'), '', '', ''); if (!(bool) $allSet['hide_advanced_search']) { $ilTabs->addTarget('advanced_search', $this->ctrl->getLinkTargetByClass('ilshopadvancedsearchgui'), '', '', ''); } if (!(bool) $allSet['hide_shop_info']) { $ilTabs->addTarget('shop_info', $this->ctrl->getLinkTargetByClass('ilshopinfogui'), '', '', ''); } if (!(bool) $allSet['hide_news']) { $ilTabs->addTarget('payment_news', $this->ctrl->getLinkTargetByClass('ilshopnewsgui'), '', '', ''); } if (ANONYMOUS_USER_ID != $ilUser->getId()) { if ((bool) ilPaymentSettings::_getInstance()->get('topics_allow_custom_sorting')) { $ilTabs->addTarget('pay_personal_settings', $this->ctrl->getLinkTargetByClass('ilshoppersonalsettingsgui'), '', '', ''); } // Only show if not empty $ilTabs->addTarget('paya_buyed_objects', $this->ctrl->getLinkTargetByClass('ilshopboughtobjectsgui'), '', '', ''); // Only show if user is vendor if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasAccess($ilUser->getId())) { $ilTabs->addTarget('paya_header', $this->ctrl->getLinkTargetByClass('ilpaymentadmingui'), '', '', ''); } } // Only show cart if not empty $ilTabs->addTarget('paya_shopping_cart', $this->ctrl->getLinkTargetByClass('ilshopshoppingcartgui'), '', '', ''); $ilTabs->addTarget('terms_conditions', $this->ctrl->getLinkTargetByClass(array('iltermsconditionsgui'), '')); }
public function __getVendorIds() { if (ilPaymentVendors::_isVendor($this->user_id)) { $vendors[] = $this->user_id; } $vend = ilPaymentTrustees::_getVendorsForStatisticsByTrusteeId($this->user_id); if (isset($vend)) { foreach ($vend as $v) { if (ilPaymentTrustees::_hasStatisticPermissionByVendor($this->user_id, $v)) { $vendors[] = $v; } } } return $vendors ? $vendors : array(); }
private function getVendorIds() { $vendors[] = $this->user_obj->getId(); if (ilPaymentVendors::_isVendor($this->user_obj->getId())) { $ptObj = new ilPaymentTrustees($this->user_obj); if ($trustees = $ptObj->getTrustees()) { foreach ($trustees as $trustee) { if ((bool) $trustee["perm_coupons"]) { $vendors[] = $trustee["trustee_id"]; } } } } if ($vend = ilPaymentTrustees::_getVendorsForCouponsByTrusteeId($this->user_obj->getId())) { foreach ($vend as $v) { $vendors[] = $v; if ($trustees = ilPaymentTrustees::_getTrusteesForCouponsByVendorId($v)) { foreach ($trustees as $t) { $vendors[] = $t; } } } } return $vendors ? $vendors : array(); }
public static function _hasAccess($a_ref_id, $a_transaction = 0, $a_subtype = '') { include_once './Services/Payment/classes/class.ilPaymentBookings.php'; include_once './Services/Payment/classes/class.ilPaymentTrustees.php'; include_once './Services/Payment/classes/class.ilPaymentVendors.php'; global $rbacsystem, $ilDB, $ilUser; // check write access if ($rbacsystem->checkAccess('write', $a_ref_id)) { return true; } // check if user is vendor/trustee $vendors_of_trustee = ilPaymentTrustees::_getVendorIdsByTrustee($ilUser->getId()); if (!IS_PAYMENT_ENABLED) { return true; } if ($a_subtype) { $result = $ilDB->queryf(' SELECT * FROM payment_objects WHERE ref_id = %s AND (status = %s or status = %s) AND subtype = %s', array('integer', 'integer', 'integer', 'text'), array($a_ref_id, '1', '2', $a_subtype)); } else { $result = $ilDB->queryf(' SELECT * FROM payment_objects WHERE ref_id = %s AND (status = %s OR status = %s) OR (vendor_id = %s)', array('integer', 'integer', 'integer', 'integer'), array($a_ref_id, '1', '2', $ilUser->getId())); } while ($row = $ilDB->fetchObject($result)) { if ($row->vendor_id == $ilUser->getId() || in_array($row->vendor_id, $vendors_of_trustee)) { return true; } else { if (!ilPaymentBookings::_hasAccess($row->pobject_id, '', $a_transaction)) { return false; } else { return true; } } } return false; }
private function __getVendors() { include_once 'Services/Payment/classes/class.ilPaymentVendors.php'; $options = array(); $vendors = array(); if (ilPaymentVendors::_isVendor($this->user_obj->getId())) { $vendors[] = $this->user_obj->getId(); } if ($vend = ilPaymentTrustees::_getVendorsForObjects($this->user_obj->getId())) { $vendors = array_merge($vendors, $vend); } foreach ($vendors as $vendor) { /** @var $tmp_obj ilObjUser */ $tmp_obj = ilObjectFactory::getInstanceByObjId($vendor, false); $options[$vendor] = $tmp_obj->getFullname() . ' [' . $tmp_obj->getLogin() . ']'; } return $options; }
protected function buildSubTabs() { global $ilUser, $ilTabs; switch ($this->getSection()) { case 6: if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasStatisticPermission($ilUser->getId())) { $ilTabs->addSubTabTarget('bookings', $this->ctrl->getLinkTargetByClass('ilpaymentstatisticgui'), '', '', ''); } if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasObjectPermission($ilUser->getId())) { $ilTabs->addSubTabTarget('paya_object', $this->ctrl->getLinkTargetByClass('ilpaymentobjectgui'), '', '', ''); } if (ilPaymentVendors::_isVendor($ilUser->getId())) { $ilTabs->addSubTabTarget('paya_trustees', $this->ctrl->getLinkTargetByClass('ilpaymenttrusteegui'), '', '', ''); } if (!(bool) $this->oGeneralSettings->get('hide_coupons')) { if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasCouponsPermission($ilUser->getId())) { $ilTabs->addSubTabTarget('paya_coupons_coupons', $this->ctrl->getLinkTargetByClass('ilpaymentcoupongui'), '', '', ''); } } break; default: break; } }
public static function _hasAccess($a_usr_id) { return ilPaymentTrustees::_hasStatisticPermission($a_usr_id) or ilPaymentTrustees::_hasObjectPermission($a_usr_id) or ilPaymentTrustees::_hasCouponsPermission($a_usr_id); }