Changeset 934 for trunk/Modules/User/UserModel.php
- Timestamp:
- May 11, 2022, 10:07:18 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.