Skip to content

Commit

Permalink
Merge pull request #3517 from bozana/6781
Browse files Browse the repository at this point in the history
pkp/pkp-lib#6781 Opt-out for public SUSHI API
  • Loading branch information
bozana authored Sep 12, 2022
2 parents 8059a22 + fbf6b0e commit 13a7ef8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion api/v1/issues/IssueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
use APP\issue\Collector;
use APP\security\authorization\OjsIssueRequiredPolicy;
use APP\security\authorization\OjsJournalMustPublishPolicy;
use Illuminate\Support\LazyCollection;
use PKP\db\DAORegistry;
use PKP\handler\APIHandler;
use PKP\plugins\Hook;
use PKP\security\authorization\ContextAccessPolicy;
use PKP\security\authorization\ContextRequiredPolicy;
use PKP\security\authorization\UserRolesRequiredPolicy;
use PKP\security\Role;
use Illuminate\Support\LazyCollection;

class IssueHandler extends APIHandler
{
Expand Down Expand Up @@ -77,6 +78,7 @@ public function authorize($request, &$args, $roleAssignments)
$routeName = $route->getName();
}

$this->addPolicy(new UserRolesRequiredPolicy($request), true);
$this->addPolicy(new ContextRequiredPolicy($request));
$this->addPolicy(new ContextAccessPolicy($request, $roleAssignments));
$this->addPolicy(new OjsJournalMustPublishPolicy($request));
Expand Down
3 changes: 3 additions & 0 deletions api/v1/stats/issues/StatsIssueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use PKP\security\authorization\ContextAccessPolicy;
use PKP\security\authorization\PolicySet;
use PKP\security\authorization\RoleBasedHandlerOperationPolicy;
use PKP\security\authorization\UserRolesRequiredPolicy;
use PKP\security\Role;
use Slim\Http\Request as SlimHttpRequest;

Expand Down Expand Up @@ -74,6 +75,8 @@ public function authorize($request, &$args, $roleAssignments)
$routeName = null;
$slimRequest = $this->getSlimRequest();

$this->addPolicy(new UserRolesRequiredPolicy($request), true);

$this->addPolicy(new ContextAccessPolicy($request, $roleAssignments));

$rolePolicy = new PolicySet(PolicySet::COMBINING_PERMIT_OVERRIDES);
Expand Down
5 changes: 2 additions & 3 deletions api/v1/stats/sushi/StatsSushiHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ class StatsSushiHandler extends \PKP\API\v1\stats\sushi\PKPStatsSushiHandler
/**
* Get this API's endpoints definitions
*/
protected function getGETDefinitions(): array
protected function getGETDefinitions(array $roles = null): array
{
$roles = [];
return array_merge(
parent::getGETDefinitions(),
parent::getGETDefinitions($roles),
[
[
'pattern' => $this->getEndpointPattern() . '/reports/tr',
Expand Down
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 32 files
+3 −0 api/v1/_dois/PKPBackendDoiHandler.php
+3 −1 api/v1/_email/PKPEmailHandler.php
+3 −0 api/v1/_library/PKPLibraryHandler.php
+3 −0 api/v1/_payments/PKPBackendPaymentsSettingsHandler.php
+4 −1 api/v1/_submissions/PKPBackendSubmissionsHandler.php
+3 −0 api/v1/_uploadPublicFile/PKPUploadPublicFileHandler.php
+3 −0 api/v1/announcements/PKPAnnouncementHandler.php
+3 −0 api/v1/contexts/PKPContextHandler.php
+3 −0 api/v1/dois/PKPDoiHandler.php
+3 −0 api/v1/emailTemplates/PKPEmailTemplateHandler.php
+3 −0 api/v1/institutions/PKPInstitutionHandler.php
+3 −0 api/v1/mailables/MailableHandler.php
+3 −0 api/v1/site/PKPSiteHandler.php
+2 −0 api/v1/stats/contexts/PKPStatsContextHandler.php
+3 −0 api/v1/stats/editorial/PKPStatsEditorialHandler.php
+3 −0 api/v1/stats/publications/PKPStatsPublicationHandler.php
+26 −3 api/v1/stats/sushi/PKPStatsSushiHandler.php
+3 −0 api/v1/stats/users/PKPStatsUserHandler.php
+3 −0 api/v1/submissions/PKPSubmissionFileHandler.php
+4 −1 api/v1/submissions/PKPSubmissionHandler.php
+3 −0 api/v1/temporaryFiles/PKPTemporaryFilesHandler.php
+2 −0 api/v1/users/PKPUserHandler.php
+3 −0 api/v1/vocabs/PKPVocabHandler.php
+13 −1 classes/components/forms/context/PKPContextStatisticsForm.php
+14 −1 classes/components/forms/site/PKPSiteStatisticsForm.php
+2 −3 classes/handler/PKPHandler.php
+2 −0 classes/install/PKPInstall.php
+2 −0 classes/plugins/PluginHelper.php
+9 −0 locale/en_US/manager.po
+3 −2 pages/management/ManagementHandler.php
+5 −0 schemas/context.json
+5 −0 schemas/site.json

0 comments on commit 13a7ef8

Please sign in to comment.