[Bps-public-commit] rt-extension-rest2 branch, master, updated. 2ae83b7fb69722bcf0b621661fcb6d0783fa2bf3
Dustin Graves
dustin at bestpractical.com
Fri Aug 19 18:43:46 EDT 2016
The branch, master has been updated
via 2ae83b7fb69722bcf0b621661fcb6d0783fa2bf3 (commit)
via 70637b13927769e012c7aafc2754f0a5a8ecf628 (commit)
via 922f0a769b846a6a24b0a4510a80602a0633a3e4 (commit)
via abbc2342a7fe274a7460a35fb6cdb2170fcb28df (commit)
via f81d5ce58c114ad66beafa8d3de511206ec4f8ad (commit)
via e94a59177e0201c69f982b5421d6baa319578148 (commit)
via ecb7b2928f32b6cb845f3ad54e6f60f371e97220 (commit)
via 89cb25c08dde9f42bbf54c4d2a62cca9f7d431a8 (commit)
via 365f37a142c2b83f61425d25072cf2b38901bf9e (commit)
via f93601f6e74f9512c2330bcbb18254e610ffc508 (commit)
via 9d502af0b6448a49df9f84b32591ba2aa620cab3 (commit)
via 587abbe7d3549e1e8965dd7ca33d207117a5ceee (commit)
via 5061966e7b20f35203e08cc5a5db6b725645b9b5 (commit)
via 7247997ed9d95bbf8cc47ae632503cf1d262e8e0 (commit)
via 4f3e410e9e3a950a98e3feb7140304da3c2da8db (commit)
via e43c9dc37c2e67f5653279c4eb2883c16d683c28 (commit)
via bdf35e2b6a4410d7d4afded5b7491458f461bdeb (commit)
via e12db290efa01dddf716fd82f34e62c168354a35 (commit)
via f00e2c6c63455c241be7f936f020e891041f9e63 (commit)
via 557ebf82074ef0bae4e266be7acd616ef447bf7d (commit)
via e8aa04b8627769697c85a473a452b841da6ba2f9 (commit)
via bea2682a72c2490e0368ed9d4b6882d59656d7a7 (commit)
via d13a644476daac39ea7816880620638475851007 (commit)
via 4a0108ff1a6fd8baf9bffc1b6f744b7b922bbf34 (commit)
via 2739444376a25cc80441260cb9124dbfca47a44e (commit)
via c7e1b4932e33fcd8820e5587a40737fafd2838c9 (commit)
via 70fa060ca2b47bba0676c86c3253951a21581881 (commit)
via 5a110da85209db83fb427da4a4ba47dd8d744c7a (commit)
via 409245a6ed745abe4760733dc8874c0b10c8fcb4 (commit)
via 0059391a7cf78d86d2b26087351724c6f40e18ca (commit)
via b2cd8a1b06e0ddc51312e137ab58ed7fec7e2d08 (commit)
via bb549d006e8fca3323a519879aec40411c92addf (commit)
via c9a53e942ff3641b6b6127a25e55e283bf4d177a (commit)
via 1dfe47a1b3319f1233d0b4604894d69080ae1d0c (commit)
via 5a80160e4b2e3b8f1833dd8ca1296b7d484bc9b2 (commit)
from a9ebfa0a19354f86c06b0b10be75f9b583355c4b (commit)
Summary of changes:
Makefile.PL | 2 +
TODO | 2 +
lib/RT/Extension/REST2.pm | 21 +--
lib/RT/Extension/REST2/Dispatcher.pm | 23 ++--
lib/RT/Extension/REST2/Middleware/ErrorAsJSON.pm | 30 +++++
lib/RT/Extension/REST2/PodViewer.pm | 4 +-
lib/RT/Extension/REST2/PodViewer/HTMLView.pm | 42 ++++++
.../REST2/Resource/{Queue.pm => Catalog.pm} | 2 +-
.../REST2/Resource/{Queues.pm => Catalogs.pm} | 2 +-
lib/RT/Extension/REST2/Resource/Collection.pm | 5 +-
lib/RT/Extension/REST2/Resource/Record.pm | 12 +-
lib/RT/Extension/REST2/Resource/Record/Readable.pm | 7 +-
lib/RT/Extension/REST2/Resource/Record/Writable.pm | 2 +-
lib/RT/Extension/REST2/Resource/Ticket.pm | 7 -
lib/RT/Extension/REST2/Resource/Tickets.pm | 3 +-
lib/RT/Extension/REST2/Util.pm | 23 +++-
t/acceptance/main.t | 57 ++++++++
t/acceptance/not_found.t | 52 ++++++++
t/acceptance/tickets.t | 148 +++++++++++++++++++++
t/lib/RT/Extension/REST2/Test.pm | 41 ++++++
20 files changed, 432 insertions(+), 53 deletions(-)
create mode 100644 lib/RT/Extension/REST2/Middleware/ErrorAsJSON.pm
create mode 100644 lib/RT/Extension/REST2/PodViewer/HTMLView.pm
copy lib/RT/Extension/REST2/Resource/{Queue.pm => Catalog.pm} (87%)
copy lib/RT/Extension/REST2/Resource/{Queues.pm => Catalogs.pm} (81%)
create mode 100644 t/acceptance/main.t
create mode 100644 t/acceptance/not_found.t
create mode 100644 t/acceptance/tickets.t
create mode 100644 t/lib/RT/Extension/REST2/Test.pm
- Log -----------------------------------------------------------------
commit abbc2342a7fe274a7460a35fb6cdb2170fcb28df
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri Aug 19 21:12:33 2016 +0000
fix tickets tests reflecting new empty search results behavior from e94a59177 and fixed _url property from ecb7b2928
diff --git a/t/acceptance/tickets.t b/t/acceptance/tickets.t
index 23459e0..663afcf 100644
--- a/t/acceptance/tickets.t
+++ b/t/acceptance/tickets.t
@@ -16,10 +16,9 @@ my $user = RT::Extension::REST2::Test->user;
ok(my $res = $mech->get(
$rest_base_path . '/tickets?query=id>0', 'Authorization' => $auth
));
- is($res->code, 404, 'DB empty, so no tickets found');
like($res->header('content-type'), qr{application/json});
ok(my $data = $json->decode($res->content));
- is($data->{message}, 'No tickets found');
+ is($data->{count}, 0);
}
# Parameter Validation
@@ -90,7 +89,7 @@ my ($ticket_url, $ticket_id);
{
# Rights Test - No ShowTicket
$mech->get(
- $rest_base_path . $ticket_url, 'Authorization' => $auth
+ $ticket_url, 'Authorization' => $auth
);
my $res = $mech->res;
is($res->code, 403);
@@ -98,7 +97,7 @@ my ($ticket_url, $ticket_id);
# Rights Test - With ShowTicket
$user->PrincipalObj->GrantRight( Right => 'ShowTicket' );
$mech->get_ok(
- $rest_base_path . $ticket_url, [Authorization => $auth]
+ $ticket_url, [Authorization => $auth]
);
$res = $mech->res;
is($res->code, 200);
commit 922f0a769b846a6a24b0a4510a80602a0633a3e4
Merge: a9ebfa0 abbc234
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri Aug 19 21:15:11 2016 +0000
Merge branch 'dev'
commit 70637b13927769e012c7aafc2754f0a5a8ecf628
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri Aug 19 21:28:02 2016 +0000
remove redundant Ticket forbidden check - handled by Catch-All CurrentUserCanSee
diff --git a/lib/RT/Extension/REST2/Resource/Ticket.pm b/lib/RT/Extension/REST2/Resource/Ticket.pm
index 99b26d8..6995ffc 100644
--- a/lib/RT/Extension/REST2/Resource/Ticket.pm
+++ b/lib/RT/Extension/REST2/Resource/Ticket.pm
@@ -10,13 +10,6 @@ with 'RT::Extension::REST2::Resource::Record::Readable';
with 'RT::Extension::REST2::Resource::Record::Deletable';
with 'RT::Extension::REST2::Resource::Record::Writable';
-sub forbidden {
- my $self = shift;
- return 0 if not $self->record->id;
- return 0 if $self->record->CurrentUserHasRight("ShowTicket");
- return 1;
-}
-
sub create_record {
my $self = shift;
my $data = shift;
commit 2ae83b7fb69722bcf0b621661fcb6d0783fa2bf3
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri Aug 19 22:23:21 2016 +0000
add basic Catalog support
diff --git a/lib/RT/Extension/REST2/Resource/Catalog.pm b/lib/RT/Extension/REST2/Resource/Catalog.pm
new file mode 100644
index 0000000..b086936
--- /dev/null
+++ b/lib/RT/Extension/REST2/Resource/Catalog.pm
@@ -0,0 +1,15 @@
+package RT::Extension::REST2::Resource::Catalog;
+use strict;
+use warnings;
+
+use Moose;
+use namespace::autoclean;
+
+extends 'RT::Extension::REST2::Resource::Record';
+with 'RT::Extension::REST2::Resource::Record::Readable';
+with 'RT::Extension::REST2::Resource::Record::DeletableByDisabling';
+with 'RT::Extension::REST2::Resource::Record::Writable';
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/lib/RT/Extension/REST2/Resource/Catalogs.pm b/lib/RT/Extension/REST2/Resource/Catalogs.pm
new file mode 100644
index 0000000..52b29de
--- /dev/null
+++ b/lib/RT/Extension/REST2/Resource/Catalogs.pm
@@ -0,0 +1,13 @@
+package RT::Extension::REST2::Resource::Catalogs;
+use strict;
+use warnings;
+
+use Moose;
+use namespace::autoclean;
+
+extends 'RT::Extension::REST2::Resource::Collection';
+with 'RT::Extension::REST2::Resource::Collection::QueryByJSON';
+
+__PACKAGE__->meta->make_immutable;
+
+1;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list