Ignore:
Timestamp:
Aug 9, 2023, 7:36:56 PM (9 months ago)
Author:
chronos
Message:
  • Fixed: Checking group permission error.
File:
1 edited

Legend:

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

    r934 r952  
    302302
    303303  function CheckGroupPermission(string $GroupId, string $OperationId): bool
    304   {
     304  {   
    305305    $PermissionExists = false;
    306306    // First try to check cache group-group relation
     
    326326      {
    327327        if ($DbRow['AssignedGroup'] != '')
    328         if ($this->CheckGroupPermission($DbRow['AssignedGroup'], $OperationId) == true) return true;
     328        {
     329          if ($this->CheckGroupPermission($DbRow['AssignedGroup'], $OperationId) == true) return true;
     330        }
    329331      }
    330332    }
     
    383385
    384386    if ($PermissionExists)
    385     {
    386       if ($this->User['Id'] == null) $UserCondition = '(`User` IS NULL)';
     387    {     
     388      if ($this->User == null or $this->User['Id'] == null) $UserCondition = '(`User` IS NULL)';
    387389        else $UserCondition = '(`User`="'.$this->User['Id'].'")';
    388390      // Check user-operation relation
     
    390392      if ($DbResult->num_rows > 0) return true;
    391393
     394     
    392395      // Check user-group relation
    393       $DbResult = $this->Database->select('PermissionUserAssignment', 'AssignedGroup', $UserCondition);
     396      $DbResult = $this->Database->select('PermissionUserAssignment', 'AssignedGroup', '(`AssignedGroup` IS NOT NULL) AND '.$UserCondition);
    394397      while ($DbRow = $DbResult->fetch_array())
    395398      {
    396        if ($this->CheckGroupPermission($DbRow['AssignedGroup'], $OperationId) == true) return true;
     399        if ($this->CheckGroupPermission($DbRow['AssignedGroup'], $OperationId) == true) return true;
    397400      }
    398401      return false;
Note: See TracChangeset for help on using the changeset viewer.