Changeset 515 for trunk/Common/User.php


Ignore:
Timestamp:
Apr 8, 2013, 11:15:52 PM (11 years ago)
Author:
chronos
Message:
  • Opraveno: Načítání oprávnění anonymního uživatele. Dříve byl uživatel identifikován předvoleným číslem, nyní je použita hodnota NULL.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/User.php

    r493 r515  
    113113    else
    114114    {
    115       // Je uživatel registrován?
     115      // Is user registred yet?
    116116      $Query = $this->Database->select('User', '*', 'Login = "'.$Login.'"');
    117117      if($Query->num_rows > 0) $Result = LOGIN_USED;
     
    138138            $NewPassword = substr(sha1(strtoupper($Login)), 0, 7);
    139139           
     140            // Send activation mail to user email
    140141            $Mail = new Mail();
    141142            $Mail->Subject = 'Registrace nového účtu';
     
    194195        $this->Database->update('User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => GetRemoteAddress()));           
    195196        $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $Row['Id']));
    196         // načtení stavu stromu
     197       
    197198        $Result = USER_LOGGED_IN;
    198199        $this->Check();
     
    289290  function CheckPermission($Module, $Operation, $ItemType = '', $ItemIndex = 0)
    290291  {
    291     //echo('Check '.$Module.' '.$Operation.' '.$ItemType.' '.$ItemIndex);
    292     //
    293292    // First try to check cache
    294293    if(in_array(array($Module, $Operation, $ItemType, $ItemType), $this->PermissionCache))
     
    315314    if($PermissionExists)
    316315    {
     316      if($this->User['Id'] == null) $UserCondition = '(`User` IS NULL)';
     317        else $UserCondition = '(`User`="'.$this->User['Id'].'")';
    317318      // Check user-operation relation
    318       $DbResult = $this->Database->select('PermissionUserAssignment', '*', '`User`="'.$this->User['Id'].'" AND `AssignedOperation`="'.$OperationId.'"');
     319      $DbResult = $this->Database->select('PermissionUserAssignment', '*', $UserCondition.' AND (`AssignedOperation`="'.$OperationId.'")');     
    319320      if($DbResult->num_rows > 0) return(true);
    320321
    321322      // Check user-group relation
    322       $DbResult = $this->Database->select('PermissionUserAssignment', 'AssignedGroup', '`User`="'.$this->User['Id'].'"');
     323      $DbResult = $this->Database->select('PermissionUserAssignment', 'AssignedGroup', $UserCondition);
    323324      while($DbRow = $DbResult->fetch_array())
    324325      {
Note: See TracChangeset for help on using the changeset viewer.