diff --git a/Controller/Component/PrivateSpaceComponent.php b/Controller/Component/PrivateSpaceComponent.php index 05910bc..ffaba5d 100644 --- a/Controller/Component/PrivateSpaceComponent.php +++ b/Controller/Component/PrivateSpaceComponent.php @@ -26,10 +26,6 @@ class PrivateSpaceComponent extends Component { * @return bool */ public function accessCheck(Controller $controller) { - if ($controller->request->params['action'] === 'download') { - return true; - } - if (! Current::read('RolesRoomsUser.user_id') || Current::read('RolesRoomsUser.user_id') !== Current::read('User.id')) { @@ -44,6 +40,10 @@ public function accessCheck(Controller $controller) { return false; } + if ($controller->request->params['action'] === 'download') { + return true; + } + if (! $controller->Session->check('roomAccesse.' . Current::read('RolesRoomsUser.id'))) { $controller->RolesRoomsUser = ClassRegistry::init('Rooms.RolesRoomsUser'); $controller->RolesRoomsUser->saveAccessed(Current::read('RolesRoomsUser.id'));