Revision 1298:4f746d8966dd extra

View differences:

extra/mail_handler/rdm-mailhandler.rb
23 23
end
24 24

  
25 25
class RedmineMailHandler
26
  VERSION = '0.2.1'
26
  VERSION = '0.2.3'
27 27

  
28
  attr_accessor :verbose, :issue_attributes, :allow_override, :unknown_user, :no_permission_check, :url, :key, :no_check_certificate
28
  attr_accessor :verbose, :issue_attributes, :allow_override, :unknown_user, :default_group, :no_permission_check,
29
    :url, :key, :no_check_certificate, :no_account_notice, :no_notification
29 30

  
30 31
  def initialize
31 32
    self.issue_attributes = {}
......
40 41
      opts.on("-k", "--key KEY",              "Redmine API key") {|v| self.key = v}
41 42
      opts.separator("")
42 43
      opts.separator("General options:")
43
      opts.on("--unknown-user ACTION",        "how to handle emails from an unknown user",
44
                                              "ACTION can be one of the following values:",
45
                                              "* ignore: email is ignored (default)",
46
                                              "* accept: accept as anonymous user",
47
                                              "* create: create a user account") {|v| self.unknown_user = v}
48 44
      opts.on("--no-permission-check",        "disable permission checking when receiving",
49 45
                                              "the email") {self.no_permission_check = '1'}
50 46
      opts.on("--key-file FILE",              "path to a file that contains the Redmine",
......
56 52
      opts.on("-v", "--verbose",              "show extra information") {self.verbose = true}
57 53
      opts.on("-V", "--version",              "show version information and exit") {puts VERSION; exit}
58 54
      opts.separator("")
55
      opts.separator("User creation options:")
56
      opts.on("--unknown-user ACTION",        "how to handle emails from an unknown user",
57
                                              "ACTION can be one of the following values:",
58
                                              "* ignore: email is ignored (default)",
59
                                              "* accept: accept as anonymous user",
60
                                              "* create: create a user account") {|v| self.unknown_user = v}
61
      opts.on("--default-group GROUP",        "add created user to GROUP (none by default)",
62
                                              "GROUP can be a comma separated list of groups") { |v| self.default_group = v}
63
      opts.on("--no-account-notice",          "don't send account information to the newly",
64
                                              "created user") { |v| self.no_account_notice = '1'}
65
      opts.on("--no-notification",            "disable email notifications for the created",
66
                                              "user") { |v| self.no_notification = '1'}
67
      opts.separator("")
59 68
      opts.separator("Issue attributes control options:")
60 69
      opts.on("-p", "--project PROJECT",      "identifier of the target project") {|v| self.issue_attributes['project'] = v}
61 70
      opts.on("-s", "--status STATUS",        "name of the target status") {|v| self.issue_attributes['status'] = v}
......
95 104
    data = { 'key' => key, 'email' => email,
96 105
                           'allow_override' => allow_override,
97 106
                           'unknown_user' => unknown_user,
107
                           'default_group' => default_group,
108
                           'no_account_notice' => no_account_notice,
109
                           'no_notification' => no_notification,
98 110
                           'no_permission_check' => no_permission_check}
99 111
    issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value }
100 112

  
101 113
    debug "Posting to #{uri}..."
102
    response = Net::HTTPS.post_form(URI.parse(uri), data, headers, :no_check_certificate => no_check_certificate)
114
    begin
115
      response = Net::HTTPS.post_form(URI.parse(uri), data, headers, :no_check_certificate => no_check_certificate)
116
    rescue SystemCallError => e # connection refused, etc.
117
      warn "An error occured while contacting your Redmine server: #{e.message}"
118
      return 75 # temporary failure
119
    end
103 120
    debug "Response received: #{response.code}"
104 121

  
105 122
    case response.code.to_i
extra/sample_plugin/test/integration/routing_test.rb
1 1

  
2 2
require File.expand_path(File.dirname(__FILE__) + '../../../../../test/test_helper')
3 3

  
4
class SamplePluginRoutingTest < ActionController::IntegrationTest
4
class SamplePluginRoutingTest < ActionDispatch::IntegrationTest
5 5
  def test_example
6 6
    assert_routing(
7 7
        { :method => 'get', :path => "/projects/1234/hello" },
extra/svn/Redmine.pm
388 388
    $sth->execute($project_id);
389 389
    my $ret = 0;
390 390
    if (my @row = $sth->fetchrow_array) {
391
    	if ($row[0] eq "1" || $row[0] eq "t") {
392
    		$ret = 1;
393
    	}
391
      if ($row[0] eq "1" || $row[0] eq "t") {
392
        $ret = 1;
393
      }
394 394
    }
395 395
    $sth->finish();
396 396
    undef $sth;
......
467 467
      }
468 468

  
469 469
      unless ($auth_source_id) {
470
	  			my $method = $r->method;
470
          my $method = $r->method;
471 471
          my $salted_password = Digest::SHA::sha1_hex($salt.$pass_digest);
472
					if ($hashed_password eq $salted_password && (($access_mode eq "R" && $permissions =~ /:browse_repository/) || $permissions =~ /:commit_access/) ) {
472
          if ($hashed_password eq $salted_password && (($access_mode eq "R" && $permissions =~ /:browse_repository/) || $permissions =~ /:commit_access/) ) {
473 473
              $ret = 1;
474 474
              last;
475 475
          }

Also available in: Unified diff