summaryrefslogtreecommitdiffstats
path: root/extensions/PhabBugz/lib
diff options
context:
space:
mode:
authordklawren <dklawren@users.noreply.github.com>2018-03-02 21:20:43 +0100
committerGitHub <noreply@github.com>2018-03-02 21:20:43 +0100
commit34b8e7eda7b6edddcf736dcd8f28dc9027391679 (patch)
tree4ab1d8a93bb94dbdc394eeda96e2686e8de5c98a /extensions/PhabBugz/lib
parent785a05910108a6d032e802605762d7567dec4123 (diff)
downloadbugzilla-34b8e7eda7b6edddcf736dcd8f28dc9027391679.tar.gz
bugzilla-34b8e7eda7b6edddcf736dcd8f28dc9027391679.tar.xz
Bug 1402494 - BMO Integration User is a full administrative user on Phabricator
Diffstat (limited to 'extensions/PhabBugz/lib')
-rw-r--r--extensions/PhabBugz/lib/Policy.pm5
-rw-r--r--extensions/PhabBugz/lib/Project.pm12
-rw-r--r--extensions/PhabBugz/lib/Util.pm32
3 files changed, 32 insertions, 17 deletions
diff --git a/extensions/PhabBugz/lib/Policy.pm b/extensions/PhabBugz/lib/Policy.pm
index 23f04b354..8162ac52c 100644
--- a/extensions/PhabBugz/lib/Policy.pm
+++ b/extensions/PhabBugz/lib/Policy.pm
@@ -117,7 +117,10 @@ sub create {
};
}
else {
- push @{ $data->{policy} }, { action => 'allow', value => 'admin' };
+ my $secure_revision = Bugzilla::Extension::PhabBugz::Project->new_from_query({
+ name => 'secure-revision'
+ });
+ push @{ $data->{policy} }, { action => 'allow', value => $secure_revision->phid };
}
my $result = request('policy.create', $data);
diff --git a/extensions/PhabBugz/lib/Project.pm b/extensions/PhabBugz/lib/Project.pm
index fd09cbecf..b0babc58b 100644
--- a/extensions/PhabBugz/lib/Project.pm
+++ b/extensions/PhabBugz/lib/Project.pm
@@ -93,9 +93,9 @@ sub BUILDARGS {
# "dateCreated": 1500403964,
# "dateModified": 1505248862,
# "policy": {
-# "view": "admin",
-# "edit": "admin",
-# "join": "admin"
+# "view": "secure-revision",
+# "edit": "secure-revision",
+# "join": "secure-revision"
# },
# "description": "BMO Security Group for core-security"
# },
@@ -138,9 +138,9 @@ sub create {
$name || ThrowCodeError( 'param_required', { param => 'name' } );
my $description = $params->{description} || 'Need description';
- my $view_policy = $params->{view_policy} || 'admin';
- my $edit_policy = $params->{edit_policy} || 'admin';
- my $join_policy = $params->{join_policy} || 'admin';
+ my $view_policy = $params->{view_policy};
+ my $edit_policy = $params->{edit_policy};
+ my $join_policy = $params->{join_policy};
my $data = {
transactions => [
diff --git a/extensions/PhabBugz/lib/Util.pm b/extensions/PhabBugz/lib/Util.pm
index 5658ac9d8..6c51df98c 100644
--- a/extensions/PhabBugz/lib/Util.pm
+++ b/extensions/PhabBugz/lib/Util.pm
@@ -167,10 +167,13 @@ sub create_private_revision_policy {
);
}
else {
+ my $secure_revision = Bugzilla::Extension::PhabBugz::Project->new_from_query({
+ name => 'secure-revision'
+ });
push(@{ $data->{policy} },
{
action => 'allow',
- value => 'admin',
+ value => $secure_revision->phid,
}
);
}
@@ -198,15 +201,20 @@ sub make_revision_public {
sub make_revision_private {
my ($revision_phid) = @_;
+
+ my $secure_revision = Bugzilla::Extension::PhabBugz::Project->new_from_query({
+ name => 'secure-revision'
+ });
+
return request('differential.revision.edit', {
transactions => [
{
type => "view",
- value => "admin"
+ value => $secure_revision->phid
},
{
type => "edit",
- value => "admin"
+ value => $secure_revision->phid
}
],
objectIdentifier => $revision_phid
@@ -298,15 +306,19 @@ sub get_project_phid {
sub create_project {
my ($project, $description, $members) = @_;
+ my $secure_revision = Bugzilla::Extension::PhabBugz::Project->new_from_query({
+ name => 'secure-revision'
+ });
+
my $data = {
transactions => [
- { type => 'name', value => $project },
- { type => 'description', value => $description },
- { type => 'edit', value => 'admin' },
- { type => 'join', value => 'admin' },
- { type => 'view', value => 'admin' },
- { type => 'icon', value => 'group' },
- { type => 'color', value => 'red' }
+ { type => 'name', value => $project },
+ { type => 'description', value => $description },
+ { type => 'edit', value => $secure_revision->phid }.
+ { type => 'join', value => $secure_revision->phid },
+ { type => 'view', value => $secure_revision->phid },
+ { type => 'icon', value => 'group' },
+ { type => 'color', value => 'red' }
]
};