Skip to content

Commit

Permalink
Implement NewHandlerDisallowed exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed Feb 25, 2012
1 parent 1cc17fc commit d421c96
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions application/MantisBT/Exception/Issue/NewHandlerDisallowed.php
@@ -0,0 +1,13 @@
<?php
namespace MantisBT\Exception\Issue;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class NewHandlerDisallowed extends ExceptionAbstract {
public function __construct() {
$errorMessage = lang_get(ERROR_USER_DOES_NOT_HAVE_REQ_ACCESS, null, false);
parent::__construct(ERROR_USER_DOES_NOT_HAVE_REQ_ACCESS, $errorMessage, null);
$this->responseCode = 400;
}
}
3 changes: 2 additions & 1 deletion application/core/bug_api.php
Expand Up @@ -53,6 +53,7 @@
use MantisBT\Exception\Field\EmptyField;
use MantisBT\Exception\Issue\IssueDuplicateSelf;
use MantisBT\Exception\Issue\IssueNotFound;
use MantisBT\Exception\Issue\NewHandlerDisallowed;

require_api( 'access_api.php' );
require_api( 'authentication_api.php' );
Expand Down Expand Up @@ -1444,7 +1445,7 @@ function bug_assign( $p_bug_id, $p_user_id, $p_bugnote_text = '', $p_bugnote_pri
$c_user_id = db_prepare_int( $p_user_id );

if(( $c_user_id != NO_USER ) && !access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug_id, $p_user_id ) ) {
trigger_error( ERROR_USER_DOES_NOT_HAVE_REQ_ACCESS );
throw new NewHandlerDisallowed();
}

# extract current information into history variables
Expand Down

0 comments on commit d421c96

Please sign in to comment.