aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/websites/tools/git/mantisbt
diff options
context:
space:
mode:
Diffstat (limited to 'nixops/modules/websites/tools/git/mantisbt')
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-slack.json15
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration.json15
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration_Source.API.php.diff12
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/mantisbt.nix120
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/patches/bug_report.php.diff20
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/patches/bug_report_page.php.diff53
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add.php.diff20
-rw-r--r--nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add_inc.php.diff52
8 files changed, 307 insertions, 0 deletions
diff --git a/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-slack.json b/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-slack.json
new file mode 100644
index 0000000..54ea38b
--- /dev/null
+++ b/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-slack.json
@@ -0,0 +1,15 @@
1{
2 "tag": "9286d2e-master",
3 "meta": {
4 "name": "mantisbt-plugin-slack",
5 "url": "https://github.com/mantisbt-plugins/Slack",
6 "branch": "master"
7 },
8 "github": {
9 "owner": "mantisbt-plugins",
10 "repo": "Slack",
11 "rev": "9286d2eeeb8a986ed949e378711fef5f0bf182dc",
12 "sha256": "0nn0v4jc967giilkzrppi5svd04m2hnals75xxp0iabcdjnih0mn",
13 "fetchSubmodules": true
14 }
15}
diff --git a/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration.json b/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration.json
new file mode 100644
index 0000000..e36a68c
--- /dev/null
+++ b/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration.json
@@ -0,0 +1,15 @@
1{
2 "tag": "v2.1.5",
3 "meta": {
4 "name": "mantisbt-plugin-source-integration",
5 "url": "https://github.com/mantisbt-plugins/source-integration",
6 "branch": "refs/tags/v2.1.5"
7 },
8 "github": {
9 "owner": "mantisbt-plugins",
10 "repo": "source-integration",
11 "rev": "a48039a20abc50864e0e68c0c843b27058404386",
12 "sha256": "07g6q3hivmnd94r47pp0snk5bv4pa3piwclc9qhj612i4wnsazsk",
13 "fetchSubmodules": true
14 }
15}
diff --git a/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration_Source.API.php.diff b/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration_Source.API.php.diff
new file mode 100644
index 0000000..c355144
--- /dev/null
+++ b/nixops/modules/websites/tools/git/mantisbt/mantisbt-plugin-source-integration_Source.API.php.diff
@@ -0,0 +1,12 @@
1--- b/Source/Source.API.php 2017-09-18 00:50:32.000000000 +0200
2+++ a/Source/Source.API.php 2018-03-04 19:00:25.578889039 +0100
3@@ -452,6 +452,9 @@
4 # Allow other plugins to post-process commit data
5 event_signal( 'EVENT_SOURCE_COMMITS', array( $p_changesets ) );
6 event_signal( 'EVENT_SOURCE_FIXED', array( $t_fixed_bugs ) );
7+ foreach( $t_fixed_bugs as $t_bug_id => $t_changeset ) {
8+ event_signal( 'EVENT_BUG_ACTION', array('RESOLVE', $t_bug_id) );
9+ }
10 }
11
12 /**
diff --git a/nixops/modules/websites/tools/git/mantisbt/mantisbt.nix b/nixops/modules/websites/tools/git/mantisbt/mantisbt.nix
new file mode 100644
index 0000000..bc2ff3a
--- /dev/null
+++ b/nixops/modules/websites/tools/git/mantisbt/mantisbt.nix
@@ -0,0 +1,120 @@
1{ lib, env, writeText, stdenv, fetchurl, fetchedGithub }:
2let
3 mantisbt = let
4 plugins = {
5 slack = stdenv.mkDerivation (fetchedGithub ./mantisbt-plugin-slack.json // rec {
6 installPhase = ''
7 sed -i -e "s/return '@' . \\\$username;/return \\\$username;/" Slack.php
8 cp -a . $out
9 '';
10 });
11 source-integration = stdenv.mkDerivation (fetchedGithub ./mantisbt-plugin-source-integration.json // rec {
12 installPhase = ''
13 mkdir $out
14 patch -p1 < ${./mantisbt-plugin-source-integration_Source.API.php.diff}
15 cp -a Source* $out/
16 '';
17 });
18 };
19 in rec {
20 config =
21 writeText "config_inc.php" ''
22 <?php
23 $g_hostname = 'db-1.immae.eu';
24 $g_db_username = 'mantisbt';
25 $g_db_password = '${env.postgresql.password}';
26 $g_database_name = 'mantisbt';
27 $g_db_type = 'pgsql';
28 $g_crypto_master_salt = '${env.master_salt}';
29 $g_allow_signup = OFF;
30 $g_allow_anonymous_login = ON;
31 $g_anonymous_account = 'anonymous';
32
33 $g_phpMailer_method = PHPMAILER_METHOD_SMTP;
34 $g_smtp_host = 'mail.immae.eu';
35 $g_smtp_username = ''';
36 $g_smtp_password = ''';
37 $g_webmaster_email = 'webmaster@immae.eu';
38 $g_from_email = 'noreply@immae.eu';
39 $g_return_path_email = 'webmaster@immae.eu';
40 $g_from_name = 'Mantis Bug Tracker at immae.eu';
41 $g_email_receive_own = OFF;
42 # --- LDAP ---
43 $g_login_method = LDAP;
44 $g_ldap_protocol_version = 3;
45 $g_ldap_server = 'ldaps://ldap.immae.eu:636';
46 $g_ldap_root_dn = 'ou=users,dc=immae,dc=eu';
47 $g_ldap_bind_dn = 'cn=mantisbt,ou=services,dc=immae,dc=eu';
48 $g_ldap_bind_passwd = '${env.ldap.password}';
49 $g_use_ldap_email = ON;
50 $g_use_ldap_realname = ON;
51 $g_ldap_uid_field = 'uid';
52 $g_ldap_realname_field = 'cn';
53 $g_ldap_organization = '(memberOf=cn=users,cn=mantisbt,ou=services,dc=immae,dc=eu)';
54 '';
55 webRoot = stdenv.mkDerivation rec {
56 name = "mantisbt-${version}";
57 version = "2.11.1";
58 src = fetchurl {
59 url = "https://downloads.sourceforge.net/project/mantisbt/mantis-stable/${version}/${name}.tar.gz";
60 sha256 = "0jnrqz6r2hf53v0k1lh3il7hlfiphn61r9wgg6mzyywkjxwq07md";
61 };
62 patches = [
63 ./patches/bug_report.php.diff
64 ./patches/bug_report_page.php.diff
65 ./patches/bugnote_add.php.diff
66 ./patches/bugnote_add_inc.php.diff
67 ];
68 installPhase = ''
69 cp -a . $out
70 ln -s ${config} $out/config/config_inc.php
71 ln -s ${plugins.slack} $out/plugins/Slack
72 ln -s ${plugins.source-integration}/Source* $out/plugins/
73 '';
74 };
75 apache = {
76 user = "wwwrun";
77 group = "wwwrun";
78 modules = [ "proxy_fcgi" ];
79 vhostConf = ''
80 Alias /mantisbt "${webRoot}"
81 <Directory "${webRoot}">
82 DirectoryIndex index.php
83 <FilesMatch "\.php$">
84 SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
85 </FilesMatch>
86
87 AllowOverride All
88 Options FollowSymlinks
89 Require all granted
90 </Directory>
91 <Directory "${webRoot}/admin">
92 #Reenable during upgrade
93 Require all denied
94 </Directory>
95 '';
96 };
97 phpFpm = rec {
98 basedir = builtins.concatStringsSep ":" (
99 [ webRoot config ]
100 ++ lib.attrsets.mapAttrsToList (name: value: value) plugins);
101 socket = "/var/run/phpfpm/mantisbt.sock";
102 pool = ''
103 listen = ${socket}
104 user = ${apache.user}
105 group = ${apache.group}
106 listen.owner = ${apache.user}
107 listen.group = ${apache.group}
108 pm = ondemand
109 pm.max_children = 60
110 pm.process_idle_timeout = 60
111
112 php_admin_value[upload_max_filesize] = 5000000
113
114 php_admin_value[open_basedir] = "${basedir}:/tmp"
115 php_admin_value[session.save_path] = "/var/lib/php/sessions/mantisbt"
116 '';
117 };
118 };
119in
120 mantisbt
diff --git a/nixops/modules/websites/tools/git/mantisbt/patches/bug_report.php.diff b/nixops/modules/websites/tools/git/mantisbt/patches/bug_report.php.diff
new file mode 100644
index 0000000..a520043
--- /dev/null
+++ b/nixops/modules/websites/tools/git/mantisbt/patches/bug_report.php.diff
@@ -0,0 +1,20 @@
1--- a/bug_report.php 2018-02-10 21:29:27.000000000 +0100
2+++ b/bug_report.php 2018-03-03 15:04:19.622499678 +0100
3@@ -149,6 +149,17 @@
4 access_ensure_project_level( config_get( 'update_bug_assign_threshold' ) );
5 }
6
7+# begin captcha check for anon user
8+if ( current_user_is_anonymous() && get_gd_version() > 0 ) {
9+ $f_captcha = gpc_get_string( 'captcha', '' );
10+ $f_captcha = utf8_strtolower( trim( $f_captcha ) );
11+
12+ $t_securimage = new Securimage();
13+ if( $t_securimage->check( $f_captcha ) == false ) {
14+ trigger_error( ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR );
15+ }
16+}
17+
18 # if a profile was selected then let's use that information
19 if( 0 != $t_bug_data->profile_id ) {
20 if( profile_is_global( $t_bug_data->profile_id ) ) {
diff --git a/nixops/modules/websites/tools/git/mantisbt/patches/bug_report_page.php.diff b/nixops/modules/websites/tools/git/mantisbt/patches/bug_report_page.php.diff
new file mode 100644
index 0000000..80dea91
--- /dev/null
+++ b/nixops/modules/websites/tools/git/mantisbt/patches/bug_report_page.php.diff
@@ -0,0 +1,53 @@
1--- a/bug_report_page.php 2018-02-10 21:29:27.000000000 +0100
2+++ b/bug_report_page.php 2018-03-03 15:04:19.622499678 +0100
3@@ -708,7 +708,50 @@
4 <span class="lbl padding-6"><?php echo lang_get( 'check_report_more_bugs' ) ?></span>
5 </label>
6 </td>
7 </tr>
8+<?php
9+ # captcha image requires GD library and related option to ON
10+ if( current_user_is_anonymous() && get_gd_version() > 0 ) {
11+ $t_securimage_path = 'vendor/dapphp/securimage';
12+ $t_securimage_show = $t_securimage_path . '/securimage_show.php';
13+ $t_securimage_play = $t_securimage_path . '/securimage_play.swf?'
14+ . http_build_query( array(
15+ 'audio_file' => $t_securimage_path . '/securimage_play.php',
16+ 'bgColor1=' => '#fff',
17+ 'bgColor2=' => '#fff',
18+ 'iconColor=' => '#777',
19+ 'borderWidth=' => 1,
20+ 'borderColor=' => '#000',
21+ ) );
22+?>
23+ <tr>
24+ <th class="category">CAPTCHA</th>
25+ <td>
26+
27+ <label for="captcha-field" class="block clearfix">
28+ <strong><?php echo lang_get( 'signup_captcha_request_label' ); ?></strong>
29+ </label>
30+ <span id="captcha-input" class="input">
31+ <?php print_captcha_input( 'captcha' ); ?>
32+
33+ <span id="captcha-image" class="captcha-image" style="padding-right:3px;">
34+ <img src="<?php echo $t_securimage_show; ?>" alt="visual captcha" />
35+ <ul id="captcha-refresh"><li><a href="#"><?php
36+ echo lang_get( 'signup_captcha_refresh' );
37+ ?></a></li></ul>
38+ </span>
39+
40+ <object type="application/x-shockwave-flash" width="19" height="19"
41+ data="<?php echo $t_securimage_play; ?>">
42+ <param name="movie" value="<?php echo $t_securimage_play; ?>" />
43+ </object>
44+ </span>
45+ </td>
46+ </tr>
47+<?php
48+ }
49+?>
50+
51 </table>
52 </div>
53 </div>
diff --git a/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add.php.diff b/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add.php.diff
new file mode 100644
index 0000000..4509f0a
--- /dev/null
+++ b/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add.php.diff
@@ -0,0 +1,20 @@
1--- a/bugnote_add.php 2018-02-10 21:29:27.000000000 +0100
2+++ b/bugnote_add.php 2018-03-03 15:13:12.439919511 +0100
3@@ -44,6 +44,17 @@
4
5 $t_query = array( 'issue_id' => $f_bug_id );
6
7+# begin captcha check for anon user
8+if ( current_user_is_anonymous() && get_gd_version() > 0 ) {
9+ $f_captcha = gpc_get_string( 'captcha', '' );
10+ $f_captcha = utf8_strtolower( trim( $f_captcha ) );
11+
12+ $t_securimage = new Securimage();
13+ if( $t_securimage->check( $f_captcha ) == false ) {
14+ trigger_error( ERROR_SIGNUP_NOT_MATCHING_CAPTCHA, ERROR );
15+ }
16+}
17+
18 if( count( $f_files ) > 0 && is_blank( $f_text ) && helper_duration_to_minutes( $f_duration ) == 0 ) {
19 $t_payload = array(
20 'files' => helper_array_transpose( $f_files )
diff --git a/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add_inc.php.diff b/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add_inc.php.diff
new file mode 100644
index 0000000..a8589c7
--- /dev/null
+++ b/nixops/modules/websites/tools/git/mantisbt/patches/bugnote_add_inc.php.diff
@@ -0,0 +1,52 @@
1--- a/bugnote_add_inc.php 2018-02-10 21:29:27.000000000 +0100
2+++ b/bugnote_add_inc.php 2018-03-03 15:14:27.332428557 +0100
3@@ -119,6 +119,49 @@
4 <textarea name="bugnote_text" id="bugnote_text" class="<?php echo $t_bugnote_class ?>" rows="7"></textarea>
5 </td>
6 </tr>
7+<?php
8+ # captcha image requires GD library and related option to ON
9+ if( current_user_is_anonymous() && get_gd_version() > 0 ) {
10+ $t_securimage_path = 'vendor/dapphp/securimage';
11+ $t_securimage_show = $t_securimage_path . '/securimage_show.php';
12+ $t_securimage_play = $t_securimage_path . '/securimage_play.swf?'
13+ . http_build_query( array(
14+ 'audio_file' => $t_securimage_path . '/securimage_play.php',
15+ 'bgColor1=' => '#fff',
16+ 'bgColor2=' => '#fff',
17+ 'iconColor=' => '#777',
18+ 'borderWidth=' => 1,
19+ 'borderColor=' => '#000',
20+ ) );
21+?>
22+ <tr>
23+ <th class="category">CAPTCHA</th>
24+ <td>
25+
26+ <label for="captcha-field" class="block clearfix">
27+ <strong><?php echo lang_get( 'signup_captcha_request_label' ); ?></strong>
28+ </label>
29+ <span id="captcha-input" class="input">
30+ <?php print_captcha_input( 'captcha' ); ?>
31+
32+ <span id="captcha-image" class="captcha-image" style="padding-right:3px;">
33+ <img src="<?php echo $t_securimage_show; ?>" alt="visual captcha" />
34+ <ul id="captcha-refresh"><li><a href="#"><?php
35+ echo lang_get( 'signup_captcha_refresh' );
36+ ?></a></li></ul>
37+ </span>
38+
39+ <object type="application/x-shockwave-flash" width="19" height="19"
40+ data="<?php echo $t_securimage_play; ?>">
41+ <param name="movie" value="<?php echo $t_securimage_play; ?>" />
42+ </object>
43+ </span>
44+ </td>
45+ </tr>
46+<?php
47+ }
48+?>
49+
50
51 <?php
52 if( config_get( 'time_tracking_enabled' ) ) {