Changeset 584 for trunk/Modules


Ignore:
Timestamp:
Oct 31, 2013, 4:57:11 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Kontrola oprávnění při zobrazení informačního systému.
  • Přidáno: Tabulka Module pro seznam existujících modulů.
  • Upraveno: PermissionOperation se nyní odkazuje na id modulu.
Location:
trunk/Modules
Files:
6 edited

Legend:

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

    r581 r584  
    7575  {
    7676    $Output = '';
     77    if(!$this->System->User->CheckPermission($Table, 'Write'))
     78      return('Nemáte oprávnění');
    7779    if(array_key_exists('o', $_GET))
    7880    {
     
    123125  {
    124126    $Output = '';
     127    if(!$this->System->User->CheckPermission($Table, 'Write'))
     128      return('Nemáte oprávnění');
    125129    $this->Database->delete($Table, 'Id='.$Id);
    126130    $Output .= $this->SystemMessage('Odstranění položky', 'Položka odstraněna');
     
    132136  {
    133137    $Output = '';
     138    if(!$this->System->User->CheckPermission($Table, 'Write'))
     139      return('Nemáte oprávnění');
    134140    if(array_key_exists('o', $_GET))
    135141    {
     
    182188    if($Table != '') $FormClass = $this->System->FormManager->Classes[$Table];
    183189      else return($this->SystemMessage('Chyba', 'Tabulka nenalezena'));
     190    if(!$this->System->User->CheckPermission($Table, 'Read'))
     191      return('Nemáte oprávnění');
    184192   
    185193    $Form = new Form($this->System->FormManager);
     
    383391  function ShowSelect($Table, $Filter = '', $Title = '')
    384392  {
     393    if(!$this->System->User->CheckPermission($Table, 'Read'))
     394      return('Nemáte oprávnění');
    385395    $this->BasicHTML = true;
    386396    $this->HideMenu = true;
     
    394404  function ShowMapSelect($Table, $Filter = '', $Title = '')
    395405  {
     406    if(!$this->System->User->CheckPermission($Table, 'Write'))
     407      return('Nemáte oprávnění');
    396408    $MapApi = new MapApiGoogle($this->System);
    397409    $MapApi->Position = array('Lat' => $this->System->Config['Map']['DefaultLatitude'],
     
    407419  function ShowList($Table, $Filter = '', $Title = '', $ExcludeColumn = '') 
    408420  {
     421    if(!$this->System->User->CheckPermission($Table, 'Read'))
     422      return('Nemáte oprávnění');
    409423    $RowActions = '<a href="?a=view&amp;t='.$Table.'&amp;i=#RowId"><img alt="Ukázat" title="Ukázat" src="'.
    410424      $this->System->Link('/images/view.png').'"/></a>'.
     
    521535        'Items' => array('Type' => 'TMenuItemListMenu', 'Caption' => 'Položky'),
    522536      ),
    523     ));
    524    
     537    ));   
    525538  } 
    526539 
  • trunk/Modules/NetworkConfigLinux/Generators/DNS.php

    r569 r584  
    117117  'Host' => array(),
    118118  'Alias' => array(),
    119   'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', '10.145.68', '10.145.69', '10.145.70', '10.145.71', '77.92.221', '172.16.0', '172.16.1'),
     119  'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67',
     120    '10.145.68', '10.145.69', '10.145.70', '10.145.71', '77.92.221', '172.16.0',
     121    '172.16.1'),
    120122);
    121123
  • trunk/Modules/NetworkShare/SharePage.php

    r548 r584  
    6868  function Show()
    6969  {
    70     if(!$this->System->User->CheckPermission('Share', 'Display')) return('Nemáte oprávnění');
     70    if(!$this->System->User->CheckPermission('NetworkShare', 'Display')) return('Nemáte oprávnění');
    7171
    7272    // If not only online checkbox checked
  • trunk/Modules/OpeningHours/OpeningHours.php

    r548 r584  
    3636  function EditSubject($Id)
    3737  {
    38     if($this->System->User->CheckPermission('SubjectOpenTime', 'Edit'))
     38    if($this->System->User->CheckPermission('OpeningHours', 'Edit'))
    3939    {
    4040      $Output = '<div class="Centred">';
     
    7878   
    7979    $Output = '';
    80     if($this->System->User->CheckPermission('SubjectOpenTime', 'Edit'))
     80    if($this->System->User->CheckPermission('OpeningHours', 'Edit'))
    8181    {
    8282      $this->Database->delete('SubjectOpenTimeDay', 'Subject='.$Id);
  • trunk/Modules/Portal/Portal.php

    r581 r584  
    105105  {
    106106    $Output = '';
    107     $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
     107    $DbResult = $this->Database->query('SELECT *, `ActionIcon`.`Name` AS `Icon` FROM `Action` '.
     108      'LEFT JOIN `ActionIcon` ON `ActionIcon`.`Id` = `Action`.`Icon` '.
    108109      'WHERE (`Group`='.$ActionGroup['Id'].') AND (`Enable` = 1)');
    109110    while($Action = $DbResult->fetch_assoc())
     
    111112      if($Action['Icon'] == '') $Action['Icon'] = 'clear.png';
    112113        if(substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = $this->System->Link($Action['URL']);
    113         if(($Action['PermissionModule'] == '') or (($Action['PermissionModule'] != '') and $this->System->User->User->CheckPermission($Action['PermissionModule'], $Action['PermissionOperation'])))       
    114         $Output .= '<img alt="'.$Action['Title'].'" src="images/favicons/'.$Action['Icon'].'" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a><br />';
     114        if($Action['PermissionOperation'] != '')
     115        {
     116          $DbResult2 = $this->Database->query('SELECT * FROM PermissionOperation'.
     117            ' LEFT JOIN Module ON Module.Id=PermissionOperation.Module'.
     118            ' WHERE Id='.$Action['PermissionOperation']);
     119          $DbRow2 = $DbResult2->fetch_assoc();
     120          if($this->System->User->User->CheckPermission($DbRow2['Module'], $DbRow2['Operation']))
     121            $Allowed = true; else $Allowed = false;       
     122        } else $Allowed = true;
     123        if($Allowed)
     124          $Output .= '<img alt="'.$Action['Title'].'" src="images/favicons/'.$Action['Icon'].'" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a><br />';
    115125    }
    116126    return($this->Panel($ActionGroup['Name'], $Output));
  • trunk/Modules/User/User.php

    r565 r584  
    290290  function CheckPermission($Module, $Operation, $ItemType = '', $ItemIndex = 0)
    291291  {
     292    // Get module id
     293    $DbResult = $this->Database->select('Module', 'Id', '`Name`="'.$Module.'"');
     294    if($DbResult->num_rows > 0)
     295    {
     296      $DbRow = $DbResult->fetch_assoc();
     297      $ModuleId = $DbRow['Id'];
     298    } else return(false);
     299   
    292300    // First try to check cache
    293301    if(in_array(array($Module, $Operation, $ItemType, $ItemType), $this->PermissionCache))
     
    298306    {   
    299307      // If no permission combination exists in cache, do new check of database items
    300       $DbResult = $this->Database->select('PermissionOperation', 'Id', '`Module`="'.$Module.'" AND `Item`="'.$ItemType.'" AND `ItemId`='.$ItemIndex.' AND `Operation`="'.$Operation.'"');
     308      $DbResult = $this->Database->select('PermissionOperation', 'Id', '`Module`="'.$ModuleId.'" AND `Item`="'.$ItemType.'" AND `ItemId`='.$ItemIndex.' AND `Operation`="'.$Operation.'"');
    301309      if($DbResult->num_rows > 0)
    302310      {
     
    456464      'Table' => 'PermissionOperation',
    457465      'Items' => array(
    458         'Module' => array('Type' => 'String', 'Caption' => 'Modul', 'Default' => ''),
     466        'Module' => array('Type' => 'TModule', 'Caption' => 'Modul', 'Default' => ''),
    459467        'Operation' => array('Type' => 'String', 'Caption' => 'Operace', 'Default' => ''),
    460468        'Item' => array('Type' => 'String', 'Caption' => 'Položka', 'Default' => ''),
Note: See TracChangeset for help on using the changeset viewer.