@@ -93,6 +93,7 @@ public function register($category, $path, $mainContextId = null) {
93
93
HookRegistry::register ('LoadHandler ' , array ($ this , 'callbackLoadHandler ' ));
94
94
HookRegistry::register ('NotificationManager::getNotificationContents ' , array ($ this , 'callbackNotificationContents ' ));
95
95
HookRegistry::register ('LoadComponentHandler ' , array ($ this , 'setupComponentHandlers ' ));
96
+ $ this ->_disableRestrictions ();
96
97
}
97
98
98
99
HookRegistry::register ('AcronPlugin::parseCronTab ' , array ($ this , 'callbackParseCronTab ' ));
@@ -118,6 +119,31 @@ public function setupComponentHandlers($hookName, $params) {
118
119
return false ;
119
120
}
120
121
122
+ /**
123
+ * When the request is supposed to be handled by the plugin, this method will disable:
124
+ * - Redirecting non-logged users (the staging server) at contexts protected by login
125
+ * - Redirecting non-logged users (the staging server) at non-public contexts to the login page (see more at: PKPPageRouter::route())
126
+ */
127
+ private function _disableRestrictions () {
128
+ $ request = $ this ->getRequest ();
129
+ // Avoid issues with the APIRouter
130
+ if (!($ request ->getRouter () instanceof PageRouter)) {
131
+ return ;
132
+ }
133
+
134
+ $ page = $ request ->getRequestedPage ();
135
+ $ operation = $ request ->getRequestedOp ();
136
+ $ arguments = $ request ->getRequestedArgs ();
137
+ if ([$ page , $ operation ] === ['pln ' , 'deposits ' ] || [$ page , $ operation , $ arguments [0 ] ?? '' ] === ['gateway ' , 'plugin ' , 'PLNGatewayPlugin ' ]) {
138
+ define ('SESSION_DISABLE_INIT ' , true );
139
+ HookRegistry::register ('RestrictedSiteAccessPolicy::_getLoginExemptions ' , function ($ hookName , $ args ) {
140
+ $ exemptions =& $ args [0 ];
141
+ array_push ($ exemptions , 'gateway ' , 'pln ' );
142
+ return false ;
143
+ });
144
+ }
145
+ }
146
+
121
147
/**
122
148
* @copydoc Plugin::getActions()
123
149
*/
0 commit comments