Commit 760a5c27 authored by Pastor Mickaël's avatar Pastor Mickaël
Browse files

Related to #326 => Softwares users relationships => Post a review FIXED

parent 13f23208
......@@ -55,11 +55,11 @@ Router::scope('/', function ($routes) {
// MAP FOR ADDITIONAL ACTION WITH GET METHOD
'servicesProviders/:id' => [
'action' => 'servicesProviders',
'method' => 'GET'
'method' => ['GET','POST']
],
'usersSoftware/:id' => [
'action' => 'usersSoftware',
'method' => 'GET'
'method' => ['GET','POST']
],
'alternativeTo/:id' => [
'action' => 'alternativeTo',
......
......@@ -12,14 +12,12 @@ class ReviewsController extends AppController
public function isAuthorized($user)
{
if ($this->Auth->identify()){
if ($this->Auth->user()){
if ($this->request->action === 'add'){
$this->loadModel("Users");
return $this->Users->isAdministration($this->Auth->user('id'));
}
}
return parent::isAuthorized($user); // TODO: Change the autogenerated stub
}
public function beforeFilter(\Cake\Event\Event $event)
......
......@@ -12,6 +12,7 @@
* @since 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Controller;
use Cake\Controller\Controller;
......@@ -38,7 +39,7 @@ class AppController extends Controller
public $validator;
public $errors ;
public $errors;
protected $availableLanguages = [
'en' => 'en',
......@@ -75,6 +76,7 @@ class AppController extends Controller
$this->loadComponent('Flash');
$this->loadComponent('Auth', [
'authorize' => ['Controller'],
'logoutRedirect' => [
'controller' => 'Pages',
'action' => 'index',
......@@ -100,7 +102,7 @@ class AppController extends Controller
public function isAuthorized($user)
{
//Allow all get action
if ($this->request->is('get')){
if ($this->request->is('get')) {
return true;
}
......@@ -132,30 +134,30 @@ class AppController extends Controller
}
}
public function beforeFilter(Event $event)
{
$this->Auth->allow(['index','logout','view','request','search']);
$this->Auth->allow(['index', 'logout', 'view', 'request', 'search']);
$this->setLocale();
$this->setOpenGraph();
parent::beforeFilter($event);
}
private function setOpenGraph(){
private function setOpenGraph()
{
//For Social MEDIAS => OPENGRAPH
$openGraph = [
"title" => Configure::read("OpenGraph.title"),
"title" => Configure::read("OpenGraph.title"),
"description" => Configure::read("OpenGraph.description"),
"image" => Configure::read("OpenGraph.image"),
"imageSize" => ['width' => '200', 'height' => '300']
];
$card = [
"title" => Configure::read("OpenGraph.title"),
"title" => Configure::read("OpenGraph.title"),
"description" => Configure::read("OpenGraph.description"),
"image" => Configure::read("OpenGraph.image"),
"imageSize" => ['width' => '200', 'height' => '300']
......@@ -174,7 +176,7 @@ class AppController extends Controller
protected function setLocale()
{
$selectedLanguage = I18n::locale();
$lang = $this->request->param('language') ? $this->request->param('language') : preg_replace('/_\w*/',"",I18n::locale());
$lang = $this->request->param('language') ? $this->request->param('language') : preg_replace('/_\w*/', "", I18n::locale());
if ($lang && isset($this->availableLanguages[$lang])) {
I18n::locale($lang);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment