Ignore:
Timestamp:
Jul 15, 2014, 9:48:54 PM (10 years ago)
Author:
chronos
Message:
  • Přidáno: Přístup k RSS kanálům přes přístupový token.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/User/User.php

    r662 r668  
    285285    {
    286286      // If no permission combination exists in cache, do new check of database items
    287       $DbResult = $this->Database->select('PermissionGroupAssignment', '*', '`Group`="'.$GroupId.'" AND `AssignedGroup` IS NOT NULL');
     287      $DbResult = $this->Database->select('PermissionGroupAssignment', '*', '(`Group`="'.$GroupId.
     288        '") AND (`AssignedGroup` IS NOT NULL)');
    288289      $DbRow = array();
    289290      while($DbRow[] = $DbResult->fetch_array());
    290       $this->PermissionGroupCache[$GroupId] = $DbRow;
     291        $this->PermissionGroupCache[$GroupId] = $DbRow;
    291292      $PermissionExists = true;
    292293    }
     
    337338    {
    338339      // If no permission combination exists in cache, do new check of database items
    339       $DbResult = $this->Database->select('PermissionOperation', 'Id', '`Module`="'.$ModuleId.'" AND `Item`="'.$ItemType.'" AND `ItemId`='.$ItemIndex.' AND `Operation`="'.$Operation.'"');
     340      $DbResult = $this->Database->select('PermissionOperation', 'Id', '(`Module`="'.$ModuleId.
     341        '") AND (`Item`="'.$ItemType.'") AND (`ItemId`='.$ItemIndex.') AND (`Operation`="'.$Operation.'")');
    340342      if($DbResult->num_rows > 0)
    341343      {
     
    414416    } else $Output = USER_NOT_FOUND;
    415417    return($Output);
     418  }
     419
     420  function CheckToken($Module, $Operation, $Token)
     421  {
     422    $DbResult = $this->Database->select('APIToken', 'User', '`Token`="'.$Token.'"');
     423    if($DbResult->num_rows > 0)
     424    {
     425      $DbRow = $DbResult->fetch_assoc();
     426      $User = new User($this->System);
     427      $User->User = array('Id' => $DbRow['User']);
     428      return($User->CheckPermission($Module, $Operation));
     429    } else return(false);
    416430  }
    417431}
     
    583597      ),
    584598    ));
     599    $this->System->FormManager->RegisterClass('APIToken', array(
     600      'Title' => 'Přístupový token',
     601      'Table' => 'APIToken',
     602      'Items' => array(
     603        'User' => array('Type' => 'TUser', 'Caption' => 'Uživatel', 'Default' => ''),
     604        'Token' => array('Type' => 'String', 'Caption' => 'Token', 'Default' => ''),
     605      ),
     606    ));
    585607    $this->System->FormManager->RegisterClass('User', array(
    586608      'Title' => 'Uživatelé',
Note: See TracChangeset for help on using the changeset viewer.