Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > media > contrib-updates-src > by-pkgid > 867d9a66f87c10a3d35143762417c20e > files > 1

bugzilla-3.6.4-1mdv2010.2.src.rpm

diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//Bugzilla/Auth/Login/AuthEnv.pm bugzilla-3.4.5-extern_id//Bugzilla/Auth/Login/AuthEnv.pm
--- bugzilla-3.6-fhs-dont-mess-file-perms//Bugzilla/Auth/Login/AuthEnv.pm	1970-01-01 01:00:00.000000000 +0100
+++ bugzilla-3.4.5-extern_id//Bugzilla/Auth/Login/AuthEnv.pm	2010-04-13 21:20:17.000000000 +0200
@@ -0,0 +1,30 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+
+package Bugzilla::Auth::Login::AuthEnv;
+
+use strict;
+use base qw(Bugzilla::Auth::Login::Env);
+
+use Bugzilla::Constants;
+use Bugzilla::Error;
+
+use constant user_can_create_account => 1;
+
+1;
diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//Bugzilla/Config/AuthEnv.pm bugzilla-3.4.5-extern_id//Bugzilla/Config/AuthEnv.pm
--- bugzilla-3.6-fhs-dont-mess-file-perms//Bugzilla/Config/AuthEnv.pm	1970-01-01 01:00:00.000000000 +0100
+++ bugzilla-3.4.5-extern_id//Bugzilla/Config/AuthEnv.pm	2010-04-13 21:20:17.000000000 +0200
@@ -0,0 +1,52 @@
+# -*- Mode: perl; indent-tabs-mode: nil -*-
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+#
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s): Terry Weissman <terry@mozilla.org>
+#                 Dawn Endico <endico@mozilla.org>
+#                 Dan Mosedale <dmose@mozilla.org>
+#                 Joe Robins <jmrobins@tgix.com>
+#                 Jacob Steenhagen <jake@bugzilla.org>
+#                 J. Paul Reed <preed@sigkill.com>
+#                 Bradley Baetz <bbaetz@student.usyd.edu.au>
+#                 Joseph Heenan <joseph@heenan.me.uk>
+#                 Erik Stambaugh <erik@dasbistro.com>
+#                 Frédéric Buclin <LpSolit@gmail.com>
+#
+
+package Bugzilla::Config::AuthEnv;
+
+use strict;
+
+use Bugzilla::Config::Common;
+
+$Bugzilla::Config::AuthEnv::sortkey = "15";
+
+sub get_param_list {
+  my $class = shift;
+  my @param_list = (
+  {
+   name => 'allowloginid',
+   type    => 'b',
+   default => '0',
+  });
+
+  return @param_list;
+}
+
+1;
diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//Bugzilla/User.pm bugzilla-3.4.5-extern_id//Bugzilla/User.pm
--- bugzilla-3.6-fhs-dont-mess-file-perms//Bugzilla/User.pm	2010-04-13 21:15:19.000000000 +0200
+++ bugzilla-3.4.5-extern_id//Bugzilla/User.pm	2010-04-13 21:20:17.000000000 +0200
@@ -78,6 +78,7 @@
     'showmybugslink' => 0,
     'disabledtext'   => '',
     'disable_mail'   => 0,
+    'extern_id'      => ''
 };
 
 use constant DB_TABLE => 'profiles';
@@ -93,6 +94,7 @@
     'profiles.mybugslink AS showmybugslink',
     'profiles.disabledtext',
     'profiles.disable_mail',
+    'profiles.extern_id'
 );
 use constant NAME_FIELD => 'login_name';
 use constant ID_FIELD   => 'userid';
@@ -106,6 +108,7 @@
     disabledtext  => \&_check_disabledtext,
     login_name    => \&check_login_name_for_creation,
     realname      => \&_check_realname,
+    extern_id     => \&_check_extern_id
 };
 
 sub UPDATE_COLUMNS {
@@ -115,6 +118,7 @@
         disabledtext
         login_name
         realname
+        extern_id
     );
     push(@cols, 'cryptpassword') if exists $self->{cryptpassword};
     return @cols;
