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
6cf3c88e
Commit
6cf3c88e
authored
Jul 01, 2008
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 437617: Make "type" a method of Bugzilla::WebService
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat
parent
7b6d4bdc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
46 deletions
+51
-46
WebService.pm
Bugzilla/WebService.pm
+9
-0
Bug.pm
Bugzilla/WebService/Bug.pm
+14
-17
Bugzilla.pm
Bugzilla/WebService/Bugzilla.pm
+8
-6
Product.pm
Bugzilla/WebService/Product.pm
+3
-4
User.pm
Bugzilla/WebService/User.pm
+17
-19
No files found.
Bugzilla/WebService.pm
View file @
6cf3c88e
...
@@ -20,6 +20,7 @@ package Bugzilla::WebService;
...
@@ -20,6 +20,7 @@ package Bugzilla::WebService;
use
strict
;
use
strict
;
use
Bugzilla::WebService::
Constants
;
use
Bugzilla::WebService::
Constants
;
use
Date::
Parse
;
use
Date::
Parse
;
use
XMLRPC::
Lite
;
sub
fail_unimplemented
{
sub
fail_unimplemented
{
my
$this
=
shift
;
my
$this
=
shift
;
...
@@ -62,6 +63,14 @@ sub login_exempt {
...
@@ -62,6 +63,14 @@ sub login_exempt {
return
$class
->
LOGIN_EXEMPT
->
{
$method
};
return
$class
->
LOGIN_EXEMPT
->
{
$method
};
}
}
sub
type
{
my
(
$self
,
$type
,
$value
)
=
@_
;
if
(
$type
eq
'dateTime'
)
{
$value
=
$self
->
datetime_format
(
$value
);
}
return
XMLRPC::
Data
->
type
(
$type
)
->
value
(
$value
);
}
1
;
1
;
package
Bugzilla::WebService::XMLRPC::Transport::HTTP::
CGI
;
package
Bugzilla::WebService::XMLRPC::Transport::HTTP::
CGI
;
...
...
Bugzilla/WebService/Bug.pm
View file @
6cf3c88e
...
@@ -22,7 +22,6 @@ package Bugzilla::WebService::Bug;
...
@@ -22,7 +22,6 @@ package Bugzilla::WebService::Bug;
use
strict
;
use
strict
;
use
base
qw(Bugzilla::WebService)
;
use
base
qw(Bugzilla::WebService)
;
import
SOAP::
Data
qw(type)
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Error
;
use
Bugzilla::
Error
;
...
@@ -87,17 +86,15 @@ sub get {
...
@@ -87,17 +86,15 @@ sub get {
# This is done in this fashion in order to produce a stable API.
# This is done in this fashion in order to produce a stable API.
# The internals of Bugzilla::Bug are not stable enough to just
# The internals of Bugzilla::Bug are not stable enough to just
# return them directly.
# return them directly.
my
$creation_ts
=
$self
->
datetime_format
(
$bug
->
creation_ts
);
my
$delta_ts
=
$self
->
datetime_format
(
$bug
->
delta_ts
);
my
%
item
;
my
%
item
;
$item
{
'creation_time'
}
=
type
(
'dateTime'
)
->
value
(
$
creation_ts
);
$item
{
'creation_time'
}
=
$self
->
type
(
'dateTime'
,
$bug
->
creation_ts
);
$item
{
'last_change_time'
}
=
type
(
'dateTime'
)
->
value
(
$
delta_ts
);
$item
{
'last_change_time'
}
=
$self
->
type
(
'dateTime'
,
$bug
->
delta_ts
);
$item
{
'internals'
}
=
$bug
;
$item
{
'internals'
}
=
$bug
;
$item
{
'id'
}
=
type
(
'int'
)
->
value
(
$bug
->
bug_id
);
$item
{
'id'
}
=
$self
->
type
(
'int'
,
$bug
->
bug_id
);
$item
{
'summary'
}
=
type
(
'string'
)
->
value
(
$bug
->
short_desc
);
$item
{
'summary'
}
=
$self
->
type
(
'string'
,
$bug
->
short_desc
);
if
(
Bugzilla
->
params
->
{
'usebugaliases'
})
{
if
(
Bugzilla
->
params
->
{
'usebugaliases'
})
{
$item
{
'alias'
}
=
type
(
'string'
)
->
value
(
$bug
->
alias
);
$item
{
'alias'
}
=
$self
->
type
(
'string'
,
$bug
->
alias
);
}
}
else
{
else
{
# For API reasons, we always want the value to appear, we just
# For API reasons, we always want the value to appear, we just
...
@@ -131,18 +128,18 @@ sub get_history {
...
@@ -131,18 +128,18 @@ sub get_history {
foreach
my
$changeset
(
@$activity
)
{
foreach
my
$changeset
(
@$activity
)
{
my
%
bug_history
;
my
%
bug_history
;
$bug_history
{
when
}
=
type
(
'dateTime'
)
->
value
(
$bug_history
{
when
}
=
$self
->
type
(
'dateTime'
,
$self
->
datetime_format
(
$changeset
->
{
when
}));
$self
->
datetime_format
(
$changeset
->
{
when
}));
$bug_history
{
who
}
=
type
(
'string'
)
->
value
(
$changeset
->
{
who
});
$bug_history
{
who
}
=
$self
->
type
(
'string'
,
$changeset
->
{
who
});
$bug_history
{
changes
}
=
[]
;
$bug_history
{
changes
}
=
[]
;
foreach
my
$change
(
@
{
$changeset
->
{
changes
}
})
{
foreach
my
$change
(
@
{
$changeset
->
{
changes
}
})
{
my
$attach_id
=
delete
$change
->
{
attachid
};
my
$attach_id
=
delete
$change
->
{
attachid
};
if
(
$attach_id
)
{
if
(
$attach_id
)
{
$change
->
{
attachment_id
}
=
type
(
'int'
)
->
value
(
$attach_id
);
$change
->
{
attachment_id
}
=
$self
->
type
(
'int'
,
$attach_id
);
}
}
$change
->
{
removed
}
=
type
(
'string'
)
->
value
(
$change
->
{
removed
});
$change
->
{
removed
}
=
$self
->
type
(
'string'
,
$change
->
{
removed
});
$change
->
{
added
}
=
type
(
'string'
)
->
value
(
$change
->
{
added
});
$change
->
{
added
}
=
$self
->
type
(
'string'
,
$change
->
{
added
});
$change
->
{
field_name
}
=
type
(
'string'
)
->
value
(
$change
->
{
field_name
}
=
$self
->
type
(
'string'
,
delete
$change
->
{
fieldname
});
delete
$change
->
{
fieldname
});
# This is going to go away in the future from GetBugActivity
# This is going to go away in the future from GetBugActivity
# so we shouldn't put it in the API.
# so we shouldn't put it in the API.
...
@@ -157,7 +154,7 @@ sub get_history {
...
@@ -157,7 +154,7 @@ sub get_history {
# then they get to know which bug activity relates to which value
# then they get to know which bug activity relates to which value
# they passed
# they passed
if
(
Bugzilla
->
params
->
{
'usebugaliases'
})
{
if
(
Bugzilla
->
params
->
{
'usebugaliases'
})
{
$item
{
alias
}
=
type
(
'string'
)
->
value
(
$bug
->
alias
);
$item
{
alias
}
=
$self
->
type
(
'string'
,
$bug
->
alias
);
}
}
else
{
else
{
# For API reasons, we always want the value to appear, we just
# For API reasons, we always want the value to appear, we just
...
@@ -189,7 +186,7 @@ sub create {
...
@@ -189,7 +186,7 @@ sub create {
Bugzilla::BugMail::
Send
(
$bug
->
bug_id
,
{
changer
=>
$bug
->
reporter
->
login
});
Bugzilla::BugMail::
Send
(
$bug
->
bug_id
,
{
changer
=>
$bug
->
reporter
->
login
});
return
{
id
=>
type
(
'int'
)
->
value
(
$bug
->
bug_id
)
};
return
{
id
=>
$self
->
type
(
'int'
,
$bug
->
bug_id
)
};
}
}
sub
legal_values
{
sub
legal_values
{
...
@@ -232,7 +229,7 @@ sub legal_values {
...
@@ -232,7 +229,7 @@ sub legal_values {
my
@result
;
my
@result
;
foreach
my
$val
(
@$values
)
{
foreach
my
$val
(
@$values
)
{
push
(
@result
,
type
(
'string'
)
->
value
(
$val
));
push
(
@result
,
$self
->
type
(
'string'
,
$val
));
}
}
return
{
values
=>
\
@result
};
return
{
values
=>
\
@result
};
...
...
Bugzilla/WebService/Bugzilla.pm
View file @
6cf3c88e
...
@@ -22,7 +22,6 @@ use strict;
...
@@ -22,7 +22,6 @@ use strict;
use
base
qw(Bugzilla::WebService)
;
use
base
qw(Bugzilla::WebService)
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Hook
;
use
Bugzilla::
Hook
;
import
SOAP::
Data
qw(type)
;
use
Time::
Zone
;
use
Time::
Zone
;
...
@@ -33,26 +32,29 @@ use constant LOGIN_EXEMPT => {
...
@@ -33,26 +32,29 @@ use constant LOGIN_EXEMPT => {
};
};
sub
version
{
sub
version
{
return
{
version
=>
type
(
'string'
)
->
value
(
BUGZILLA_VERSION
)
};
my
$self
=
shift
;
return
{
version
=>
$self
->
type
(
'string'
,
BUGZILLA_VERSION
)
};
}
}
sub
extensions
{
sub
extensions
{
my
$self
=
shift
;
my
$extensions
=
Bugzilla::Hook::
enabled_plugins
();
my
$extensions
=
Bugzilla::Hook::
enabled_plugins
();
foreach
my
$name
(
keys
%
$extensions
)
{
foreach
my
$name
(
keys
%
$extensions
)
{
my
$info
=
$extensions
->
{
$name
};
my
$info
=
$extensions
->
{
$name
};
foreach
my
$data
(
keys
%
$info
)
foreach
my
$data
(
keys
%
$info
)
{
{
$extensions
->
{
$name
}
->
{
$data
}
=
$extensions
->
{
$name
}
->
{
$data
}
=
type
(
'string'
)
->
value
(
$info
->
{
$data
});
$self
->
type
(
'string'
,
$info
->
{
$data
});
}
}
}
}
return
{
extensions
=>
$extensions
};
return
{
extensions
=>
$extensions
};
}
}
sub
timezone
{
sub
timezone
{
my
$self
=
shift
;
my
$offset
=
tz_offset
();
my
$offset
=
tz_offset
();
$offset
=
((
$offset
/ 60) /
60
)
*
100
;
$offset
=
((
$offset
/ 60) /
60
)
*
100
;
$offset
=
sprintf
(
'%+05d'
,
$offset
);
$offset
=
sprintf
(
'%+05d'
,
$offset
);
return
{
timezone
=>
type
(
'string'
)
->
value
(
$offset
)
};
return
{
timezone
=>
$self
->
type
(
'string'
,
$offset
)
};
}
}
1
;
1
;
...
...
Bugzilla/WebService/Product.pm
View file @
6cf3c88e
...
@@ -21,7 +21,6 @@ use strict;
...
@@ -21,7 +21,6 @@ use strict;
use
base
qw(Bugzilla::WebService)
;
use
base
qw(Bugzilla::WebService)
;
use
Bugzilla::
Product
;
use
Bugzilla::
Product
;
use
Bugzilla::
User
;
use
Bugzilla::
User
;
import
SOAP::
Data
qw(type)
;
##################################################
##################################################
# Add aliases here for method name compatibility #
# Add aliases here for method name compatibility #
...
@@ -63,9 +62,9 @@ sub get {
...
@@ -63,9 +62,9 @@ sub get {
my
@products
=
my
@products
=
map
{{
map
{{
internals
=>
$_
,
internals
=>
$_
,
id
=>
type
(
'int'
)
->
value
(
$_
->
id
),
id
=>
$self
->
type
(
'int'
,
$_
->
id
),
name
=>
type
(
'string'
)
->
value
(
$_
->
name
),
name
=>
$self
->
type
(
'string'
,
$_
->
name
),
description
=>
type
(
'string'
)
->
value
(
$_
->
description
),
description
=>
$self
->
type
(
'string'
,
$_
->
description
),
}
}
}
@requested_accessible
;
}
@requested_accessible
;
...
...
Bugzilla/WebService/User.pm
View file @
6cf3c88e
...
@@ -22,8 +22,6 @@ package Bugzilla::WebService::User;
...
@@ -22,8 +22,6 @@ package Bugzilla::WebService::User;
use
strict
;
use
strict
;
use
base
qw(Bugzilla::WebService)
;
use
base
qw(Bugzilla::WebService)
;
import
SOAP::
Data
qw(type)
;
use
Bugzilla
;
use
Bugzilla
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Error
;
use
Bugzilla::
Error
;
...
@@ -63,7 +61,7 @@ sub login {
...
@@ -63,7 +61,7 @@ sub login {
$cgi
->
param
(
'Bugzilla_remember'
,
$remember
);
$cgi
->
param
(
'Bugzilla_remember'
,
$remember
);
Bugzilla
->
login
;
Bugzilla
->
login
;
return
{
id
=>
type
(
'int'
)
->
value
(
Bugzilla
->
user
->
id
)
};
return
{
id
=>
$self
->
type
(
'int'
,
Bugzilla
->
user
->
id
)
};
}
}
sub
logout
{
sub
logout
{
...
@@ -118,7 +116,7 @@ sub create {
...
@@ -118,7 +116,7 @@ sub create {
cryptpassword
=>
$password
cryptpassword
=>
$password
});
});
return
{
id
=>
type
(
'int'
)
->
value
(
$user
->
id
)
};
return
{
id
=>
$self
->
type
(
'int'
,
$user
->
id
)
};
}
}
...
@@ -149,9 +147,9 @@ sub get {
...
@@ -149,9 +147,9 @@ sub get {
ThrowUserError
(
'user_access_by_match_denied'
);
ThrowUserError
(
'user_access_by_match_denied'
);
}
}
@users
=
map
{
filter
$params
,
{
@users
=
map
{
filter
$params
,
{
id
=>
type
(
'int'
)
->
value
(
$_
->
id
),
id
=>
$self
->
type
(
'int'
,
$_
->
id
),
real_name
=>
type
(
'string'
)
->
value
(
$_
->
name
),
real_name
=>
$self
->
type
(
'string'
,
$_
->
name
),
name
=>
type
(
'string'
)
->
value
(
$_
->
login
),
name
=>
$self
->
type
(
'string'
,
$_
->
login
),
}}
@user_objects
;
}}
@user_objects
;
return
{
users
=>
\
@users
};
return
{
users
=>
\
@users
};
...
@@ -195,24 +193,24 @@ sub get {
...
@@ -195,24 +193,24 @@ sub get {
if
(
Bugzilla
->
user
->
in_group
(
'editusers'
))
{
if
(
Bugzilla
->
user
->
in_group
(
'editusers'
))
{
@users
=
@users
=
map
{
filter
$params
,
{
map
{
filter
$params
,
{
id
=>
type
(
'int'
)
->
value
(
$_
->
id
),
id
=>
$self
->
type
(
'int'
,
$_
->
id
),
real_name
=>
type
(
'string'
)
->
value
(
$_
->
name
),
real_name
=>
$self
->
type
(
'string'
,
$_
->
name
),
name
=>
type
(
'string'
)
->
value
(
$_
->
login
),
name
=>
$self
->
type
(
'string'
,
$_
->
login
),
email
=>
type
(
'string'
)
->
value
(
$_
->
email
),
email
=>
$self
->
type
(
'string'
,
$_
->
email
),
can_login
=>
type
(
'boolean'
)
->
value
(
!
(
$_
->
is_disabled
)
),
can_login
=>
$self
->
type
(
'boolean'
,
$_
->
is_disabled
?
0
:
1
),
email_enabled
=>
type
(
'boolean'
)
->
value
(
$_
->
email_enabled
),
email_enabled
=>
$self
->
type
(
'boolean'
,
$_
->
email_enabled
),
login_denied_text
=>
type
(
'string'
)
->
value
(
$_
->
disabledtext
),
login_denied_text
=>
$self
->
type
(
'string'
,
$_
->
disabledtext
),
}}
@user_objects
;
}}
@user_objects
;
}
}
else
{
else
{
@users
=
@users
=
map
{
filter
$params
,
{
map
{
filter
$params
,
{
id
=>
type
(
'int'
)
->
value
(
$_
->
id
),
id
=>
$self
->
type
(
'int'
,
$_
->
id
),
real_name
=>
type
(
'string'
)
->
value
(
$_
->
name
),
real_name
=>
$self
->
type
(
'string'
,
$_
->
name
),
name
=>
type
(
'string'
)
->
value
(
$_
->
login
),
name
=>
$self
->
type
(
'string'
,
$_
->
login
),
email
=>
type
(
'string'
)
->
value
(
$_
->
email
),
email
=>
$self
->
type
(
'string'
,
$_
->
email
),
can_login
=>
type
(
'boolean'
)
->
value
(
!
(
$_
->
is_disabled
)
),
can_login
=>
$self
->
type
(
'boolean'
,
$_
->
is_disabled
?
0
:
1
),
}}
@user_objects
;
}}
@user_objects
;
}
}
...
...
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