Changeset 77 for trunk


Ignore:
Timestamp:
Aug 25, 2009, 1:04:56 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Na některých místech kontrola oprávnění.
Location:
trunk/www
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/Application/View/Client.php

    r69 r77  
    3131    $Table->LoadValuesFromDatabase($this->Database);
    3232    $Output .= $Table->Show();
    33     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
    34     {
    35       //$Output .= '<br /><div style="text-align: center;"><a href="?Action=BackupAdd">Zálohovat</a></dev>';     
    36     }
    3733    return($Output);
    3834  }
  • trunk/www/Application/View/Emulator.php

    r74 r77  
    4747    }
    4848    $Output .= $Table->Show();
    49     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
     49    if($this->System->Modules['Permission']->Check('Emulator', 'Add'))
    5050    {
    5151      $Output .= '<br /><div style="text-align: center;"><a href="?Module=Emulator&amp;Action=Add">Přidat emulátor</a></dev>';     
     
    6464    $Output .= '<div style="text-align: center">';
    6565    $Emulator = new Emulator($this->Database, $Id);
    66     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
     66    if($this->System->Modules['Permission']->Check('Emulator', 'Download', $Emulator->Id))
    6767    {
    6868      if($Emulator->Emulator['Lock'] == 0) $Output .= ' <a href="?Module=Emulator&amp;Action=Download&amp;Id='.$Id.'">Stáhnout</a>';
     69    }
     70    if($this->System->Modules['Permission']->Check('Emulator', 'Compile', $Emulator->Id))
     71    {
    6972      if($Emulator->Emulator['Lock'] == 0) $Output .= ' <a href="?Module=Emulator&amp;Action=Compile&amp;Id='.$Id.'">Přeložit</a>';
    7073    }
     
    7578  function Add()
    7679  {
    77     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
     80    if($this->System->Modules['Permission']->Check('Emulator', 'Add'))
    7881    {
    7982      $Form = new Form($this->System, $this->ItemFormClass);
     
    8790  function AddFinish()
    8891  {
    89     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR)
     92    if($this->System->Modules['Permission']->Check('Emulator', 'Add'))
    9093    {
    9194      $Form = new Form($this->System, $this->ItemFormClass);
     
    102105    {
    103106      $Emulator = new Emulator($this->Database, $_GET['Id']);
    104       $Emulator->Download();       
    105       $Output = $this->System->SystemMessage('Stažení emulátoru', 'Úloha zařazena do fronty');
    106       $TaskView = new TaskView($this->System);
    107       $Output .= $TaskView->ItemList();
     107      if($this->System->Modules['Permission']->Check('Emulator', 'Download', $Emulator->Id))
     108      {
     109        $Emulator->Download();       
     110        $Output = $this->System->SystemMessage('Stažení emulátoru', 'Úloha zařazena do fronty');
     111        $TaskView = new TaskView($this->System);
     112        $Output .= $TaskView->ItemList();
     113      } else $Output = $this->System->Modules['Permission']->AccessDenied();
    108114    } else $Output = $this->System->SystemMessage('Stažení emulátoru', 'Nebylo zadáno Id');
    109115    return($Output);
     
    115121    {
    116122      $Emulator = new Emulator($this->Database, $_GET['Id']);
    117       $Emulator->Compile();       
    118       $Output = $this->System->SystemMessage('Překlad emulátoru', 'Úloha zařazena do fronty');
    119       $TaskView = new TaskView($this->System);
    120       $Output .= $TaskView->ItemList();
     123      if($this->System->Modules['Permission']->Check('Emulator', 'Download', $Emulator->Id))
     124      {
     125        $Emulator->Compile();       
     126        $Output = $this->System->SystemMessage('Překlad emulátoru', 'Úloha zařazena do fronty');
     127        $TaskView = new TaskView($this->System);
     128        $Output .= $TaskView->ItemList();
     129      } else $Output = $this->System->Modules['Permission']->AccessDenied();
    121130    } else $Output = $this->System->SystemMessage('Překlad emulátoru', 'Nebylo zadáno Id');
    122131    return($Output);
  • trunk/www/Application/View/Page.php

    r76 r77  
    8989      //$Output .= '<div><a href="?Action=UpdateList&amp;Id='.$Server['Id'].'">Dostupné aktualizace</a></div>';
    9090
    91       if($this->System->Modules['Permission']->CheckPermission('News', 'Add'))
     91      if($this->System->Modules['Permission']->Check('News', 'Add'))
    9292      {
    9393        $Output .= '<div><a href="?Module=News&amp;Action=Add">Přidat aktualitu</a></div>';
  • trunk/www/Application/View/Realm.php

    r74 r77  
    122122    }
    123123    $Output .= $Table->Show();
    124     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
     124    if($this->System->Modules['Permission']->Check('Realm', 'Add'))
    125125    {
    126126      $DbResult = $this->Database->query('SELECT COUNT(*) FROM Realm');
     
    154154    $Output .= $Form->ShowTable();
    155155    $Output .= '<div style="text-align: center">';
    156     if((($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) and ($this->System->Modules['User']->User['Id'] == $Realm->GetUser())) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
     156    if($this->System->Modules['Permission']->Check('Realm', 'Edit'))
    157157    {
    158158      $Output .= '<br /><a href="http://'.$this->System->Config['Web']['Host'].'/mysql/">Správa databáze</a> ';
     
    183183      $ServerId = $_GET['Id'];
    184184    $Output = '';
    185     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
     185    if($this->System->Modules['Permission']->Check('Realm', 'Add'))
    186186    {
    187187      $DbResult = $this->Database->query('SELECT COUNT(*) FROM Realm');
     
    212212    {
    213213      $ServerId = $_GET['Id'];
    214     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
     214    if($this->System->Modules['Permission']->Check('Realm', 'Add'))
    215215    {
    216216      if($this->System->Modules['User']->RealmCount() >= $Config['MaxServerCountPerUser']) $Output = $this->System->SystemMessage('Nový svět', 'Na jeden účet lze vytvořit maximálně '.$Config['MaxServerCountPerUser'].' světů');
     
    245245    $Output = '';
    246246    $Realm = new Realm($this->Database, $_POST['RealmId']);
    247     if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
     247    if($this->System->Modules['Permission']->Check('Realm', 'Save', $Realm->Id))
    248248    {
    249249      $Form = new Form($this->System, $this->EditFormClass, array());
     
    267267    $Output = '';
    268268    $Realm = new Realm($this->Database, $_GET['Id']);
    269     if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
     269    if($this->System->Modules['Permission']->Check('Realm', 'Edit', $Realm->Id))
    270270    {
    271271      $Form = new Form($this->System, $this->EditFormClass);
     
    282282    $Output = '';
    283283    $Realm = new Realm($this->Database, $_GET['Id']);
    284     if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
     284    if($this->System->Modules['Permission']->Check('Realm', 'EditDetailed', $Realm->Id))
    285285    {
    286286      $Form = new Form($this->System, $this->SettingDetailedFormClass);
     
    301301    $Output = '';
    302302    $Realm = new Realm($this->Database, $_POST['RealmId']);
    303     if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
     303    if($this->System->Modules['Permission']->Check('Realm', 'SaveDetailed', $Realm->Id))
    304304    {
    305305      $Form = new Form($this->System, $this->SettingDetailedFormClass, array());
     
    331331  {
    332332    $Output = '';
    333     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    334     {
    335       $Realm = new Realm($this->Database, $_GET['Id']);
    336       if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    337       {
    338         $Output .= $this->System->SystemMessage('Spuštění serveru', $Realm->Start());
    339         $TaskView = new TaskView($this->System);
    340         $Output .= $TaskView->ItemList();;
    341       } else $this->System->SystemMessage('Spuštění serveru', 'Nemáte oprávnění');
    342     } else $Output .= USER_BAD_ROLE;
     333    $Realm = new Realm($this->Database, $_GET['Id']);
     334    if($this->System->Modules['Permission']->Check('Realm', 'Start', $Realm->Id))
     335    {
     336      $Output .= $this->System->SystemMessage('Spuštění serveru', $Realm->Start());
     337      $TaskView = new TaskView($this->System);
     338      $Output .= $TaskView->ItemList();;
     339    } else $this->System->Modules['Permission']->AccessDenied();
    343340    return($Output);
    344341  }
     
    347344  {
    348345    $Output = '';
    349     if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    350     {
    351       $Realm = new Realm($this->Database, $_GET['Id']);
    352       if(($this->System->Modules['User']->User['Id'] == $Realm->GetUser()) or ($this->System->Modules['User']->User['Role'] >= USER_ROLE_ADMINISTRATOR))
    353       {
    354         $Output .= $this->System->SystemMessage('Zastavení serveru', $Realm->Stop());
    355         $TaskView = new TaskView($this->System);
    356         $Output .= $TaskView->ItemList();;
    357       } else $this->System->SystemMessage('Zastavení serveru', 'Nemáte oprávnění');
    358     } else $Output .= USER_BAD_ROLE;
     346    $Realm = new Realm($this->Database, $_GET['Id']);
     347    if($this->System->Modules['Permission']->Check('Realm', 'Stop', $Realm->Id))
     348    {
     349      $Output .= $this->System->SystemMessage('Zastavení serveru', $Realm->Stop());
     350      $TaskView = new TaskView($this->System);
     351      $Output .= $TaskView->ItemList();;
     352    } else $this->System->Modules['Permission']->AccessDenied();
    359353    return($Output);
    360354  }
     
    367361    {
    368362      $RealmId = $_GET['Id'];
    369       if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER)
    370       {
    371         $Realm = new Realm($this->Database, $RealmId);
    372         if($Realm->GetUser() == $this->System->Modules['User']->User['Id'])
    373         {
    374           $Output = $this->System->SystemMessage('Vynulování databáze', $Realm->ImportDatabase(true));
    375           $TaskView = new TaskView($this->System);
    376           $Output .= $TaskView->ItemList();
    377           //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
    378           //$Form->OnSubmit = '?Action=ServerCreate';
     363      $Realm = new Realm($this->Database, $RealmId);
     364      if($this->System->Modules['Permission']->Check('Realm', 'InitDatabase', $Realm->Id))
     365      {
     366        $Output = $this->System->SystemMessage('Vynulování databáze', $Realm->ImportDatabase(true));
     367        $TaskView = new TaskView($this->System);
     368        $Output .= $TaskView->ItemList();
     369        //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
     370        //$Form->OnSubmit = '?Action=ServerCreate';
    379371          //$Output .= $Form->ShowEditForm();
    380         } else $Output = $this->System->SystemMessage('Vynulování databáze', 'Nemáte oprávnění');
    381       } else $Output = USER_BAD_ROLE;
     372      } else $this->System->Modules['Permission']->AccessDenied();
    382373    } else $Output = $this->System->SystemMessage('Vynulování databáze', 'Nezadáno Id serveru');
    383374    return($Output);
  • trunk/www/Application/View/Server.php

    r76 r77  
    101101    }
    102102    $Output .= $Table->Show();
    103     if($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER)
     103    if($this->System->Modules['Permission']->Check('Server', 'Add'))
    104104    {
    105105      $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server');
     
    109109      $DbRow = $DbResult->fetch_row();
    110110      if(($ServerCount < $Config['MaxServerCount']) and ($DbRow[0] < $Config['MaxServerCountPerUser']))
    111         $Output .= '<br /><div style="text-align: center;"><a href="?Module=Server&amp;Action=Add">Vytvořit nový server</a></dev>';     
     111        $Output .= '<br /><div style="text-align: center;"><a href="?Module=Server&amp;Action=Add">Vytvořit nový server</a></div>';     
    112112    }
    113113    return($Output);
     
    137137    $Output .= $Form->ShowTable();
    138138    $Output .= '<div style="text-align: center">';
    139     if((($this->System->Modules['User']->Data['Role'] >= USER_ROLE_USER) and ($this->System->Modules['User']->Data['Id'] == $Server->Server['User'])) or ($this->System->Modules['User']->Data['Role'] >= USER_ROLE_ADMINISTRATOR))
     139    if($this->System->Modules['Permission']->Check('Server', 'Edit'))
    140140    {
    141141      $Output .= '<br /><a href="http://'.$this->System->Config['Web']['Host'].'/mysql/">Správa databáze</a> ';
    142142      if(array_key_exists('Id', $Server->Server['Database']) and ($Server->Server['Lock'] == 0))
    143143      {
    144         if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Action=ServerStop&amp;Id='.$Server->Id.'">Zastavit</a>  <a href="?Module=Server&amp;Action=Restart&amp;Id='.$Server->Id.'">Restartovat</a>';
     144        if($ServerStatus['RealmdPortState'] == true) $Output .= ' <a href="?Module=Server&amp;Action=Stop&amp;Id='.$Server->Id.'">Zastavit</a>  <a href="?Module=Server&amp;Action=Restart&amp;Id='.$Server->Id.'">Restartovat</a>';
    145145          else $Output .= ' <a href="?Module=Server&amp;Action=Start&amp;Id='.$Server->Id.'">Spustit</a>';
    146146      }
  • trunk/www/Application/View/User.php

    r76 r77  
    6969    $Form->LoadValuesFromForm();
    7070    $Result = $this->System->Modules['User']->Login($Form->Values['Username'], $Form->Values['Password']);
    71     $Output = $this->System->SystemMessage('Přihlášení', $Result);
     71    $Page = new PageView($this->System);
     72    $Output = $Page->SystemMessage('Přihlášení', $Result);
    7273    if($Result <> $this->System->Translate('UserLoggedIn'))
    7374    {
     
    8990      $Form->LoadValuesFromForm();
    9091      $Result = $this->System->Modules['User']->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name']);
    91       $Output = $this->System->SystemMessage('Registrace nového účtu', $Result);
     92      $Page = new PageView($this->System);
     93      $Output = $Page->SystemMessage('Registrace nového účtu', $Result);
    9294      if($Result <> $this->System->Translate('UserRegistrated'))
    9395      {
     
    101103  function PasswordRecoveryConfirm()
    102104  {
    103     $Output = $this->System->SystemMessage('Obnova hesla', $this->System->Modules['User']->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
     105    $Page = new PageView($this->System);
     106    $Output = $Page->SystemMessage('Obnova hesla', $this->System->Modules['User']->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
    104107    $Output .= $this->LoginForm();
    105108    return($Output);
     
    111114    $Form->LoadValuesFromForm();
    112115    $Result = $this->System->Modules['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
    113     $Output = $this->System->SystemMessage('Obnova hesla', $Result);
     116    $Page = new PageView($this->System);
     117    $Output = $Page->SystemMessage('Obnova hesla', $Result);
    114118    if($Result <> $this->System->Translate('UserPasswordRecoverySuccess'))
    115119    {
     
    129133  function Logout()
    130134  {
    131     $Output = $this->System->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout());
     135    $Page = new PageView($this->System);
     136    $Output = $Page->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout());
    132137    $Output .= $this->Login();
    133138    return($Output);
     
    148153    $UserOptions->LoadValuesFromForm();
    149154    $UserOptions->SaveValuesToDatabase($this->System->Modules['User']->User['Id']);
    150     $Output = $this->System->SystemMessage('Nastavení', 'Nastavení uloženo.');
     155    $Page = new PageView($this->System);
     156    $Output = $Page->SystemMessage('Nastavení', 'Nastavení uloženo.');
    151157    $this->System->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $UserOptions->Values['Name']);
    152158    $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
     
    177183    if($Config['Web']['UserRegistrationEnabled'])
    178184    {
    179       $Output = $this->System->SystemMessage('Potvrzení registrace', $this->System->Modules['User']->RegisterConfirm($_GET['User'], $_GET['H']));
     185      $Page = new PageView($this->System);
     186      $Output = $Page->SystemMessage('Potvrzení registrace', $this->System->Modules['User']->RegisterConfirm($_GET['User'], $_GET['H']));
    180187      $Output .= $this->ShowLoginForm();
    181188    } else $Output = 'Registrace nových účtů nejsou povoleny.';
  • trunk/www/index.php

    r76 r77  
    2323  else $System->Modules['User']->Data['Id'] = $Config['Web']['UserConsoleId'];
    2424$System->Modules['Permission']->LoadForUser($System->Modules['User']->Data['Id']);
    25 print_r($System->Modules['Permission']->Data);
     25//print_r($System->Modules['Permission']->Data);
    2626
    2727if(array_key_exists('Module', $_GET)) $Module = $_GET['Module'];
Note: See TracChangeset for help on using the changeset viewer.