summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/PhabBugz/Extension.pm13
-rw-r--r--extensions/PhabBugz/lib/Config.pm20
-rw-r--r--extensions/PhabBugz/template/en/default/admin/params/phabbugz.html.tmpl2
3 files changed, 35 insertions, 0 deletions
diff --git a/extensions/PhabBugz/Extension.pm b/extensions/PhabBugz/Extension.pm
index 501fbc65d..1ba1609f5 100644
--- a/extensions/PhabBugz/Extension.pm
+++ b/extensions/PhabBugz/Extension.pm
@@ -20,4 +20,17 @@ sub config_add_panels {
$modules->{PhabBugz} = "Bugzilla::Extension::PhabBugz::Config";
}
+sub auth_delegation_confirm {
+ my ($self, $args) = @_;
+ my $phab_callback_url = Bugzilla->params->{phabricator_auth_callback_url};
+ my $phab_app_id = Bugzilla->params->{phabricator_app_id};
+
+ return unless $phab_callback_url;
+ return unless $phab_app_id;
+
+ if (index($args->{callback}, $phab_callback_url) == 0 && $args->{app_id} eq $phab_app_id) {
+ ${$args->{skip_confirmation}} = 1;
+ }
+}
+
__PACKAGE__->NAME;
diff --git a/extensions/PhabBugz/lib/Config.pm b/extensions/PhabBugz/lib/Config.pm
index 686198a25..a0b7ef2e5 100644
--- a/extensions/PhabBugz/lib/Config.pm
+++ b/extensions/PhabBugz/lib/Config.pm
@@ -35,6 +35,26 @@ sub get_param_list {
type => 't',
default => '',
},
+ {
+ name => 'phabricator_auth_callback_url',
+ type => 't',
+ default => '',
+ checker => sub {
+ my ($url) = (@_);
+ return 'must be an HTTP/HTTPS absolute URL' unless $url =~ m{^https?://};
+ return '';
+ }
+ },
+ {
+ name => 'phabricator_app_id',
+ type => 't',
+ default => '',
+ checker => sub {
+ my ($app_id) = (@_);
+ return 'must be a hex number' unless $app_id =~ /^[[:xdigit:]]+$/;
+ return '';
+ }
+ }
);
return @params;
diff --git a/extensions/PhabBugz/template/en/default/admin/params/phabbugz.html.tmpl b/extensions/PhabBugz/template/en/default/admin/params/phabbugz.html.tmpl
index 922fcf709..6eb16d993 100644
--- a/extensions/PhabBugz/template/en/default/admin/params/phabbugz.html.tmpl
+++ b/extensions/PhabBugz/template/en/default/admin/params/phabbugz.html.tmpl
@@ -16,5 +16,7 @@
phabricator_base_uri => 'Phabricator Base URI',
phabricator_api_key => 'Phabricator User API Key',
phabricator_sync_groups => 'Comma delimited list of Bugzilla groups to sync to Phabricator projects',
+ phabricator_auth_callback_url => 'Phabricator Auth Delegation URL',
+ phabricator_app_id => 'app_id for API Keys delegated to Phabricator',
}
%]