Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
e50fc496
Commit
e50fc496
authored
Jan 07, 2012
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 443210: Implement Bugzilla.parameters to access parameters used in Bugzilla
r/a=mkanat
parent
9ba84d12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
0 deletions
+134
-0
Bugzilla.pm
Bugzilla/WebService/Bugzilla.pm
+134
-0
No files found.
Bugzilla/WebService/Bugzilla.pm
View file @
e50fc496
...
...
@@ -15,6 +15,7 @@
# Contributor(s): Marc Schumann <wurblzap@gmail.com>
# Max Kanat-Alexander <mkanat@bugzilla.org>
# Mads Bondo Dydensborg <mbd@dbc.dk>
# Frédéric Buclin <LpSolit@gmail.com>
package
Bugzilla::WebService::
Bugzilla
;
...
...
@@ -22,22 +23,66 @@ use strict;
use
base
qw(Bugzilla::WebService)
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Util
qw(datetime_from)
;
use
Bugzilla::WebService::
Util
qw(filter_wants)
;
use
DateTime
;
# Basic info that is needed before logins
use
constant
LOGIN_EXEMPT
=>
{
parameters
=>
1
,
timezone
=>
1
,
version
=>
1
,
};
use
constant
READ_ONLY
=>
qw(
extensions
parameters
timezone
time
version
)
;
# Logged-out users do not need to know more than that.
use
constant
PARAMETERS_LOGGED_OUT
=>
qw(
maintainer
requirelogin
)
;
# These parameters are guessable from the web UI when the user
# is logged in. So it's safe to access them.
use
constant
PARAMETERS_LOGGED_IN
=>
qw(
allowemailchange
attachment_base
commentonchange_resolution
commentonduplicate
cookiepath
defaultopsys
defaultplatform
defaultpriority
defaultseverity
duplicate_or_move_bug_status
emailregexpdesc
emailsuffix
letsubmitterchoosemilestone
letsubmitterchoosepriority
mailfrom
maintainer
maxattachmentsize
maxlocalattachment
musthavemilestoneonaccept
noresolveonopenblockers
password_complexity
rememberlogin
requirelogin
search_allow_no_criteria
urlbase
use_see_also
useclassification
useqacontact
usestatuswhiteboard
usetargetmilestone
)
;
sub
version
{
my
$self
=
shift
;
return
{
version
=>
$self
->
type
(
'string'
,
BUGZILLA_VERSION
)
};
...
...
@@ -81,6 +126,25 @@ sub time {
};
}
sub
parameters
{
my
(
$self
,
$args
)
=
@_
;
my
$user
=
Bugzilla
->
login
();
my
$params
=
Bugzilla
->
params
;
$args
||=
{};
my
@params_list
=
$user
->
in_group
(
'tweakparams'
)
?
keys
(
%
$params
)
:
$user
->
id
?
PARAMETERS_LOGGED_IN
:
PARAMETERS_LOGGED_OUT
;
my
%
parameters
;
foreach
my
$param
(
@params_list
)
{
next
unless
filter_wants
(
$args
,
$param
);
$parameters
{
$param
}
=
$self
->
type
(
'string'
,
$params
->
{
$param
});
}
return
{
parameters
=>
\%
parameters
};
}
1
;
__END__
...
...
@@ -268,3 +332,73 @@ local timezone.
=back
=back
=head2 parameters
B<UNSTABLE>
=over
=item B<Description>
Returns parameter values currently used in this Bugzilla.
=item B<Params> (none)
=item B<Returns>
A hash with a single item C<parameters> which contains a hash with
the name of the parameters as keys and their value as values. All
values are returned as strings.
The list of parameters returned by this method depends on the user
credentials:
A logged-out user can only access the C<maintainer> and C<requirelogin> parameters.
A logged-in user can access the following parameters (listed alphabetically):
C<allowemailchange>,
C<attachment_base>,
C<commentonchange_resolution>,
C<commentonduplicate>,
C<cookiepath>,
C<defaultopsys>,
C<defaultplatform>,
C<defaultpriority>,
C<defaultseverity>,
C<duplicate_or_move_bug_status>,
C<emailregexpdesc>,
C<emailsuffix>,
C<letsubmitterchoosemilestone>,
C<letsubmitterchoosepriority>,
C<mailfrom>,
C<maintainer>,
C<maxattachmentsize>,
C<maxlocalattachment>,
C<musthavemilestoneonaccept>,
C<noresolveonopenblockers>,
C<password_complexity>,
C<rememberlogin>,
C<requirelogin>,
C<search_allow_no_criteria>,
C<urlbase>,
C<use_see_also>,
C<useclassification>,
C<useqacontact>,
C<usestatuswhiteboard>,
C<usetargetmilestone>.
A user in the tweakparams group can access all existing parameters.
New parameters can appear or obsolete parameters can disappear depending
on the version of Bugzilla and on extensions being installed.
The list of parameters returned by this method is not stable and will
never be stable.
=item B<History>
=over
=item Added in Bugzilla B<5.0>.
=back
=back
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment