Changeset 934
- Timestamp:
- May 11, 2022, 10:07:18 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UpdateTrace.php
r921 r934 2207 2207 "VALUES (NULL , 'Fyzické adresy', ".$DbRow['Id'].", '".$ActionId."', '1');"); 2208 2208 } 2209 } 2210 2211 function UpdateTo933(UpdateManager $Manager): void 2212 { 2213 $Manager->Execute('ALTER TABLE `PermissionGroup` ADD `SysName` VARCHAR(255) NULL DEFAULT "" AFTER `Description`;'); 2214 $Manager->Execute('UPDATE `PermissionGroup` SET `SysName`="admins" WHERE `Description`="Systémoví administrátoři"'); 2215 $Manager->Execute('UPDATE `PermissionGroup` SET `SysName`="network-admins" WHERE `Description`="Správci sítě"'); 2216 $Manager->Execute('UPDATE `PermissionGroup` SET `SysName`="registered-users" WHERE `Description`="Registrovaní uživatelé"'); 2217 $Manager->Execute('UPDATE `PermissionGroup` SET `SysName`="other-users" WHERE `Description`="Ostatní"'); 2218 $Manager->Execute('UPDATE `PermissionGroup` SET `SysName`="customers" WHERE `Description`="Zákazníci"'); 2209 2219 } 2210 2220 … … 2317 2327 907 => array('Revision' => 911, 'Function' => 'UpdateTo911'), 2318 2328 911 => array('Revision' => 921, 'Function' => 'UpdateTo921'), 2329 921 => array('Revision' => 933, 'Function' => 'UpdateTo933'), 2319 2330 ); 2320 2331 } -
trunk/Application/Version.php
r922 r934 1 1 <?php 2 2 3 $Revision = 9 22; // Subversion revision4 $DatabaseRevision = 9 21; // SQL structure revision5 $ReleaseTime = strtotime('2022-0 2-28');3 $Revision = 933; // Subversion revision 4 $DatabaseRevision = 933; // SQL structure revision 5 $ReleaseTime = strtotime('2022-05-11'); -
trunk/Modules/User/UserModel.php
r924 r934 173 173 'Locked' => 1)); 174 174 $UserId = $this->Database->insert_id; 175 $PermissionGroup = new PermissionGroup($this->System); 175 176 $this->Database->insert('PermissionUserAssignment', array('User' => $UserId, 176 'AssignedGroup' => 2));177 'AssignedGroup' => $PermissionGroup->GetItemBySysName('registered-users'))); 177 178 178 179 $NewPassword = substr(sha1(strtoupper($Login)), 0, 7); … … 484 485 $Desc = new ModelDesc(self::GetClassName()); 485 486 $Desc->AddString('Description'); 487 $Desc->AddString('SysName'); 488 $Desc->DefaultValuesMethod = 'GetDefaultValues'; 486 489 return $Desc; 490 } 491 492 static function GetDefaultValues(): array 493 { 494 return array( 495 array('Id' => 1, 'Description' => 'Ostatní uživatelé', 'SysName' => 'other-users'), 496 array('Id' => 2, 'Description' => 'Registrovaní uživatelé', 'SysName' => 'registered-users'), 497 array('Id' => 3, 'Description' => 'Správci', 'SysName' => 'admins'), 498 ); 499 } 500 501 function GetItemBySysName(string $Name): int 502 { 503 $DbResult = $this->Database->select('PermissionGroup', 'Id', '`SysName`="'.$Name.'"'); 504 if ($DbResult->num_rows > 0) 505 { 506 $DbRow = $DbResult->fetch_assoc(); 507 return $DbRow['Id']; 508 } else return 0; 487 509 } 488 510 } -
trunk/Packages/Common/ModelDesc.php
r923 r934 16 16 $this->PrimaryKey = 'Id'; 17 17 $this->Memory = false; 18 $this->DefaultValuesMethod = null; 18 19 } 19 20 -
trunk/Packages/Common/Modules/ModuleManager.php
r912 r934 250 250 'Type' => ModelColumnType::GetName($Field->Type), 'Nullable' => (int)$Field->Nullable)); 251 251 } 252 if ($ModelDesc->DefaultValues != null) 253 { 254 $Values = call_user_func('self::'.$ModelDesc->DefaultValues); 255 foreach ($Values as $Value) 256 { 257 $this->Databse->insert($ModelDesc->Name, $Value); 258 } 259 } 252 260 } 253 261
Note:
See TracChangeset
for help on using the changeset viewer.