I have deliberately left copy editing & translate out of scope & focussed on a specific narrow pattern
if ($activityId &&
!CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::VIEW)
) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
$session = CRM_Core_Session::singleton();
if ($this->_id && in_array($this->_gName, CRM_Core_OptionGroup::$_domainIDGroups)) {
$domainID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $this->_id, 'domain_id', 'id');
if (CRM_Core_Config::domainID() != $domainID) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
}
}
* Browse all Scheduled Reminders settings.
*
* @param null $action
+ *
+ * @throws \CRM_Core_Exception
*/
public function browse($action = NULL) {
//CRM-16777: Do not permit access to user, for page 'Administer->Communication->Schedule Reminder',
//when do not have 'administer CiviCRM' permission.
if (!CRM_Core_Permission::check('administer CiviCRM')) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
// Get list of configured reminders
CRM_Core_Error::fatal('Petition doesn\'t exist.');
}
if ($this->petition['is_active'] == 0) {
- CRM_Core_Error::fatal('Petition is no longer active.');
+ CRM_Core_Error::statusBounce('Petition is no longer active.');
}
//get userID from session
/**
* Set variables up before form is built.
+ *
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
if ($this->_id && in_array($this->_gName, CRM_Core_OptionGroup::$_domainIDGroups)) {
$domainID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $this->_id, 'domain_id', 'id');
if (CRM_Core_Config::domainID() != $domainID) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
}
}
if ($activityID &&
!CRM_Activity_BAO_Activity::checkPermission($activityID, CRM_Core_Action::VIEW)
) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
$this->assign('contactID', $contactID);
//check for civicase access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
- CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You are not authorized to access this page.'));
}
//validate case configuration.
/**
* Build all the data structures needed to build the form.
+ *
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
if (!CRM_Core_Permission::checkActionPermission('CiviCase', CRM_Core_Action::DELETE)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
parent::preProcess();
}
public function preProcess() {
//check for civicase access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
- CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You are not authorized to access this page.'));
}
//validate case configuration.
if (!CRM_Core_Permission::check('access all cases and activities')) {
$userCases = CRM_Case_BAO_Case::getCases(FALSE, ['type' => 'any']);
if (!array_key_exists($this->_id, $userCases)) {
- CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You are not authorized to access this page.'));
}
}
}
}
elseif ($this->_contactId != $userID && !$validUser) {
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::VIEW)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this contact.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this contact.'));
}
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
$this->_edit = FALSE;
public function preProcess() {
// Check permission for action.
if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
- // @todo replace with throw new CRM_Core_Exception().
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
parent::preProcess();
$financialTypeID = CRM_Contribute_PseudoConstant::financialType($this->_values['financial_type_id']);
CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($this->_id, 'edit');
if (!CRM_Core_Permission::check('edit contributions of type ' . $financialTypeID)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
}
$allPanes = [];
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
&& !CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($this->_values['financial_type_id']))
) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
if (empty($this->_values['is_active'])) {
throw new CRM_Contribute_Exception_InactiveContributionPageException(ts('The page you requested is currently unavailable.'), $this->_id);
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && $this->_action & CRM_Core_Action::UPDATE) {
$financialTypeID = CRM_Contribute_PseudoConstant::financialType($this->_values['financial_type_id']);
if (!CRM_Core_Permission::check('edit contributions of type ' . $financialTypeID)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
}
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
$dao = new CRM_Contribute_DAO_Contribution();
public function preProcess() {
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviContribute', CRM_Core_Action::DELETE)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
parent::preProcess();
}
if ($id) {
if (!$this->checkPermission($id, NULL)) {
- CRM_Core_Error::fatal(ts('You do not have permission to make changes to the record'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to make changes to the record'));
}
}
//check for civicase access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
- CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You are not authorized to access this page.'));
}
$controller = new CRM_Core_Controller_Simple('CRM_Case_Form_Search',
public function run() {
//check for civicase access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
- CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You are not authorized to access this page.'));
}
$summary = CRM_Case_BAO_Case::getCasesSummary(TRUE);
//check for civicase access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
- CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You are not authorized to access this page.'));
}
$controller = new CRM_Core_Controller_Simple('CRM_Case_Form_Search',
/**
* Set variables up before form is built.
+ *
+ * @throws \CiviCRM_API3_Exception
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
parent::preProcess();
}
if (!CRM_Event_BAO_Event::checkPermission($this->_id, CRM_Core_Permission::DELETE)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
}
&& CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
&& !CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($this->_values['event']['financial_type_id']))
) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
$this->checkValidEvent($infoUrl);
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviEvent', CRM_Core_Action::DELETE)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
parent::preProcess();
foreach ($this->_participantIds as $participantId) {
'participant_listing_id'
);
if (!$this->_participantListingID) {
- CRM_Core_Error::fatal(ts('The Participant Listing feature is not currently enabled for this event.'));
+ CRM_Core_Error::statusBounce(ts('The Participant Listing feature is not currently enabled for this event.'));
}
// retrieve Event Title and include it in page title
'participant_listing_id'
);
if (!$this->_participantListingID) {
- CRM_Core_Error::fatal(ts("The Participant Listing feature is not currently enabled for this event."));
+ CRM_Core_Error::statusBounce(ts("The Participant Listing feature is not currently enabled for this event."));
}
// retrieve Event Title and include it in page title
/**
* Set variables up before form is built.
+ *
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
// Check permission for Financial Type when ACL-FT is enabled
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
&& !CRM_Core_Permission::check('administer CiviCRM Financial Types')
) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
parent::preProcess();
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
&& !CRM_Core_Permission::check('administer CiviCRM Financial Types')
) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
// get all financial types sorted by weight
$financialType = [];
);
if (empty($values['is_tellfriend_enabled'])) {
- CRM_Core_Error::fatal(ts('Tell Friend is disable for this Personal Campaign Page'));
+ CRM_Core_Error::statusBounce(ts('Tell Friend is disable for this Personal Campaign Page'));
}
$this->_mailLimit = $values['tellfriend_limit'];
$this->assign('pcpTitle', $this->_title);
}
else {
- CRM_Core_Error::fatal(ts('page argument missing or invalid'));
+ CRM_Core_Error::statusBounce(ts('page argument missing or invalid'));
}
$this->assign('context', $pcomponent);
//check permission for action.
if (!CRM_Core_Permission::checkActionPermission('CiviGrant', $this->_action)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
$this->setPageTitle(ts('Grant'));
//check permission for delete.
if (!CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::DELETE)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
}
//check permission for update.
if (!CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::UPDATE)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
}
public function preProcess() {
// Check for edit permission.
if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
if (!CRM_Member_BAO_Membership::statusAvailabilty()) {
// all possible statuses are disabled - redirect back to contact form
public function preProcess() {
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviMember', CRM_Core_Action::DELETE)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
parent::preProcess();
}
/**
* Set variables up before form is built.
+ *
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
// check for edit permission
if (!CRM_Core_Permission::check('edit pledges')) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
$this->_id = CRM_Utils_Request::retrieve('ppId', 'Positive', $this);
/**
* Set variables up before form is built.
+ *
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
// check for action permissions.
if (!CRM_Core_Permission::checkActionPermission('CiviPledge', $this->_action)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
$this->assign('action', $this->_action);
public function preProcess() {
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
parent::preProcess();
}
* The price set id.
*
* @return bool
+ * @throws \CRM_Core_Exception
*/
public static function checkPermission($sid) {
if ($sid && self::eventPriceSetDomainID()) {
$domain_id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $sid, 'domain_id', 'id');
if (CRM_Core_Config::domainID() != $domain_id) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
}
return TRUE;
],
];
if (!CRM_Core_Permission::check($checkPermission)) {
- CRM_Core_Error::fatal(ts('Permission Denied'));
+ CRM_Core_Error::statusBounce(ts('Permission Denied'));
}
$content = json_decode($_REQUEST['ufData'], TRUE);
foreach (['ufGroup', 'ufFieldCollection'] as $key) {
* @param
*
* @return void
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
// Inline forms don't get menu-level permission checks
if (!CRM_Core_Permission::check('access CiviCRM')) {
- CRM_Core_Error::fatal(ts('Permission Denied'));
+ CRM_Core_Error::statusBounce(ts('Permission Denied'));
}
$gid = CRM_Utils_Request::retrieve('id', 'Positive');
$fields = CRM_Core_BAO_UFGroup::getFields($gid, FALSE, NULL, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, 'field_name', NULL, TRUE);
/**
* Check method testcheckPermissionedLineItems()
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function testcheckPermissionedLineItems() {
+ public function testCheckPermissionedLineItems() {
$contactId = $this->individualCreate();
$paramsSet['title'] = 'Price Set' . substr(sha1(rand()), 0, 4);
$paramsSet['name'] = CRM_Utils_String::titleToVar($paramsSet['title']);
try {
CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($contributions->id, 'view');
- $this->fail("Missed expected exception");
+ $this->fail('Missed expected exception');
}
catch (Exception $e) {
- $this->assertEquals("A fatal error was triggered: You do not have permission to access this page.", $e->getMessage());
+ $this->assertEquals('A fatal error was triggered: You do not have permission to access this page.', $e->getMessage());
}
$this->setPermissions([