我怎么能在脚本中使用Bugzilla的Perl的API时的身份验证? [英] How can I authenticate when using the Bugzilla Perl API in a script?
问题描述
从 Bugzilla的API 工作,我写了一个快速的Perl脚本来克隆一个Bugzilla产品(重建他们的新产品下的所有组件)。 Bugzilla的Perl的API是很容易从命令行中使用。我本来只是工作在数据库中直接,但我想要一个长期的解决方案。另一种选择是web服务,但我想我会尝试直接使用API的这个时候。
Working from the Bugzilla API, I've written a quick Perl script to clone a Bugzilla Product (recreating all the Components under their new Product). The Bugzilla Perl API is quite easy to use from the command line. I could have just worked on the database directly, but I wanted a longer-term solution. Another option was the webservice, but I thought I'd try using the API directly this time.
有一个问题我运行到正在认证作为我的Bz管理员用户,所以我可以创建新的组件。综观Bugzilla的Bugzilla.pm文件,我看到他们只需运行登录()
从的的Bugzilla ::验证对象。我不知道如何获得用户名和密码在那里。我想我可以只添加脚本Bugzilla的管理界面...
The one problem I'm running into is authenticating as my Bz admin user so I can create the new components. Looking at Bugzilla's Bugzilla.pm file, I see that they just run login()
from a Bugzilla::Auth object. I'm not sure how to get the username and password in there. I suppose I could just add the script to the Bugzilla admin interface...
可以任你点我在正确的方向?
Can any of you point me in the right direction?
推荐答案
哦,我是相当无知的今天,我把重点放在Web服务,不明白你真正想要的东西。
Oh, I'm being rather ignorant today, I focused on "web services" and didn't understand what you really wanted.
如果你仅仅使用API来与数据库进行通信(而不是直接操作数据库),你真的需要为任何用户进行身份验证呢?
If you're just using the API to communicate with the database (as opposed to manipulating the database directly), do you really need to authenticate as any user at all?
在3.2源代码树,看看 merge-users.pl
例如,使用的Bugzilla ::用户
对象。你不能做同样的的Bugzilla ::零组件
?
In the 3.2 source tree, look at merge-users.pl
for instance, which uses Bugzilla::User
objects. Couldn't you do the same with Bugzilla::Component
?
您也应该看看 sanitycheck.pl
,它使用 Bugzilla-方式> set_user
You should also look at sanitycheck.pl
, which uses Bugzilla->set_user
.
这篇关于我怎么能在脚本中使用Bugzilla的Perl的API时的身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!