Skip to content
Snippets Groups Projects
Commit 5e199a66 authored by Andrew Rudenets's avatar Andrew Rudenets
Browse files

Исправление багов, vol.2

parent c8442bad
Branches
Tags
No related merge requests found
......@@ -380,7 +380,8 @@ BEGIN
accounts.Login AS 'AccLogin',
accounts.EMail AS 'AccEMail',
user_roles.Type AS 'AccType',
user_roles.Role AS 'AccRole',
user_roles.RoleName AS 'AccRole',
user_roles.Mark AS 'AccRoleMark',
accounts.isEnabled,
( accounts.ActivationCode IS NULL) AS 'isActivated',
accounts.UserAgent
......
<?php defined('SYSPATH') or die('No direct script access.');
<?php defined('SYSPATH') or die('No direct script access.');
// -- Environment setup --------------------------------------------------------
......@@ -103,7 +103,7 @@ if (isset($_SERVER['KOHANA_ENV']))
* - boolean expose set the X-Powered-By header FALSE
*/
Kohana::init(array(
'base_url' => '/~dev_rating',
'base_url' => '/~dev_rating/',
'index_file' => FALSE
));
......@@ -166,7 +166,7 @@ Route::set('handler', 'handler/<controller>/<action>(/<id>)')
{
if ($request->method() !== HTTP_Request::POST)
{
// Данный маршрут выполним только для POST-запросов
// Данный маршрут выполним только для POST-запросов изнутри фреймворка
return FALSE;
}
});
......
......@@ -7,8 +7,7 @@ class Controller_UserEnvi extends Controller {
{
if(!User::instance()->isSignedIn())
{
//$this->redirect('sign', 302);
throw new Kohana_Exception();
$this->redirect('sign', 302);
}
else
{
......@@ -16,12 +15,13 @@ class Controller_UserEnvi extends Controller {
// Проверка на
$this->UserInfo = User::instance()->getInfoAsArray();
// Проверка на доступ к странице
$route = $this->request->route()->name();
$userMark = User::instance()->getUserMark();
$bitmask = Model_System::factory()->getBitmaskForRoute($route);
$route = Route::name($this->request->route());
$userMark = User::instance()->offsetGet('AccRoleMark');
$sysModel = new Model_System;
$bitmask = $sysModel->getBitmaskForRoute($route);
if(!($bitmask & $userMark))
{
throw HTTP_Exception::factory(403, 'Не пытайтесь попасть туда, куда попадать не следует.');
throw HTTP_Exception::factory(403, 'Не пытайтесь попасть туда, куда попадать не следует: '.$bitmask);
}
}
}
......
<?php defined('SYSPATH') or die('No direct script access.');
class Model_System extends Model
{
public function getBitmaskForRoute($routeName)
{
$sql = "SELECT `GetBitmaskByPagename`('$routeName') AS `Bitmask`; ";
return DB::query(Database::SELECT, $sql)->execute()->get('Bitmask');
}
}
......@@ -87,7 +87,7 @@ class Kohana_User implements ArrayAccess {
protected function completeSignIn($id, $passhash) {
$userHash = $this->hash($id.Request::$user_agent.Request::$client_ip).$this->_config['hash_key'];
$passhash = $this->hash($passhash.$this->_config['hash_key']);
//Cookie::set('userhash', $passhash);
Cookie::set('userhash', $passhash);
$this->_userInfo = $this->_getInfoFromDB($id);
$this->_session->regenerate();
$this->_session->set('ID', $id);
......@@ -218,8 +218,6 @@ class Kohana_User implements ArrayAccess {
{
$info = $this->_model->getPersonalInfoByID($id)->offsetGet(0);
$info += $this->_model->getAccountInfoByID($id)->offsetGet(0);
$info['EMail'] = $info['E-Mail'];
unset($info['E-Mail']);
return $info;
}
......
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