@@ -178,6 +182,20 @@
 sub _check_disable_mail { return $_[1] ? 1 : 0; }
 sub _check_disabledtext { return trim($_[1]) || ''; }
 
+# Check, whether the extern_id is unique.
+sub _check_extern_id {
+    my ($invocant, $extern_id) = @_;
+    $extern_id = trim($extern_id);
+    if (!Bugzilla->params->{'allowloginid'}) {
+        return $extern_id;
+    }
+	$extern_id || ThrowUserError('extern_id_required');
+	if (!ref($invocant) || $invocant->extern_id ne $extern_id) {
+	    is_available_extern_id($extern_id)
+	        || ThrowUserError('extern_id_exists', { extern_id => $extern_id });
+	}
+}
+
 # This is public since createaccount.cgi needs to use it before issuing
 # a token for account creation.
 sub check_login_name_for_creation {
@@ -217,6 +235,7 @@
 
 sub set_disabledtext { $_[0]->set('disabledtext', $_[1]); }
 sub set_disable_mail { $_[0]->set('disable_mail', $_[1]); }
+sub set_extern_id { $_[0]->set('extern_id', $_[1]); }
 
 sub set_login {
     my ($self, $login) = @_;
@@ -241,6 +260,7 @@
 # Accessors for user attributes
 sub name  { $_[0]->{realname};   }
 sub login { $_[0]->{login_name}; }
+sub extern_id { $_[0]->{extern_id}; }
 sub email { $_[0]->login . Bugzilla->params->{'emailsuffix'}; }
 sub disabledtext { $_[0]->{'disabledtext'}; }
 sub is_disabled { $_[0]->disabledtext ? 1 : 0; }
@@ -1655,6 +1675,11 @@
 # Subroutines #
 ###############
 
+sub is_available_extern_id {
+	my ($extern_id) = @_;
+	return extern_id_to_id($extern_id) != 0;
+}
+
 sub is_available_username {
     my ($username, $old_username) = @_;
 
@@ -1694,6 +1719,22 @@
     return 1;
 }
 
+sub extern_id_to_id {
+    my ($extern_id) = @_;
+	my $dbh = Bugzilla->dbh;
+    # No need to validate $extern_id -- it will be used by the following SELECT
+    # statement only, so it's safe to simply trick_taint.
+    trick_taint($extern_id);
+    my $user_id = $dbh->selectrow_array("SELECT userid FROM profiles WHERE " .
+                                        $dbh->sql_istrcmp('exterm_id', '?'),
+                                        undef, $extern_id);
+    if ($user_id) {
+        return $user_id;
+    } else {
+        return 0;
+    }
+}
+
 sub login_to_id {
     my ($login, $throw_error) = @_;
     my $dbh = Bugzilla->dbh;
diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//editusers.cgi bugzilla-3.4.5-extern_id//editusers.cgi
--- bugzilla-3.6-fhs-dont-mess-file-perms//editusers.cgi	2010-04-13 21:15:19.000000000 +0200
+++ bugzilla-3.4.5-extern_id//editusers.cgi	2010-04-13 21:20:17.000000000 +0200
@@ -213,7 +213,8 @@
         cryptpassword => $password,
         realname      => scalar $cgi->param('name'),
         disabledtext  => scalar $cgi->param('disabledtext'),
-        disable_mail  => scalar $cgi->param('disable_mail')});
+        disable_mail  => scalar $cgi->param('disable_mail'),
+        extern_id     => scalar $cgi->param('extern_id')});
 
     userDataToVars($new_user->id);
 
@@ -256,6 +257,7 @@
             if $cgi->param('password');
         $otherUser->set_disabledtext($cgi->param('disabledtext'));
         $otherUser->set_disable_mail($cgi->param('disable_mail'));
+        $otherUser->set_extern_id($cgi->param('extern_id'));
         $changes = $otherUser->update();
     }
 
diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//extensions/authenv/template/de/hook/global/user-error-errors.html.tmpl bugzilla-3.4.5-extern_id//extensions/authenv/template/de/hook/global/user-error-errors.html.tmpl
--- bugzilla-3.6-fhs-dont-mess-file-perms//extensions/authenv/template/de/hook/global/user-error-errors.html.tmpl	1970-01-01 01:00:00.000000000 +0100
+++ bugzilla-3.4.5-extern_id//extensions/authenv/template/de/hook/global/user-error-errors.html.tmpl	2010-04-13 21:20:17.000000000 +0200
@@ -0,0 +1,12 @@
+[% IF error == "extern_id_required" %]
+  [% title = "Fehlende Login-ID" %]
+  Eine Login-ID des neuen Benutzers ist erforderlich.
+[% ELSIF error == "extern_id_exists" %]
+  [% title = "Account bereits vorhanden" %]
+  Es gibt bereits einen Account
+  [% IF extern_id %]
+    mit der Login-ID [% extern_id FILTER html %].
+  [% ELSE %]
+    derselben Login-ID.
+  [% END %]
+[% END %]
diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//extensions/authenv/template/en/hook/global/user-error-errors.html.tmpl bugzilla-3.4.5-extern_id//extensions/authenv/template/en/hook/global/user-error-errors.html.tmpl
--- bugzilla-3.6-fhs-dont-mess-file-perms//extensions/authenv/template/en/hook/global/user-error-errors.html.tmpl	1970-01-01 01:00:00.000000000 +0100
+++ bugzilla-3.4.5-extern_id//extensions/authenv/template/en/hook/global/user-error-errors.html.tmpl	2010-04-13 21:20:17.000000000 +0200
@@ -0,0 +1,12 @@
+[% IF error == "extern_id_required" %]
+  [% title = "Missing Login ID" %]
+  You must enter a login name for the new user.
+[% ELSIF error == "extern_id_exists" %]
+  [% title = "Account Already Exists" %]
+  There is already an account with
+  [% IF email %]
+    the login ID [% extern_id FILTER html %].
+  [% ELSE %]
+    that login ID.
+  [% END %]
+[% END %]
diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//template/de/custom/admin/users/userdata.html.tmpl bugzilla-3.4.5-extern_id//template/de/custom/admin/users/userdata.html.tmpl
--- bugzilla-3.6-fhs-dont-mess-file-perms//template/de/custom/admin/users/userdata.html.tmpl	1970-01-01 01:00:00.000000000 +0100
+++ bugzilla-3.4.5-extern_id//template/de/custom/admin/users/userdata.html.tmpl	2010-04-13 21:20:17.000000000 +0200
@@ -0,0 +1,107 @@
+[%# 1.0@bugzilla.org %]
+[%# The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Bugzilla Bug Tracking System.
+  #
+  # Contributor(s): Marc Schumann <wurblzap@gmail.com>
+  #
+  # Translated by Marc Schumann <wurblzap@gmail.com>
+  #%]
+
+[%# INTERFACE:
+  #
+  # editform:  is this an edit form? (It's a create form otherwise)
+  # editusers: is viewing user member of editusers?
+  # otheruser: Bugzilla::User object of user to edit
+  #%]
+
+<tr>
+  <th><label for="login">Benutzerkonto (E-Mail-Adresse):</label></th>
+  <td>
+    [% IF editusers %]
+      <input size="64" maxlength="255" name="login"
+             id="login" value="[% otheruser.login FILTER html %]" />
+      [% IF editform %]
+        [% IF !otheruser.groups.bz_sudo_protect %]
+          <br />
+          <a href="relogin.cgi?action=prepare-sudo&amp;target_login=
+          [%- otheruser.login FILTER html %]">Im Namen dieser Person arbeiten</a>
+        [% END %]
+      [% END %]
+    [% ELSE %]
+      [% otheruser.login FILTER html %]
+    [% END %]
+  </td>
+</tr>
+[% IF Param('allowloginid') %]
+<tr>
+  <th><label for="extern_id">Login-ID:</label></th>
+  <td>
+    [% IF editusers %]
+      <input size="64" maxlength="255" name="extern_id"
+             id="extern_id" value="[% otheruser.extern_id FILTER html %]" />
+    [% ELSE %]
+      [% otheruser.extern_id FILTER html %]
+    [% END %]
+  </td>
+</tr>
+[% END %]
+<tr>
+  <th><label for="name">Wirklicher Name:</label></th>
+  <td>
+    [% IF editusers %]
+      <input size="64" maxlength="255" name="name"
+             autocomplete="off"
+             id="name" value="[% otheruser.name FILTER html %]" />
+    [% ELSE %]
+      [% otheruser.name FILTER html %]
+    [% END %]
+  </td>
+</tr>
+[% IF editusers %]
+  <tr>
+    <th><label for="password">Passwort:</label></th>
+    <td>
+      <input type="password" size="16" maxlength="16" name="password"
+             autocomplete="off"
+             id="password" value="" />
+      [% IF editform %]<br />
+        (Geben Sie ein neues Passwort an, wenn Sie das bestehende ändern möchten.)
+      [% END %]
+    </td>
+  </tr>
+  <tr>
+    <th><label for="disable_mail">Vom E-Mail-Erhalt ausgenommen:</label></th>
+    <td>
+      <input type="checkbox" name="disable_mail" id="disable_mail" value="1"
+      [% IF otheruser.email_disabled %] checked="checked" [% END %] /><br />
+      (Dies betrifft Benachrichtigungen über [% terms.bug %]änderungen und
+      Nörgel-Mails, nicht aber E-Mails zum Passwortrücksetzen oder andere nicht
+      mit [% terms.bugs %] in Verbindung stehende E-Mails.)
+    </td>
+  </tr>
+  <tr>
+    <th><label for="disabledtext">Deaktivierungstext:</label></th>
+    <td>
+      [% INCLUDE global/textarea.html.tmpl
+         name           = 'disabledtext'
+         id             = 'disabledtext'
+         minrows        = 2
+         maxrows        = 10
+         defaultrows    = 10
+         cols           = 60
+         defaultcontent = otheruser.disabledtext
+       %]<br>
+      (Wenn nicht leer, dann ist das Benutzerkonto deaktiviert, und dieser
+      Text sollte erklären, weshalb.)
+    </td>
+  </tr>
+[% END %]
diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//template/de/default/admin/params/authenv.html.tmpl bugzilla-3.4.5-extern_id//template/de/default/admin/params/authenv.html.tmpl
--- bugzilla-3.6-fhs-dont-mess-file-perms//template/de/default/admin/params/authenv.html.tmpl	1970-01-01 01:00:00.000000000 +0100
+++ bugzilla-3.4.5-extern_id//template/de/default/admin/params/authenv.html.tmpl	2010-04-13 21:20:17.000000000 +0200
@@ -0,0 +1,29 @@
+[%# 1.0@bugzilla.org %]
+[%# The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Bugzilla Bug Tracking System.
+  #
+  # The Initial Developer of the Original Code is Netscape Communications
+  # Corporation. Portions created by Netscape are
+  # Copyright (C) 1998 Netscape Communications Corporation. All
+  # Rights Reserved.
+  #
+  # Contributor(s): Dave Miller <justdave@bugzilla.org>
+  #                 Frédéric Buclin <LpSolit@gmail.com>
+  #%]
+[%
+   title = "AuthEnv Extension"
+   desc = "Konfiguration der Bugzilla::AuthEnv-Erweiterung"
+%]
+
+[% param_descs = {
+  allowloginid => "Ein- oder ausschalten der Wartung einer Login-ID." }
+%]
diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//template/en/default/admin/params/authenv.html.tmpl bugzilla-3.4.5-extern_id//template/en/default/admin/params/authenv.html.tmpl
--- bugzilla-3.6-fhs-dont-mess-file-perms//template/en/default/admin/params/authenv.html.tmpl	1970-01-01 01:00:00.000000000 +0100
+++ bugzilla-3.4.5-extern_id//template/en/default/admin/params/authenv.html.tmpl	2010-04-13 21:20:17.000000000 +0200
@@ -0,0 +1,29 @@
+[%# 1.0@bugzilla.org %]
+[%# The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Bugzilla Bug Tracking System.
+  #
+  # The Initial Developer of the Original Code is Netscape Communications
+  # Corporation. Portions created by Netscape are
+  # Copyright (C) 1998 Netscape Communications Corporation. All
+  # Rights Reserved.
+  #
+  # Contributor(s): Dave Miller <justdave@bugzilla.org>
+  #                 Frédéric Buclin <LpSolit@gmail.com>
+  #%]
+[%
+   title = "AuthEnv Extension"
+   desc = "Set up your Bugzilla::AuthEnv extension"
+%]
+
+[% param_descs = {
+  allowloginid => "Enable or disable maintenance of the login ID." }
+%]
diff -Naur -x '*.orig' bugzilla-3.6-fhs-dont-mess-file-perms//template/en/extensions/admin/users/userdata.html.tmpl bugzilla-3.4.5-extern_id//template/en/extensions/admin/users/userdata.html.tmpl
--- bugzilla-3.6-fhs-dont-mess-file-perms//template/en/extensions/admin/users/userdata.html.tmpl	1970-01-01 01:00:00.000000000 +0100
+++ bugzilla-3.4.5-extern_id//template/en/extensions/admin/users/userdata.html.tmpl	2010-04-13 21:20:17.000000000 +0200
@@ -0,0 +1,104 @@
+[%# 1.0@bugzilla.org %]
+[%# The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Bugzilla Bug Tracking System.
+  #
+  # Contributor(s): Marc Schumann <wurblzap@gmail.com>
+  #%]
+
+[%# INTERFACE:
+  #
+  # editform:  is this an edit form? (It's a create form otherwise)
+  # editusers: is viewing user member of editusers?
+  # otheruser: Bugzilla::User object of user to edit
+  #%]
+
+<tr>
+  <th><label for="login">Login name:</label></th>
+  <td>
+    [% IF editusers %]
+      <input size="64" maxlength="255" name="login" 
+             id="login" value="[% otheruser.login FILTER html %]" />
+      [% IF editform %]
+        [% IF !otheruser.groups.bz_sudo_protect %]
+          <br />
+          <a href="relogin.cgi?action=prepare-sudo&amp;target_login=
+          [%- otheruser.login FILTER html %]">Impersonate this user</a>
+        [% END %]
+      [% END %]
+    [% ELSE %]
+      [% otheruser.login FILTER html %]
+    [% END %]
+  </td>
+</tr>
+[% IF Param('allowloginid') %]
+<tr>
+  <th><label for="extern_id">Login ID:</label></th>
+  <td>
+    [% IF editusers %]
+      <input size="64" maxlength="255" name="extern_id"
+             id="extern_id" value="[% otheruser.extern_id FILTER html %]" />
+    [% ELSE %]
+      [% otheruser.extern_id FILTER html %]
+    [% END %]
+  </td>
+</tr>
+[% END %]
+<tr>
+  <th><label for="name">Real name:</label></th>
+  <td>
+    [% IF editusers %]
+      <input size="64" maxlength="255" name="name"
+             autocomplete="off"
+             id="name" value="[% otheruser.name FILTER html %]" />
+    [% ELSE %]
+      [% otheruser.name FILTER html %]
+    [% END %]
+  </td>
+</tr>
+[% IF editusers %]
+  <tr>
+    <th><label for="password">Password:</label></th>
+    <td>
+      <input type="password" size="16" maxlength="16" name="password"
+             autocomplete="off"
+             id="password" value="" />
+      [% IF editform %]<br />
+        (Enter new password to change.)
+      [% END %]
+    </td>
+  </tr>
+  <tr>
+    <th><label for="disable_mail">[% terms.Bug %]mail Disabled:</label></th>
+    <td>
+      <input type="checkbox" name="disable_mail" id="disable_mail" value="1" 
+      [% IF otheruser.email_disabled %] checked="checked" [% END %] />
+      (This affects [% terms.bug %]mail and whinemail, not password-reset or other 
+      non-[% terms.bug %]-related emails)
+    </td>
+  </tr>
+  <tr>
+    <th><label for="disabledtext">Disable text:</label></th>
+    <td>
+      [% INCLUDE global/textarea.html.tmpl
+         name           = 'disabledtext'
+         id             = 'disabledtext'
+         minrows        = 2
+         maxrows        = 10
+         defaultrows    = 10
+         cols           = 60
+         defaultcontent = otheruser.disabledtext
+       %]<br>
+      (If non-empty, then the account will be disabled, and this text should
+      explain why.)
+    </td>
+  </tr>
+[% END %]