Ignore:
Timestamp:
Feb 17, 2021, 5:15:29 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Insert sample data action partially implemented.
File:
1 edited

Legend:

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

    r899 r900  
    2727  function DoInstall(): void
    2828  {
    29     $this->Database->insert('PermissionGroup', array('Id' => 1, 'Description' => 'Ostatní'));
    30     $this->Database->insert('PermissionGroup', array('Id' => 2, 'Description' => 'Registrovaní uživatelé'));
    31     $this->Database->insert('PermissionGroup', array('Id' => 3, 'Description' => 'Zákazníci'));
    32     $this->Database->insert('PermissionGroup', array('Id' => 4, 'Description' => 'Správci sítě'));
    33     $this->Database->insert('PermissionGroup', array('Id' => 5, 'Description' => 'Systémoví správci'));
     29  }
     30
     31  function DoInsertSampleData(): void
     32  {
     33    $DbResult = $this->Database->select('User', 'Id', 'Login="admin"');
     34    if ($DbResult->num_rows == 0)
     35    {
     36      $UserId = $this->Database->insert('User', array('Id' => 1, 'Login' => 'admin', 'Name' => 'Admin', 'Password' => 'd04b7c77a814de3207315c2f82dcd97a90ed33ca',
     37        'Salt' => 'd5d8eb61e1a20d98b45b415ccd2fae802cb41294', 'Email' => 'admin@localhost', 'LastIpAddress' => null, 'LastLoginTime' => null,
     38        'RegistrationTime' => '2021-02-17 14:56:22', 'Locked' => 0, 'InitPassword' => null));
     39
     40      $PermissionGroup1 = $this->Database->insert('PermissionGroup', array('Description' => 'Ostatní'));
     41      $PermissionGroup2 = $this->Database->insert('PermissionGroup', array('Description' => 'Registrovaní uživatelé'));
     42      $PermissionGroup3 = $this->Database->insert('PermissionGroup', array('Description' => 'Zákazníci'));
     43      $PermissionGroup4 = $this->Database->insert('PermissionGroup', array('Description' => 'Správci sítě'));
     44      $PermissionGroup5 = $this->Database->insert('PermissionGroup', array('Description' => 'Systémoví správci'));
     45
     46      $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 'AssignedGroup' => $PermissionGroup5));
     47    }
    3448  }
    3549
Note: See TracChangeset for help on using the changeset viewer.