Skip to content

Commit

Permalink
Implement SponsorshipHandlerAccessDenied exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed Sep 17, 2011
1 parent 321d7e2 commit 4d14109
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
@@ -0,0 +1,13 @@
<?php
namespace MantisBT\Exception\Access;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class SponsorshipHandlerAccessDenied extends ExceptionAbstract {
public function __construct() {
$errorMessage = lang_get(ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, null, false);
parent::__construct(ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, $errorMessage, null);
$this->responseCode = 400;
}
}
3 changes: 2 additions & 1 deletion public/bug_change_status_page.php
Expand Up @@ -42,6 +42,7 @@


use MantisBT\Exception\Access\AccessDenied;
use MantisBT\Exception\Access\SponsorshipHandlerAccessDenied;

require_once( 'core.php' );
require_api( 'access_api.php' );
Expand Down Expand Up @@ -119,7 +120,7 @@

if ( $t_bug_sponsored ) {
if ( !access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id, $f_handler_id ) ) {
trigger_error( ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, ERROR );
throw new SponsorshipHandlerAccessDenied();
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion public/bug_update.php
Expand Up @@ -43,6 +43,7 @@
*/

use MantisBT\Exception\Access\AccessDenied;
use MantisBT\Exception\Access\SponsorshipHandlerAccessDenied;
use MantisBT\Exception\CustomField\CustomFieldInvalidValue;
use MantisBT\Exception\Field\EmptyField;
use MantisBT\Exception\Issue\IssueReadOnly;
Expand Down Expand Up @@ -187,7 +188,7 @@
if ( $t_existing_bug->handler_id !== $t_updated_bug->handler_id ) {
access_ensure_bug_level( config_get( 'update_bug_assign_threshold' ), $f_bug_id );
if ( $t_issue_is_sponsored && !access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id ) ) {
trigger_error( ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, ERROR );
throw new SponsorshipHandlerAccessDenied();
}
if ( $t_updated_bug->handler_id !== NO_USER ) {
if ( !access_has_bug_level( config_get( 'handle_bug_threshold' ), $f_bug_id, $t_updated_bug->handler_id ) ) {
Expand Down

0 comments on commit 4d14109

Please sign in to comment.